@camera.ui/server 0.0.11-alpha.5 → 0.0.11-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server/package.json
CHANGED
|
@@ -578,7 +578,7 @@ export class PluginsController {
|
|
|
578
578
|
async updateSystem(req, reply) {
|
|
579
579
|
try {
|
|
580
580
|
const installPath = await this.managePlugin('install', { pluginName: req.body.pluginname, version: req.body.pluginversion });
|
|
581
|
-
this.logger.log(`System updated: ${ConfigService.
|
|
581
|
+
this.logger.log(`System updated: ${ConfigService.NAME}@${ConfigService.VERSION} (${installPath})`);
|
|
582
582
|
return reply.code(204).send();
|
|
583
583
|
}
|
|
584
584
|
catch (error) {
|
|
@@ -590,9 +590,9 @@ export class PluginsController {
|
|
|
590
590
|
}
|
|
591
591
|
async managePlugin(action, pluginInfo) {
|
|
592
592
|
pluginInfo.version = pluginInfo.version || 'latest';
|
|
593
|
-
if (pluginInfo.pluginName === ConfigService.
|
|
593
|
+
if (pluginInfo.pluginName === ConfigService.NAME) {
|
|
594
594
|
if (action === 'uninstall' || action === 'unlink') {
|
|
595
|
-
throw new Error(`Cannot uninstall ${pluginInfo.pluginName} from ${ConfigService.
|
|
595
|
+
throw new Error(`Cannot uninstall ${pluginInfo.pluginName} from ${ConfigService.NAME}.`);
|
|
596
596
|
}
|
|
597
597
|
if (!ConfigService.INSTALL_PATH) {
|
|
598
598
|
throw new Error(`Can not determine the install path for ${pluginInfo.pluginName}`);
|
|
@@ -602,7 +602,7 @@ export class PluginsController {
|
|
|
602
602
|
pluginInfo.version = await this.getNpmModuleLatestVersion(pluginInfo.pluginName);
|
|
603
603
|
}
|
|
604
604
|
let installPath = this.configService.PLUGINS_INSTALL_PATH;
|
|
605
|
-
if (pluginInfo.pluginName === ConfigService.
|
|
605
|
+
if (pluginInfo.pluginName === ConfigService.NAME) {
|
|
606
606
|
installPath = ConfigService.INSTALL_PATH;
|
|
607
607
|
}
|
|
608
608
|
else {
|
|
@@ -615,20 +615,20 @@ export class PluginsController {
|
|
|
615
615
|
installPath = resolve(installPath, '../');
|
|
616
616
|
const installOptions = [];
|
|
617
617
|
// installOptions.push('--verbose');
|
|
618
|
-
if (platform() === 'win32' || pluginInfo.pluginName === ConfigService.
|
|
618
|
+
if (platform() === 'win32' || pluginInfo.pluginName === ConfigService.NAME) {
|
|
619
619
|
installOptions.push('-g');
|
|
620
620
|
}
|
|
621
621
|
const npmPluginLabel = action === 'uninstall' || action === 'unlink' ? pluginInfo.pluginName : `${pluginInfo.pluginName}@${pluginInfo.version}`;
|
|
622
622
|
try {
|
|
623
623
|
await this.runNpmCommand([...this.getNpmPath(), action, ...installOptions, npmPluginLabel], installPath, pluginInfo);
|
|
624
624
|
await this.ensurePluginDirExists();
|
|
625
|
-
if (pluginInfo.id && (action === 'uninstall' || action === 'unlink') && pluginInfo.pluginName !== ConfigService.
|
|
625
|
+
if (pluginInfo.id && (action === 'uninstall' || action === 'unlink') && pluginInfo.pluginName !== ConfigService.NAME) {
|
|
626
626
|
await this.camerasService.removeByPluginId(pluginInfo.id);
|
|
627
627
|
}
|
|
628
628
|
return installPath;
|
|
629
629
|
}
|
|
630
630
|
catch (error) {
|
|
631
|
-
if (pluginInfo.pluginName === ConfigService.
|
|
631
|
+
if (pluginInfo.pluginName === ConfigService.NAME) {
|
|
632
632
|
this.io.of('/logs').emit('stdout', yellow('\r\nCleaning up npm cache, please wait...\r\n'));
|
|
633
633
|
await this.cleanNpmCache();
|
|
634
634
|
this.io.of('/logs').emit('stdout', yellow('npm cache cleared, please try updating camera.ui again.\r\n'));
|
|
@@ -5,7 +5,7 @@ export declare class ConfigService {
|
|
|
5
5
|
static readonly IS_DOCKER: boolean;
|
|
6
6
|
static readonly IS_ELECTRON: boolean;
|
|
7
7
|
static readonly IS_HA: boolean;
|
|
8
|
-
static readonly
|
|
8
|
+
static readonly NAME: string;
|
|
9
9
|
static readonly VERSION: string;
|
|
10
10
|
static readonly NODE_VERSION: string;
|
|
11
11
|
static readonly MIN_NODE_VERSION: string;
|
|
@@ -38,14 +38,14 @@ export class ConfigService {
|
|
|
38
38
|
static IS_ELECTRON = process.env.CAMERA_UI_RUNMODE === 'electron';
|
|
39
39
|
static IS_HA = process.env.CAMERA_UI_RUNMODE === 'ha';
|
|
40
40
|
// version
|
|
41
|
-
static
|
|
41
|
+
static NAME = packageJson.name;
|
|
42
42
|
static VERSION = packageJson.version;
|
|
43
43
|
static NODE_VERSION = process.version;
|
|
44
44
|
static MIN_NODE_VERSION = ConfigService.extractVersion(packageJson.engines.node);
|
|
45
45
|
// paths
|
|
46
46
|
static SERVER_PATH = resolve(__dirname, '../../../');
|
|
47
47
|
static INTERFACE_PATH = ConfigService.IS_DEV && !ConfigService.IS_ELECTRON ? resolve(__dirname, '../../../dist/interface') : resolve(__dirname, '../../../../interface');
|
|
48
|
-
static INSTALL_PATH = ConfigService.IS_ELECTRON || ConfigService.IS_DEV ? null : findInstalledPath(ConfigService.
|
|
48
|
+
static INSTALL_PATH = ConfigService.IS_ELECTRON || ConfigService.IS_DEV ? null : findInstalledPath(ConfigService.NAME);
|
|
49
49
|
logger;
|
|
50
50
|
_config;
|
|
51
51
|
_go2rtcConfig;
|