server: auto populate plugin info

This commit is contained in:
Koushik Dutta
2022-03-07 09:53:01 -08:00
parent ec61c0f11a
commit e463b63348
3 changed files with 16 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/server",
"version": "0.0.148",
"version": "0.0.149",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/server",
"version": "0.0.148",
"version": "0.0.149",
"license": "ISC",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.8",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/server",
"version": "0.0.148",
"version": "0.0.149",
"description": "",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.8",

View File

@@ -479,7 +479,12 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
}
async installPlugin(plugin: Plugin, pluginDebug?: PluginDebug): Promise<PluginHost> {
const device: Device = Object.assign({}, plugin.packageJson.scrypted);
const device: Device = Object.assign({}, plugin.packageJson.scrypted, {
info: {
manufacturer: plugin.packageJson.name,
version: plugin.packageJson.version,
}
} as Device);
try {
if (!device.interfaces.includes(ScryptedInterface.Readme)) {
const zipData = Buffer.from(plugin.zip, 'base64');
@@ -743,6 +748,13 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
for await (const plugin of this.datastore.getAll(Plugin)) {
try {
const pluginDevice = this.findPluginDevice(plugin._id);
setState(pluginDevice, ScryptedInterfaceProperty.info, {
info: {
manufacturer: plugin.packageJson.name,
version: plugin.packageJson.version,
}
} as Device);
this.runPlugin(plugin);
}
catch (e) {