From 294d52303980f0fbe437ef092552e9f2d6a3f80e Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 19 Jan 2025 13:27:15 +0800 Subject: [PATCH] feat: update wget.ts --- script-meta-v2.json | 4 ++-- single-scripts/wget.ts | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index 4e10cb4..45879b2 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -40,8 +40,8 @@ }, "wget.ts": { "script_name": "wget.ts", - "script_length": 3789, - "script_sha256": "a5e72e6a86b2aa7a9f9fbe1e89e62100391b86ce11022e10e803c1816ace2f06", + "script_length": 3909, + "script_sha256": "3f9b61749f9db5d18e2a6ec29cc65f5209ff1c34db0711a4083b07432bebc562", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/wget.ts", "single_script_file": true } diff --git a/single-scripts/wget.ts b/single-scripts/wget.ts index bce7820..4d89eaf 100755 --- a/single-scripts/wget.ts +++ b/single-scripts/wget.ts @@ -51,7 +51,7 @@ function getEnvironmentProxy(): string | undefined { const args = Deno.args; const flags = parseArgs(Deno.args, { - boolean: ["help"], + boolean: ["help", "no-proxy"], string: ["proxy", "output"], }); @@ -62,7 +62,7 @@ if (args.length === 0) { if (flags.help) { console.log(`wget.ts - download file -wget.ts `); +wget.ts [--proxy socks5h://ip:port] [--no-proxy] [--output filename] `); Deno.exit(0); } @@ -102,8 +102,9 @@ const stateFileInterVal = setInterval(async () => { const outputFileWritable = Deno.createSync(outputFilename).writable; let init = undefined; +const noProxy = flags["no-proxy"]; const proxy = flags.proxy || getEnvironmentProxy(); -if (proxy) { +if (proxy && !noProxy) { console.log(`Using proxy: ${proxy}`); init = { client: Deno.createHttpClient({