From 6f9cd2d21acc3bf2374a69ef28594813bb095444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=B0=8F=E9=99=8C?= Date: Sun, 13 Oct 2024 16:34:07 +0800 Subject: [PATCH] 111 --- index.js | 4 ++++ index.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 9f85757..1756b7a 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,10 @@ let apiEndpoint = 'https://oss.x-php.com/alist/link'; // 解析命令行参数 args.forEach(arg => { + // 去掉-- + if (arg.startsWith('--')) { + arg = arg.substring(2); + } const [key, value] = arg.split('='); if (key === 'port') { port = parseInt(value, 10); diff --git a/index.sh b/index.sh index d2d7272..58ad116 100644 --- a/index.sh +++ b/index.sh @@ -40,7 +40,7 @@ curl -o $FILE https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.js if [ $? -eq 0 ]; then echo "下载完成,正在执行 $FILE..." - node $FILE port=$PORT # 传递端口作为参数 + node $FILE --port=$PORT # 使用 --port=6001 传递参数 else echo "下载失败" -fi \ No newline at end of file +fi