diff --git a/package-lock.json b/package-lock.json index e73fc8e91..b4e4f00aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,7 @@ "bash-color": "^0.0.4", "buffer-shims": "^1.0.0", "concurrently": "^8.2.2", - "eslint": "^8.52.0", + "eslint": "^8.53.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jest": "^27.6.0", @@ -701,9 +701,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -751,9 +751,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz", + "integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2061,9 +2061,9 @@ } }, "node_modules/@nestjs/testing": { - "version": "10.2.7", - "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-10.2.7.tgz", - "integrity": "sha512-d2SIqiJIf/7NSILeNNWSdRvTTpHSouGgisGHwf5PVDC7z4/yXZw/wPO9eJhegnxFlqk6n2LW4QBTmMzbqjAfHA==", + "version": "10.2.8", + "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-10.2.8.tgz", + "integrity": "sha512-9Kj5IQhM67/nj/MT6Wi2OmWr5YQnCMptwKVFrX1TDaikpY12196v7frk0jVjdT7wms7rV07GZle9I2z0aSjqtQ==", "dev": true, "dependencies": { "tslib": "2.6.2" @@ -3754,9 +3754,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001559", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", - "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", + "version": "1.0.30001561", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz", + "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==", "dev": true, "funding": [ { @@ -4603,9 +4603,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.571", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.571.tgz", - "integrity": "sha512-Sc+VtKwKCDj3f/kLBjdyjMpNzoZsU6WuL/wFb6EH8USmHEcebxRXcRrVpOpayxd52tuey4RUDpUsw5OS5LhJqg==", + "version": "1.4.576", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.576.tgz", + "integrity": "sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA==", "dev": true }, "node_modules/emittery": { @@ -4697,9 +4697,9 @@ } }, "node_modules/envinfo": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", - "integrity": "sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.11.0.tgz", + "integrity": "sha512-G9/6xF1FPbIw0TtalAMaVPpiq2aDEuKLXM314jPVAO9r2fo2a4BLqMNkmRS7O/xPPZ+COAhGIz3ETvHEV3eUcg==", "dev": true, "bin": { "envinfo": "dist/cli.js" @@ -4840,15 +4840,15 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz", + "integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.53.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -5570,15 +5570,16 @@ "dev": true }, "node_modules/fast-json-stringify": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-5.8.0.tgz", - "integrity": "sha512-VVwK8CFMSALIvt14U8AvrSzQAwN/0vaVRiFFUVlpnXSnDGrSkOAO5MtzyN8oQNjLd5AqTW5OZRgyjoNuAuR3jQ==", + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-5.9.1.tgz", + "integrity": "sha512-NMrf+uU9UJnTzfxaumMDXK1NWqtPCfGoM9DYIE+ESlaTQqjlANFBy0VAbsm6FB88Mx0nceyi18zTo5kIEUlzxg==", "dependencies": { "@fastify/deepmerge": "^1.0.0", "ajv": "^8.10.0", "ajv-formats": "^2.1.1", "fast-deep-equal": "^3.1.3", "fast-uri": "^2.1.0", + "json-schema-ref-resolver": "^1.0.1", "rfdc": "^1.2.0" } }, @@ -8610,6 +8611,14 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "node_modules/json-schema-ref-resolver": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-schema-ref-resolver/-/json-schema-ref-resolver-1.0.1.tgz", + "integrity": "sha512-EJAj1pgHc1hxF6vo2Z3s69fMjO1INq6eGHXZ8Z6wCQeldCuwxGK9Sxf4/cScGn3FZubCVUehfWtcDM/PLteCQw==", + "dependencies": { + "fast-deep-equal": "^3.1.3" + } + }, "node_modules/json-schema-resolver": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/json-schema-resolver/-/json-schema-resolver-2.0.0.tgz", @@ -11077,9 +11086,9 @@ } }, "node_modules/terser": { - "version": "5.23.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.23.0.tgz", - "integrity": "sha512-Iyy83LN0uX9ZZLCX4Qbu5JiHiWjOCTwrmM9InWOzVeM++KNWEsqV4YgN9U9E8AlohQ6Gs42ztczlWOG/lwDAMA==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -11722,9 +11731,9 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "engines": { "node": ">= 10.0.0" } @@ -12283,9 +12292,9 @@ "dev": true }, "node_modules/yaml": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", - "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", "engines": { "node": ">= 14" } diff --git a/package.json b/package.json index dce0e550a..6b3bc3852 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "bash-color": "^0.0.4", "buffer-shims": "^1.0.0", "concurrently": "^8.2.2", - "eslint": "^8.52.0", + "eslint": "^8.53.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jest": "^27.6.0", @@ -153,4 +153,4 @@ "smart home", "hb-service" ] -} \ No newline at end of file +} diff --git a/src/modules/custom-plugins/custom-plugins.module.ts b/src/modules/custom-plugins/custom-plugins.module.ts index 8e9f058be..5381cca2c 100644 --- a/src/modules/custom-plugins/custom-plugins.module.ts +++ b/src/modules/custom-plugins/custom-plugins.module.ts @@ -1,9 +1,11 @@ import { Module } from '@nestjs/common'; +import { HomebridgeDeconzModule } from './homebridge-deconz/homebridge-deconz.module'; import { HomebridgeHueModule } from './homebridge-hue/homebridge-hue.module'; import { PluginsSettingsUiModule } from './plugins-settings-ui/plugins-settings-ui.module'; @Module({ imports: [ + HomebridgeDeconzModule, HomebridgeHueModule, PluginsSettingsUiModule, ], diff --git a/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.ts b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.ts new file mode 100644 index 000000000..5dcb80c79 --- /dev/null +++ b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.ts @@ -0,0 +1,25 @@ +import { Controller, UseGuards, Get, Header, StreamableFile } from '@nestjs/common'; +import { AuthGuard } from '@nestjs/passport'; +import { ApiTags, ApiBearerAuth } from '@nestjs/swagger'; +import { AdminGuard } from '../../../core/auth/guards/admin.guard'; +import { HomebridgeDeconzService } from './homebridge-deconz.service'; + +@ApiTags('Plugins') +@ApiBearerAuth() +@UseGuards(AuthGuard()) +@Controller('plugins/custom-plugins/homebridge-deconz') +export class HomebridgeDeconzController { + + constructor( + private homebridgeDeconzService: HomebridgeDeconzService, + ) { } + + @UseGuards(AdminGuard) + @Get('/dump-file') + @Header('Content-disposition', 'attachment; filename=homebridge-deconz.json.gz') + @Header('Content-Type', 'application/json+gzip') + async exchangeCredentials(): Promise { + return this.homebridgeDeconzService.streamDumpFile(); + } + +} diff --git a/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.ts b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.ts new file mode 100644 index 000000000..f87163d53 --- /dev/null +++ b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.ts @@ -0,0 +1,23 @@ +import { Module } from '@nestjs/common'; +import { PassportModule } from '@nestjs/passport'; +import { LoggerModule } from '../../../core/logger/logger.module'; +import { ConfigModule } from '../../../core/config/config.module'; +import { HomebridgeDeconzController } from './homebridge-deconz.controller'; +import { HomebridgeDeconzService } from './homebridge-deconz.service'; + +@Module({ + imports: [ + PassportModule.register({ defaultStrategy: 'jwt' }), + ConfigModule, + LoggerModule, + ], + providers: [ + HomebridgeDeconzService, + ], + exports: [ + ], + controllers: [ + HomebridgeDeconzController, + ], +}) +export class HomebridgeDeconzModule { } diff --git a/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.ts b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.ts new file mode 100644 index 000000000..6200e1d14 --- /dev/null +++ b/src/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as fs from 'fs-extra'; +import { Injectable, NotFoundException, StreamableFile } from '@nestjs/common'; +import { ConfigService } from '../../../core/config/config.service'; + +@Injectable() +export class HomebridgeDeconzService { + constructor( + private configService: ConfigService, + ) { } + + async streamDumpFile(): Promise { + const dumpPath = path.resolve(this.configService.storagePath, 'homebridge-deconz.json.gz'); + + // check file exists + if (!await fs.pathExists(dumpPath)) { + throw new NotFoundException(); + } + + // stream file to client + return new StreamableFile(fs.createReadStream(dumpPath)); + } +} diff --git a/test/e2e/custom-plugins.e2e-spec.ts b/test/e2e/custom-plugins.e2e-spec.ts index 58e7ff524..fef952db1 100644 --- a/test/e2e/custom-plugins.e2e-spec.ts +++ b/test/e2e/custom-plugins.e2e-spec.ts @@ -94,6 +94,34 @@ describe('CustomPluginsController (e2e)', () => { expect(res.statusCode).toBe(404); }); + it('GET /plugins/custom-plugins/homebridge-deconz/dump-file (dump file exists)', async () => { + await fs.writeJson(path.resolve(process.env.UIX_STORAGE_PATH, 'homebridge-deconz.json.gz'), {}); + + const res = await app.inject({ + method: 'GET', + path: '/plugins/custom-plugins/homebridge-deconz/dump-file', + headers: { + authorization, + }, + }); + + expect(res.statusCode).toBe(200); + }); + + it('GET /plugins/custom-plugins/homebridge-deconz/dump-file (dump file missing)', async () => { + await fs.remove(path.resolve(process.env.UIX_STORAGE_PATH, 'homebridge-deconz.json.gz')); + + const res = await app.inject({ + method: 'GET', + path: '/plugins/custom-plugins/homebridge-deconz/dump-file', + headers: { + authorization, + }, + }); + + expect(res.statusCode).toBe(404); + }); + afterAll(async () => { await app.close(); }); diff --git a/ui/package-lock.json b/ui/package-lock.json index d5ab90221..ace00726c 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -18,7 +18,7 @@ "@angular/platform-browser": "14.3.0", "@angular/platform-browser-dynamic": "14.3.0", "@angular/router": "14.3.0", - "@auth0/angular-jwt": "5.1.2", + "@auth0/angular-jwt": "5.2.0", "@homebridge/plugin-ui-utils": "1.0.0", "@ng-bootstrap/ng-bootstrap": "11.0.1", "@ngx-translate/core": "14.0.0", @@ -74,7 +74,7 @@ "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "codelyzer": "^6.0.2", - "eslint": "^8.52.0", + "eslint": "^8.53.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsdoc": "^39.9.1", "eslint-plugin-prefer-arrow": "^1.2.3", @@ -756,14 +756,14 @@ "dev": true }, "node_modules/@auth0/angular-jwt": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@auth0/angular-jwt/-/angular-jwt-5.1.2.tgz", - "integrity": "sha512-8ulz24cPpEkZb9/AdAaWfYIkomQDbZqvB9LproF/48Klnr30EJx09AYF9sbKTN4qLSgIZSlCb/Y7XQJZ51vSzA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@auth0/angular-jwt/-/angular-jwt-5.2.0.tgz", + "integrity": "sha512-9FS2L0QwGNlxA/zgeehCcsR9CZscouyXkoIj1fODM36A8BLfdzg9k9DWAXUQ2Drjk0AypGAFzeNZR4vsLMhdeQ==", "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { - "@angular/common": ">=12.0.0" + "@angular/common": ">=14.0.0" } }, "node_modules/@babel/code-frame": { @@ -2947,9 +2947,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -3037,9 +3037,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz", + "integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -5319,9 +5319,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001559", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", - "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", + "version": "1.0.30001561", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz", + "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==", "funding": [ { "type": "opencollective", @@ -6196,9 +6196,9 @@ } }, "node_modules/cssdb": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-7.8.0.tgz", - "integrity": "sha512-SkeezZOQr5AHt9MgJgSFNyiuJwg1p8AwoVln6JwaQJsyxduRW9QJ+HP/gAQzbsz8SIqINtYvpJKjxTRI67zxLg==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-7.9.0.tgz", + "integrity": "sha512-WPMT9seTQq6fPAa1yN4zjgZZeoTriSN2LqW9C+otjar12DQIWA4LuSfFrvFJiKp4oD0xIk1vumDLw8K9ur4NBw==", "dev": true, "funding": [ { @@ -6537,9 +6537,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.571", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.571.tgz", - "integrity": "sha512-Sc+VtKwKCDj3f/kLBjdyjMpNzoZsU6WuL/wFb6EH8USmHEcebxRXcRrVpOpayxd52tuey4RUDpUsw5OS5LhJqg==" + "version": "1.4.576", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.576.tgz", + "integrity": "sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA==" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -7205,15 +7205,15 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.53.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz", + "integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.53.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -13965,9 +13965,9 @@ } }, "node_modules/terser-webpack-plugin/node_modules/terser": { - "version": "5.23.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.23.0.tgz", - "integrity": "sha512-Iyy83LN0uX9ZZLCX4Qbu5JiHiWjOCTwrmM9InWOzVeM++KNWEsqV4YgN9U9E8AlohQ6Gs42ztczlWOG/lwDAMA==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/ui/package.json b/ui/package.json index c9cc3ac20..29d7edad3 100644 --- a/ui/package.json +++ b/ui/package.json @@ -20,7 +20,7 @@ "@angular/platform-browser": "14.3.0", "@angular/platform-browser-dynamic": "14.3.0", "@angular/router": "14.3.0", - "@auth0/angular-jwt": "5.1.2", + "@auth0/angular-jwt": "5.2.0", "@homebridge/plugin-ui-utils": "1.0.0", "@ng-bootstrap/ng-bootstrap": "11.0.1", "@ngx-translate/core": "14.0.0", @@ -76,7 +76,7 @@ "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "codelyzer": "^6.0.2", - "eslint": "^8.52.0", + "eslint": "^8.53.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsdoc": "^39.9.1", "eslint-plugin-prefer-arrow": "^1.2.3", diff --git a/ui/src/app/core/manage-plugins/custom-plugins/custom-plugins.module.ts b/ui/src/app/core/manage-plugins/custom-plugins/custom-plugins.module.ts index 53adb2390..ffae1b0c3 100644 --- a/ui/src/app/core/manage-plugins/custom-plugins/custom-plugins.module.ts +++ b/ui/src/app/core/manage-plugins/custom-plugins/custom-plugins.module.ts @@ -11,11 +11,13 @@ import { CustomPluginsService } from './custom-plugins.service'; import { CustomPluginsComponent } from './custom-plugins.component'; import { HomebridgeGoogleSmarthomeComponent } from './homebridge-google-smarthome/homebridge-google-smarthome.component'; +import { HomebridgeDeconzComponent } from './homebridge-deconz/homebridge-deconz.component'; import { HomebridgeHueComponent } from './homebridge-hue/homebridge-hue.component'; @NgModule({ declarations: [ CustomPluginsComponent, + HomebridgeDeconzComponent, HomebridgeGoogleSmarthomeComponent, HomebridgeHueComponent, ], @@ -33,6 +35,7 @@ import { HomebridgeHueComponent } from './homebridge-hue/homebridge-hue.componen CustomPluginsService, ], exports: [ + HomebridgeDeconzComponent, HomebridgeHueComponent, ], }) diff --git a/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.html b/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.html new file mode 100644 index 000000000..09dcd0088 --- /dev/null +++ b/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.scss b/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.ts b/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.ts new file mode 100644 index 000000000..6b052c35d --- /dev/null +++ b/ui/src/app/core/manage-plugins/custom-plugins/homebridge-deconz/homebridge-deconz.component.ts @@ -0,0 +1,33 @@ +import { Component } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { ToastrService } from 'ngx-toastr'; +import { saveAs } from 'file-saver'; + +import { ApiService } from '@/app/core/api.service'; + +@Component({ + selector: 'app-homebridge-deconz', + templateUrl: './homebridge-deconz.component.html', + styleUrls: ['./homebridge-deconz.component.scss'], +}) +export class HomebridgeDeconzComponent { + + constructor( + private translate: TranslateService, + public $toastr: ToastrService, + private $api: ApiService, + ) { } + + downloadDumpFile() { + this.$api.get('/plugins/custom-plugins/homebridge-deconz/dump-file', { observe: 'response', responseType: 'blob' }) + .subscribe( + (res) => { + saveAs(res.body, 'homebridge-deconz.json.gz'); + }, + (err) => { + this.$toastr.error('Homebridge Deconz dump file does not exist yet.', this.translate.instant('toast.title_error')); + }, + ); + } + +} diff --git a/ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.html b/ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.html index d7d40c37c..f6bd6e134 100644 --- a/ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.html +++ b/ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.html @@ -46,6 +46,7 @@
{{ block.name }}
+
@@ -84,4 +85,4 @@
{{ block.name }}
- \ No newline at end of file +