diff --git a/package-lock.json b/package-lock.json index 6b536b78f..7de3239c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,8 +74,8 @@ "@types/tar": "^6.1.9", "@types/tcp-port-used": "^1.0.4", "@types/unzipper": "^0.10.9", - "@typescript-eslint/eslint-plugin": "^6.10.0", - "@typescript-eslint/parser": "^6.10.0", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", "babel-jest": "^29.7.0", "bash-color": "^0.0.4", "buffer-shims": "^1.0.0", @@ -2750,16 +2750,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.10.0.tgz", - "integrity": "sha512-uoLj4g2OTL8rfUQVx2AFO1hp/zja1wABJq77P6IclQs6I/m9GLrm7jCdgzZkvWdDCQf1uEvoa8s8CupsgWQgVg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.11.0.tgz", + "integrity": "sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.10.0", - "@typescript-eslint/type-utils": "6.10.0", - "@typescript-eslint/utils": "6.10.0", - "@typescript-eslint/visitor-keys": "6.10.0", + "@typescript-eslint/scope-manager": "6.11.0", + "@typescript-eslint/type-utils": "6.11.0", + "@typescript-eslint/utils": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -2785,15 +2785,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.10.0.tgz", - "integrity": "sha512-+sZwIj+s+io9ozSxIWbNB5873OSdfeBEH/FR0re14WLI6BaKuSOnnwCJ2foUiu8uXf4dRp1UqHP0vrZ1zXGrog==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.11.0.tgz", + "integrity": "sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.10.0", - "@typescript-eslint/types": "6.10.0", - "@typescript-eslint/typescript-estree": "6.10.0", - "@typescript-eslint/visitor-keys": "6.10.0", + "@typescript-eslint/scope-manager": "6.11.0", + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/typescript-estree": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", "debug": "^4.3.4" }, "engines": { @@ -2813,13 +2813,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.10.0.tgz", - "integrity": "sha512-TN/plV7dzqqC2iPNf1KrxozDgZs53Gfgg5ZHyw8erd6jd5Ta/JIEcdCheXFt9b1NYb93a1wmIIVW/2gLkombDg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz", + "integrity": "sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.10.0", - "@typescript-eslint/visitor-keys": "6.10.0" + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2830,13 +2830,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.10.0.tgz", - "integrity": "sha512-wYpPs3hgTFblMYwbYWPT3eZtaDOjbLyIYuqpwuLBBqhLiuvJ+9sEp2gNRJEtR5N/c9G1uTtQQL5AhV0fEPJYcg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.11.0.tgz", + "integrity": "sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.10.0", - "@typescript-eslint/utils": "6.10.0", + "@typescript-eslint/typescript-estree": "6.11.0", + "@typescript-eslint/utils": "6.11.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2857,9 +2857,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.10.0.tgz", - "integrity": "sha512-36Fq1PWh9dusgo3vH7qmQAj5/AZqARky1Wi6WpINxB6SkQdY5vQoT2/7rW7uBIsPDcvvGCLi4r10p0OJ7ITAeg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.11.0.tgz", + "integrity": "sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2870,13 +2870,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.10.0.tgz", - "integrity": "sha512-ek0Eyuy6P15LJVeghbWhSrBCj/vJpPXXR+EpaRZqou7achUWL8IdYnMSC5WHAeTWswYQuP2hAZgij/bC9fanBg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz", + "integrity": "sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.10.0", - "@typescript-eslint/visitor-keys": "6.10.0", + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2897,17 +2897,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.10.0.tgz", - "integrity": "sha512-v+pJ1/RcVyRc0o4wAGux9x42RHmAjIGzPRo538Z8M1tVx6HOnoQBCX/NoadHQlZeC+QO2yr4nNSFWOoraZCAyg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.11.0.tgz", + "integrity": "sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.10.0", - "@typescript-eslint/types": "6.10.0", - "@typescript-eslint/typescript-estree": "6.10.0", + "@typescript-eslint/scope-manager": "6.11.0", + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/typescript-estree": "6.11.0", "semver": "^7.5.4" }, "engines": { @@ -2922,12 +2922,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.10.0.tgz", - "integrity": "sha512-xMGluxQIEtOM7bqFCo+rCMh5fqI+ZxV5RUUOa29iVPz1OgCZrtc7rFnz5cLUazlkPKYqX+75iuDq7m0HQ48nCg==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz", + "integrity": "sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.10.0", + "@typescript-eslint/types": "6.11.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -4965,9 +4965,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.581", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz", - "integrity": "sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw==", + "version": "1.4.582", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.582.tgz", + "integrity": "sha512-89o0MGoocwYbzqUUjc+VNpeOFSOK9nIdC5wY4N+PVUarUK0MtjyTjks75AZS2bW4Kl8MdewdFsWaH0jLy+JNoA==", "dev": true }, "node_modules/emittery": { diff --git a/package.json b/package.json index a042277cf..7142c64ce 100644 --- a/package.json +++ b/package.json @@ -103,8 +103,8 @@ "@types/tar": "^6.1.9", "@types/tcp-port-used": "^1.0.4", "@types/unzipper": "^0.10.9", - "@typescript-eslint/eslint-plugin": "^6.10.0", - "@typescript-eslint/parser": "^6.10.0", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", "babel-jest": "^29.7.0", "bash-color": "^0.0.4", "buffer-shims": "^1.0.0", diff --git a/src/core/auth/auth.service.ts b/src/core/auth/auth.service.ts index 83d34de51..e6a87a9a0 100644 --- a/src/core/auth/auth.service.ts +++ b/src/core/auth/auth.service.ts @@ -310,7 +310,7 @@ export class AuthService { */ private async saveUserFile(users: UserDto[]) { // update the auth.json - return fs.writeJson(this.configService.authPath, users, { spaces: 4 }); + return fs.writeJsonSync(this.configService.authPath, users, { spaces: 4 }); } /** diff --git a/src/modules/backup/backup.service.ts b/src/modules/backup/backup.service.ts index b0c3165ce..1d1bd0b6b 100644 --- a/src/modules/backup/backup.service.ts +++ b/src/modules/backup/backup.service.ts @@ -175,7 +175,7 @@ export class BackupService { } } else { // when not using a custom backup path, just ensure it exists - return fs.ensureDir(this.configService.instanceBackupPath); + return fs.ensureDirSync(this.configService.instanceBackupPath); } } @@ -337,7 +337,7 @@ export class BackupService { */ async removeRestoreDirectory() { if (this.restoreDirectory) { - return fs.remove(this.restoreDirectory); + return fs.removeSync(this.restoreDirectory); } } diff --git a/src/modules/config-editor/config-editor.service.ts b/src/modules/config-editor/config-editor.service.ts index 7d7cde54d..26bbbe1b7 100644 --- a/src/modules/config-editor/config-editor.service.ts +++ b/src/modules/config-editor/config-editor.service.ts @@ -333,7 +333,7 @@ export class ConfigEditorService { } // read source backup - return fs.readFile(requestedBackupPath); + return fs.readFileSync(requestedBackupPath); } /** diff --git a/src/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.ts b/src/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.ts index e32e4e36e..fe62d3b08 100644 --- a/src/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.ts +++ b/src/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.ts @@ -117,7 +117,7 @@ export class PluginsSettingsUiService { // dev server is only enabled for private plugins return (await this.httpService.get(pluginUi.devServer, { responseType: 'text' }).toPromise()).data; } else { - return fs.readFile(path.join(pluginUi.publicPath, 'index.html'), 'utf8'); + return fs.readFileSync(path.join(pluginUi.publicPath, 'index.html'), 'utf8'); } } diff --git a/src/modules/plugins/plugins.service.ts b/src/modules/plugins/plugins.service.ts index 2272cd617..920cce846 100755 --- a/src/modules/plugins/plugins.service.ts +++ b/src/modules/plugins/plugins.service.ts @@ -724,7 +724,7 @@ export class PluginsService { const schemaPath = path.resolve(plugin.installPath, pluginName, 'config.schema.json'); if (this.miscSchemas[pluginName] && !await fs.pathExists(schemaPath)) { - return fs.readJson(this.miscSchemas[pluginName]); + return fs.readJsonSync(this.miscSchemas[pluginName]); } let configSchema = await fs.readJson(schemaPath); diff --git a/ui/package-lock.json b/ui/package-lock.json index fca297f61..d9e949148 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -6586,9 +6586,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.581", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.581.tgz", - "integrity": "sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw==" + "version": "1.4.582", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.582.tgz", + "integrity": "sha512-89o0MGoocwYbzqUUjc+VNpeOFSOK9nIdC5wY4N+PVUarUK0MtjyTjks75AZS2bW4Kl8MdewdFsWaH0jLy+JNoA==" }, "node_modules/emoji-regex": { "version": "8.0.0", diff --git a/ui/package.json b/ui/package.json index 07b36e2ae..689a09068 100644 --- a/ui/package.json +++ b/ui/package.json @@ -7,7 +7,7 @@ "ng": "ng", "start": "ng serve", "build": "ng build --configuration production --output-path=../public --source-map=false --aot=true", - "lint": "ng lint --fix" + "lint": "ng lint" }, "private": true, "dependencies": { diff --git a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html index 3e1b608fb..b36198ddb 100644 --- a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html +++ b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html @@ -51,13 +51,23 @@

+ + + + + + - + 'text-warning': childBridgeStatus === 'pending', 'red-text': childBridgeStatus === 'down' }"> - - - - - - +
+ diff --git a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts index dd43f0caa..2cf538c39 100644 --- a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts +++ b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts @@ -9,6 +9,7 @@ import { ManagePluginsService } from '@/app/core/manage-plugins/manage-plugins.s import { PluginLogModalComponent } from '@/app/core/manage-plugins/plugin-log-modal/plugin-log-modal.component'; import { MobileDetectService } from '@/app/core/mobile-detect.service'; import { NotificationService } from '@/app/core/notification.service'; +import { SettingsService } from '@/app/core/settings.service'; import { WsService } from '@/app/core/ws.service'; import { DonateModalComponent } from '@/app/modules/plugins/donate-modal/donate-modal.component'; @@ -30,6 +31,7 @@ export class PluginCardComponent implements OnInit { public allChildBridgesStopped = false; public childBridgeStatus = 'pending'; public childBridgeRestartInProgress = false; + public recommendChildBridge = false; constructor( public $plugin: ManagePluginsService, @@ -40,9 +42,26 @@ export class PluginCardComponent implements OnInit { private $modal: NgbModal, private $toastr: ToastrService, private $md: MobileDetectService, - ) { } - - ngOnInit(): void {} + private $settings: SettingsService, + ) {} + + ngOnInit(): void { + if ( + !this.$settings.env.recommendChildBridges + || !this.$settings.env.serviceMode + || ['homebridge', 'homebridge-config-ui-x'].includes(this.plugin.name) + ) { + this.recommendChildBridge = false; + return; + } + this.$api.get(`/plugins/config-schema/${encodeURIComponent(this.plugin.name)}`, {}).toPromise() + .then((schema) => { + this.recommendChildBridge = schema.pluginType === 'platform'; + }) + .catch(() => { + this.recommendChildBridge = false; + }); + } @Input() set childBridges(childBridges: any[]) { this.hasChildBridges = childBridges.length > 0; diff --git a/ui/src/app/modules/plugins/plugins.component.ts b/ui/src/app/modules/plugins/plugins.component.ts index 8388c5494..3de645220 100644 --- a/ui/src/app/modules/plugins/plugins.component.ts +++ b/ui/src/app/modules/plugins/plugins.component.ts @@ -1,13 +1,10 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; -import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; +import { NavigationEnd, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { ToastrService } from 'ngx-toastr'; import { Subscription } from 'rxjs'; -import { take } from 'rxjs/operators'; import { ApiService } from '@/app/core/api.service'; -import { ManagePluginsService } from '@/app/core/manage-plugins/manage-plugins.service'; -import { SettingsService } from '@/app/core/settings.service'; import { WsService } from '@/app/core/ws.service'; @Component({ @@ -29,12 +26,9 @@ export class PluginsComponent implements OnInit, OnDestroy { private navigationSubscription: Subscription; constructor( - private $settings: SettingsService, private $api: ApiService, private $ws: WsService, - private $plugin: ManagePluginsService, private $router: Router, - private $route: ActivatedRoute, private $toastr: ToastrService, private $translate: TranslateService, ) { } @@ -80,21 +74,6 @@ export class PluginsComponent implements OnInit, OnDestroy { this.$translate.instant('toast.title_error'), ); } - - this.$route.queryParams.pipe(take(1)).subscribe(async (params) => { - if (params.installed && this.installedPlugins.find((x: any) => x.name === params.installed)) { - const plugin = this.installedPlugins.find((x: any) => x.name === params.installed); - this.$plugin.settings(plugin) - .then((schema?) => { - this.recommendChildBridge(plugin, schema); - }) - .finally(() => { - this.$router.navigate([], { - queryParams: {}, - }); - }); - } - }); } search() { @@ -127,17 +106,6 @@ export class PluginsComponent implements OnInit, OnDestroy { } } - recommendChildBridge(plugin: any, schema: any) { - if ( - this.$settings.env.recommendChildBridges && - this.$settings.env.serviceMode && - schema && - schema.pluginType === 'platform' - ) { - this.$plugin.bridgeSettings(plugin); - } - } - getChildBridgeMetadata() { this.io.request('get-homebridge-child-bridge-status').subscribe((data) => { this.childBridges = data; diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index 643052d43..fe05fccf5 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -80,9 +80,10 @@ "child_bridge.label_bridge_paired": "Bridge Paired", "child_bridge.label_bridge_restart_child_bridges": "Restart Child Bridges", "child_bridge.label_bridge_settings": "Bridge Settings", + "child_bridge.label_bridge_setup_child_bridges": "Setup Child Bridges", "child_bridge.label_child_bridges": "Child Bridges", - "child_bridge.label_child_start": "Start child bridge", - "child_bridge.label_child_stop": "Stop child bridge", + "child_bridge.label_child_start": "Start Child Bridges", + "child_bridge.label_child_stop": "Stop Child Bridges", "child_bridge.message_about": "Homebridge allows you to run your plugin's platform or accessory as an isolated child bridge. This can improve the general responsiveness and reliability of Homebridge.", "child_bridge.message_child_bridges_must_be_paired_separately": "Each child bridge platform or accessory will need to be paired with HomeKit separately.", "child_bridge.message_must_configure_plugin_first": "You need to configure this plugin before you can manage its bridge settings.", @@ -238,7 +239,7 @@ "plugins.settings.label_open_config_editor": "Open Config Editor", "plugins.settings.message_consult_documentation": "Please consult the plugin documentation for instructions on how to correctly configure this plugin.", "plugins.settings.message_manual_config_required": "This plugin must be configured manually using the Homebridge UI Config Editor.", - "plugins.settings.title_settings": "Settings", + "plugins.settings.title_settings": "Config", "plugins.settings.toast_plugin_config_saved": "Plugin Config Saved", "plugins.settings.toast_restart_required": "Restart Homebridge to apply the changes.", "plugins.status_disabled": "Disabled",