fix: add missing script parameter (#521)

This commit is contained in:
Martin Toledo Do Pazo
2026-03-29 09:49:52 +02:00
committed by GitHub
parent 4da8840d78
commit 7d1169a5ee
4 changed files with 7 additions and 4 deletions

View File

@@ -41,6 +41,7 @@ function pbToScript(pb: PBScript): Script {
script: m.script, script: m.script,
resources: m.resources, resources: m.resources,
config_path: m.config_path, config_path: m.config_path,
script: scriptDownloaderService.deriveScriptPath(pb.type, m.type, pb.slug) ?? undefined,
})), })),
default_credentials: { default_credentials: {
username: pb.default_user, username: pb.default_user,

View File

@@ -392,6 +392,7 @@ export class AutoSyncService {
type: m.type, type: m.type,
resources: m.resources, resources: m.resources,
config_path: m.config_path, config_path: m.config_path,
script: sds.deriveScriptPath(pb.type, m.type, pb.slug) ?? undefined,
})), })),
default_credentials: { username: pb.default_user, password: pb.default_passwd }, default_credentials: { username: pb.default_user, password: pb.default_passwd },
notes: pb.notes_json, notes: pb.notes_json,

View File

@@ -1,6 +1,7 @@
import { readFile, readdir, writeFile, mkdir } from 'fs/promises'; import { readFile, readdir, writeFile, mkdir } from 'fs/promises';
import { join } from 'path'; import { join } from 'path';
import type { Script, ScriptCard } from '~/types/script'; import type { Script, ScriptCard } from '~/types/script';
import { scriptDownloaderService } from './scriptDownloader.js';
export class LocalScriptsService { export class LocalScriptsService {
private scriptsDirectory: string; private scriptsDirectory: string;
@@ -58,6 +59,7 @@ export class LocalScriptsService {
type: m.type, type: m.type,
resources: m.resources, resources: m.resources,
config_path: m.config_path, config_path: m.config_path,
script: scriptDownloaderService.deriveScriptPath(pb.type, m.type, pb.slug) ?? undefined,
})), })),
notes: pb.notes_json.map(n => ({ text: n.text, type: n.type })), notes: pb.notes_json.map(n => ({ text: n.text, type: n.type })),
})); }));
@@ -135,6 +137,7 @@ export class LocalScriptsService {
type: m.type, type: m.type,
resources: m.resources, resources: m.resources,
config_path: m.config_path, config_path: m.config_path,
script: scriptDownloaderService.deriveScriptPath(pb.type, m.type, pb.slug) ?? undefined,
})), })),
notes: pb.notes_json.map(n => ({ text: n.text, type: n.type })), notes: pb.notes_json.map(n => ({ text: n.text, type: n.type })),
}; };

View File

@@ -12,10 +12,8 @@ export interface ScriptInstallMethod {
resources: ScriptResources; resources: ScriptResources;
config_path?: string; config_path?: string;
/** /**
* Optional install script file path (e.g. "ct/adguard.sh"). * Install script file path (e.g. "ct/adguard.sh").
* Present in user-defined local JSON scripts. * For PocketBase-sourced scripts, this is derived by the backend.
* For PocketBase-sourced scripts this field is absent; the downloader derives
* the path from the script type and slug via `deriveScriptPath()`.
*/ */
script?: string; script?: string;
} }