mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 21:15:13 +08:00
🌈 Sync 2026-07-29 14:47:30
This commit is contained in:
1 parent
ca80299bab
commit
fc21fd8c5e
48 files changed
+13901
-3399
No files matched your search
Regular → Executable
+22
-3
@@ -66,15 +66,34 @@ export function getTime(epoch) {
|
||||
|
||||
};
|
||||
|
||||
export function wGET(url, ua) {
|
||||
export function wGETResponse(url, ua) {
|
||||
if (!url || type(url) !== 'string')
|
||||
return null;
|
||||
|
||||
if (!ua)
|
||||
ua = 'Wget/1.21 (HomeProxy, like v2rayN)';
|
||||
|
||||
const output = executeCommand(`/usr/bin/wget -qO- --user-agent ${shellQuote(ua)} --timeout=10 ${shellQuote(url)}`) || {};
|
||||
return trim(output.stdout);
|
||||
const output = executeCommand(`/usr/bin/wget -O- -S --user-agent ${shellQuote(ua)} --timeout=10 ${shellQuote(url)}`) || {};
|
||||
return {
|
||||
body: trim(output.stdout),
|
||||
headers: output.stderr || '',
|
||||
exitcode: output.exitcode
|
||||
};
|
||||
};
|
||||
|
||||
export function wGET(url, ua) {
|
||||
return wGETResponse(url, ua)?.body;
|
||||
};
|
||||
|
||||
export function wGETHeaders(url, ua) {
|
||||
if (!url || type(url) !== 'string')
|
||||
return null;
|
||||
|
||||
if (!ua)
|
||||
ua = 'clash.meta';
|
||||
|
||||
const output = executeCommand(`/usr/bin/wget -O /dev/null -S --user-agent ${shellQuote(ua)} --timeout=10 ${shellQuote(url)}`) || {};
|
||||
return output.stderr || '';
|
||||
};
|
||||
/* Utilities end */
|
||||
|
||||
|
||||
Reference in new issue
Block a user