feat: 脚本链接的末尾加上 #noCache 关闭缓存

This commit is contained in:
xream 2023-11-14 21:14:47 +08:00
parent 3e30a35bc4
commit f3de132d70
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.89",
"version": "2.14.90",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -71,7 +71,12 @@ async function process(proxies, operators = [], targetPlatform, source) {
if (item.type.indexOf('Script') !== -1) {
const { mode, content } = item.args;
if (mode === 'link') {
const url = content;
let noCache;
let url = content;
if (url.endsWith('#noCache')) {
url = url.replace(/#noCache$/, '');
noCache = true;
}
// extract link arguments
const rawArgs = url.split('#');
if (rawArgs.length > 1) {
@ -93,7 +98,9 @@ async function process(proxies, operators = [], targetPlatform, source) {
// if this is a remote script, download it
try {
script = await download(url.split('#')[0]);
script = await download(
`${url.split('#')[0]}${noCache ? '#noCache' : ''}`,
);
// $.info(`Script loaded: >>>\n ${script}`);
} catch (err) {
$.error(