diff --git a/plugins/diagnostics/package-lock.json b/plugins/diagnostics/package-lock.json index fd98fc148..84044640f 100644 --- a/plugins/diagnostics/package-lock.json +++ b/plugins/diagnostics/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/diagnostics", - "version": "0.0.24", + "version": "0.0.25", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/diagnostics", - "version": "0.0.24", + "version": "0.0.25", "dependencies": { "@scrypted/common": "file:../../common", "@scrypted/sdk": "file:../../sdk", diff --git a/plugins/diagnostics/package.json b/plugins/diagnostics/package.json index e6ee3d1e4..b431ef95a 100644 --- a/plugins/diagnostics/package.json +++ b/plugins/diagnostics/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/diagnostics", - "version": "0.0.24", + "version": "0.0.25", "scripts": { "scrypted-setup-project": "scrypted-setup-project", "prescrypted-setup-project": "scrypted-package-json", diff --git a/plugins/diagnostics/src/main.ts b/plugins/diagnostics/src/main.ts index d233b65fc..5ad42ce78 100644 --- a/plugins/diagnostics/src/main.ts +++ b/plugins/diagnostics/src/main.ts @@ -12,6 +12,14 @@ import sharp from 'sharp'; import { httpFetch } from '../../../server/src/fetch/http-fetch'; class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings { storageSettings = new StorageSettings(this, { + validateSystem: { + console: true, + group: 'System', + title: 'Validate System', + description: 'Validate the system configuration.', + type: 'button', + onPut: () => this.validateSystem(), + }, testDevice: { group: 'Device', title: 'Validation Device', @@ -30,14 +38,6 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings { this.validateDevice(); }, }, - validateSystem: { - console: true, - group: 'System', - title: 'Validate System', - description: 'Validate the system configuration.', - type: 'button', - onPut: () => this.validateSystem(), - }, }); loggedMotion = new Map(); @@ -531,6 +531,29 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings { }); } + await this.validate(this.console, 'External Resource Access', async () => { + const urls = [ + 'https://huggingface.co/koushd/clip/resolve/main/requirements.txt', + 'https://raw.githubusercontent.com/koush/openvino-models/refs/heads/main/scrypted_labels.txt', + 'https://registry.npmjs.org/@scrypted/server' + ]; + + for (const url of urls) { + try { + const response = await httpFetch({ + url, + timeout: 5000, + }); + + if (response.statusCode >= 400) { + throw new Error(`${url} returned status ${response.statusCode}`); + } + } catch (error) { + throw new Error(`${url} is not accessible: ${(error as Error).message}`); + } + } + }); + if (nvrPlugin) { await this.validate(this.console, "GPU Decode", async () => { const ffmpegPath = await sdk.mediaManager.getFFmpegPath();