mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
diagnostics: url tests
This commit is contained in:
4
plugins/diagnostics/package-lock.json
generated
4
plugins/diagnostics/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user