diagnostics: url tests

This commit is contained in:
Koushik Dutta
2025-12-13 10:05:51 -08:00
parent 61cf589800
commit 2818120b68
3 changed files with 34 additions and 11 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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<string, number>();
@@ -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();