This commit is contained in:
2026-02-05 00:24:29 +08:00
parent e098e5926d
commit cfcd919cd1
3 changed files with 19 additions and 6 deletions

View File

@@ -91,12 +91,22 @@ async function checkServerStarted(
return false;
}
function isFile(url: URL | string): boolean {
url = url instanceof URL ? url : new URL(url);
return url.protocol === "file:";
}
async function loadServerControlConfig(
metaUrl: string,
serverControlConfigFile?: string,
): Promise<ServerControlConfig> {
const fullServerControlConfigFile = serverControlConfigFile ||
let fullServerControlConfigFile: string;
if (!isFile(metaUrl)) {
fullServerControlConfigFile = "server-control.json";
} else {
fullServerControlConfigFile = serverControlConfigFile ||
(fromFileUrl(metaUrl).replace(".ts", ".json"));
}
log.debug(
`Read server control config file: ${fullServerControlConfigFile}`,
);

View File

@@ -203,12 +203,12 @@
},
"server-control.ts": {
"script_name": "server-control.ts",
"script_length": 632,
"script_sha256": "cde3ab0bde23fd0a40455c86bcf4fcac8157b5747e4ea111b411330be6a647e4",
"script_length": 809,
"script_sha256": "c50eb15fc59847493dd03e2bba585747368b7236d2cc35315187d803d872b578",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/server-control.ts",
"single_script_file": true,
"publish_time": 1770051525256,
"update_time": 1770051525256
"update_time": 1770222264333
},
"sigstore-verify.ts": {
"script_name": "sigstore-verify.ts",

View File

@@ -7,8 +7,11 @@
// https://play.hatter.me/doc/showDocDetail.jssp?id=8882
// deno-1.6.0 run --allow-all server-control.ts ??
// or
// deno-1.6.0 run --allow-all https://global.hatter.ink/script/get/@2/server-control.ts ??
// deno-1.6.0 run --allow-all https://script.hatter.ink/@2/server-control.ts ??
import {log} from "https://global.hatter.ink/script/get/@1/deno-commons-1.6.0-mod.ts";
import {serverControlMain} from "https://global.hatter.ink/script/get/@3/deno-server-control-1.6.0-mod.ts";
import {serverControlMain} from "https://global.hatter.ink/script/get/@5/deno-server-control-1.6.0-mod.ts";
serverControlMain(import.meta.url).catch((e) => log.error(e));