mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d41eb467f | ||
|
|
ba1c91a7a5 | ||
|
|
30fa87c172 | ||
|
|
1eaa33948b | ||
|
|
619e256ed8 | ||
|
|
b46209e164 | ||
|
|
a1ba4e273e | ||
|
|
bfc95ed92a | ||
|
|
32f591ec56 | ||
|
|
cea16d8c44 | ||
|
|
93a1ba7b50 | ||
|
|
e6d1aa1150 | ||
|
|
26e83798da | ||
|
|
b083d2d840 | ||
|
|
cf35afcab2 | ||
|
|
d073dfeef8 | ||
|
|
f970ea3361 | ||
|
|
630bac0575 | ||
|
|
7f3cb2b191 | ||
|
|
92e1e4a0fb |
@@ -11,7 +11,7 @@ Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/sub-store-org/Sub-Store/actions/workflows/main.yml)     
|
[](https://github.com/sub-store-org/Sub-Store/actions/workflows/main.yml)     
|
||||||
|
<a href="https://trendshift.io/repositories/4572" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4572" alt="sub-store-org%2FSub-Store | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
[](https://www.buymeacoffee.com/PengYM)
|
[](https://www.buymeacoffee.com/PengYM)
|
||||||
|
|
||||||
Core functionalities:
|
Core functionalities:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.304",
|
"version": "2.14.313",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"author": "Peng-YM",
|
"author": "Peng-YM",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@maxmind/geoip2-node": "^5.0.0",
|
||||||
"automerge": "1.0.1-preview.7",
|
"automerge": "1.0.1-preview.7",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"connect-history-api-fallback": "^2.0.0",
|
"connect-history-api-fallback": "^2.0.0",
|
||||||
|
|||||||
63
backend/pnpm-lock.yaml
generated
63
backend/pnpm-lock.yaml
generated
@@ -5,6 +5,9 @@ settings:
|
|||||||
excludeLinksFromLockfile: false
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@maxmind/geoip2-node':
|
||||||
|
specifier: ^5.0.0
|
||||||
|
version: registry.npmmirror.com/@maxmind/geoip2-node@5.0.0
|
||||||
automerge:
|
automerge:
|
||||||
specifier: 1.0.1-preview.7
|
specifier: 1.0.1-preview.7
|
||||||
version: registry.npmmirror.com/automerge@1.0.1-preview.7
|
version: registry.npmmirror.com/automerge@1.0.1-preview.7
|
||||||
@@ -1967,6 +1970,15 @@ packages:
|
|||||||
'@jridgewell/sourcemap-codec': registry.npmmirror.com/@jridgewell/sourcemap-codec@1.4.13
|
'@jridgewell/sourcemap-codec': registry.npmmirror.com/@jridgewell/sourcemap-codec@1.4.13
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
registry.npmmirror.com/@maxmind/geoip2-node@5.0.0:
|
||||||
|
resolution: {integrity: sha512-ki+q5//oU4tZ3BAhegZJcB5czoZyic5JSTEKbrUAQB/BzAoAiGyLW0immEmQvVVyy2SMlvBTJ3zqyRj8K9BbwQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@maxmind/geoip2-node/-/geoip2-node-5.0.0.tgz}
|
||||||
|
name: '@maxmind/geoip2-node'
|
||||||
|
version: 5.0.0
|
||||||
|
dependencies:
|
||||||
|
ip6addr: registry.npmmirror.com/ip6addr@0.2.5
|
||||||
|
maxmind: registry.npmmirror.com/maxmind@4.3.19
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/@sindresorhus/is@0.14.0:
|
registry.npmmirror.com/@sindresorhus/is@0.14.0:
|
||||||
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@sindresorhus/is/-/is-0.14.0.tgz}
|
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@sindresorhus/is/-/is-0.14.0.tgz}
|
||||||
name: '@sindresorhus/is'
|
name: '@sindresorhus/is'
|
||||||
@@ -5988,6 +6000,15 @@ packages:
|
|||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
registry.npmmirror.com/ip6addr@0.2.5:
|
||||||
|
resolution: {integrity: sha512-9RGGSB6Zc9Ox5DpDGFnJdIeF0AsqXzdH+FspCfPPaU/L/4tI6P+5lIoFUFm9JXs9IrJv1boqAaNCQmoDADTSKQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/ip6addr/-/ip6addr-0.2.5.tgz}
|
||||||
|
name: ip6addr
|
||||||
|
version: 0.2.5
|
||||||
|
dependencies:
|
||||||
|
assert-plus: registry.npmmirror.com/assert-plus@1.0.0
|
||||||
|
jsprim: registry.npmmirror.com/jsprim@2.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/ipaddr.js@1.9.1:
|
registry.npmmirror.com/ipaddr.js@1.9.1:
|
||||||
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz}
|
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz}
|
||||||
name: ipaddr.js
|
name: ipaddr.js
|
||||||
@@ -6556,6 +6577,12 @@ packages:
|
|||||||
version: 0.2.3
|
version: 0.2.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
registry.npmmirror.com/json-schema@0.4.0:
|
||||||
|
resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/json-schema/-/json-schema-0.4.0.tgz}
|
||||||
|
name: json-schema
|
||||||
|
version: 0.4.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/json-stable-stringify-without-jsonify@1.0.1:
|
registry.npmmirror.com/json-stable-stringify-without-jsonify@1.0.1:
|
||||||
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz}
|
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz}
|
||||||
name: json-stable-stringify-without-jsonify
|
name: json-stable-stringify-without-jsonify
|
||||||
@@ -6595,6 +6622,18 @@ packages:
|
|||||||
verror: registry.npmmirror.com/verror@1.10.0
|
verror: registry.npmmirror.com/verror@1.10.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
registry.npmmirror.com/jsprim@2.0.2:
|
||||||
|
resolution: {integrity: sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/jsprim/-/jsprim-2.0.2.tgz}
|
||||||
|
name: jsprim
|
||||||
|
version: 2.0.2
|
||||||
|
engines: {'0': node >=0.6.0}
|
||||||
|
dependencies:
|
||||||
|
assert-plus: registry.npmmirror.com/assert-plus@1.0.0
|
||||||
|
extsprintf: registry.npmmirror.com/extsprintf@1.3.0
|
||||||
|
json-schema: registry.npmmirror.com/json-schema@0.4.0
|
||||||
|
verror: registry.npmmirror.com/verror@1.10.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/just-debounce@1.1.0:
|
registry.npmmirror.com/just-debounce@1.1.0:
|
||||||
resolution: {integrity: sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/just-debounce/-/just-debounce-1.1.0.tgz}
|
resolution: {integrity: sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/just-debounce/-/just-debounce-1.1.0.tgz}
|
||||||
name: just-debounce
|
name: just-debounce
|
||||||
@@ -6943,6 +6982,16 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
registry.npmmirror.com/maxmind@4.3.19:
|
||||||
|
resolution: {integrity: sha512-Bu/VEN7ZWAOCjifdZaXJQuN6/yO7+OK35pnJsqmz8sOndK3KQFvJoY+6HX09/MmLLqtCfa+sMK0iaQOaTejGNA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/maxmind/-/maxmind-4.3.19.tgz}
|
||||||
|
name: maxmind
|
||||||
|
version: 4.3.19
|
||||||
|
engines: {node: '>=12', npm: '>=6'}
|
||||||
|
dependencies:
|
||||||
|
mmdb-lib: registry.npmmirror.com/mmdb-lib@2.1.0
|
||||||
|
tiny-lru: registry.npmmirror.com/tiny-lru@11.2.6
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/md5.js@1.3.5:
|
registry.npmmirror.com/md5.js@1.3.5:
|
||||||
resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/md5.js/-/md5.js-1.3.5.tgz}
|
resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/md5.js/-/md5.js-1.3.5.tgz}
|
||||||
name: md5.js
|
name: md5.js
|
||||||
@@ -7132,6 +7181,13 @@ packages:
|
|||||||
version: 0.5.3
|
version: 0.5.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
registry.npmmirror.com/mmdb-lib@2.1.0:
|
||||||
|
resolution: {integrity: sha512-tdDTZmnI5G4UoSctv2KxM/3VQt2XRj4CmR5R4VsAWsOUcS3LysHR34wtixWm/pXxXdkBDuN92auxkC0T2+qd1Q==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/mmdb-lib/-/mmdb-lib-2.1.0.tgz}
|
||||||
|
name: mmdb-lib
|
||||||
|
version: 2.1.0
|
||||||
|
engines: {node: '>=10', npm: '>=6'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/mocha@10.0.0:
|
registry.npmmirror.com/mocha@10.0.0:
|
||||||
resolution: {integrity: sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/mocha/-/mocha-10.0.0.tgz}
|
resolution: {integrity: sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/mocha/-/mocha-10.0.0.tgz}
|
||||||
name: mocha
|
name: mocha
|
||||||
@@ -9424,6 +9480,13 @@ packages:
|
|||||||
process: registry.npmmirror.com/process@0.11.10
|
process: registry.npmmirror.com/process@0.11.10
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
registry.npmmirror.com/tiny-lru@11.2.6:
|
||||||
|
resolution: {integrity: sha512-0PU3c9PjMnltZaFo2sGYv/nnJsMjG0Cxx8X6FXHPPGjFyoo1SJDxvUXW1207rdiSxYizf31roo+GrkIByQeZoA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/tiny-lru/-/tiny-lru-11.2.6.tgz}
|
||||||
|
name: tiny-lru
|
||||||
|
version: 11.2.6
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
registry.npmmirror.com/tinyify@3.0.0:
|
registry.npmmirror.com/tinyify@3.0.0:
|
||||||
resolution: {integrity: sha512-RtjVjC1xwwxt8AMVfxEmo+FzRJB6p5sAOtFaJj8vMrkWShtArsM4dLVRWhx2Vc07Me3NWgmP7pi9UPm/a2XNNA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/tinyify/-/tinyify-3.0.0.tgz}
|
resolution: {integrity: sha512-RtjVjC1xwwxt8AMVfxEmo+FzRJB6p5sAOtFaJj8vMrkWShtArsM4dLVRWhx2Vc07Me3NWgmP7pi9UPm/a2XNNA==, registry: http://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/tinyify/-/tinyify-3.0.0.tgz}
|
||||||
name: tinyify
|
name: tinyify
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ import $ from '@/core/app';
|
|||||||
import { FILES_KEY, MODULES_KEY } from '@/constants';
|
import { FILES_KEY, MODULES_KEY } from '@/constants';
|
||||||
import { findByName } from '@/utils/database';
|
import { findByName } from '@/utils/database';
|
||||||
import { produceArtifact } from '@/restful/sync';
|
import { produceArtifact } from '@/restful/sync';
|
||||||
import { getFlag, getISO } from '@/utils/geo';
|
import { getFlag, getISO, MMDB } from '@/utils/geo';
|
||||||
|
import Gist from '@/utils/gist';
|
||||||
|
|
||||||
function preprocess(raw) {
|
function preprocess(raw) {
|
||||||
for (const processor of PROXY_PREPROCESSORS) {
|
for (const processor of PROXY_PREPROCESSORS) {
|
||||||
@@ -272,6 +273,8 @@ export const ProxyUtils = {
|
|||||||
yaml: YAML,
|
yaml: YAML,
|
||||||
getFlag,
|
getFlag,
|
||||||
getISO,
|
getISO,
|
||||||
|
MMDB,
|
||||||
|
Gist,
|
||||||
};
|
};
|
||||||
|
|
||||||
function tryParse(parser, line) {
|
function tryParse(parser, line) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { Base64 } from 'js-base64';
|
|||||||
// Parse SS URI format (only supports new SIP002, legacy format is depreciated).
|
// Parse SS URI format (only supports new SIP002, legacy format is depreciated).
|
||||||
// reference: https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme
|
// reference: https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme
|
||||||
function URI_SS() {
|
function URI_SS() {
|
||||||
|
// TODO: 暂不支持 httpupgrade
|
||||||
const name = 'URI SS Parser';
|
const name = 'URI SS Parser';
|
||||||
const test = (line) => {
|
const test = (line) => {
|
||||||
return /^ss:\/\//.test(line);
|
return /^ss:\/\//.test(line);
|
||||||
@@ -299,6 +300,7 @@ function URI_VMess() {
|
|||||||
if (proxy.tls && proxy.sni) {
|
if (proxy.tls && proxy.sni) {
|
||||||
proxy.sni = params.sni;
|
proxy.sni = params.sni;
|
||||||
}
|
}
|
||||||
|
let httpupgrade = false;
|
||||||
// handle obfs
|
// handle obfs
|
||||||
if (params.net === 'ws' || params.obfs === 'websocket') {
|
if (params.net === 'ws' || params.obfs === 'websocket') {
|
||||||
proxy.network = 'ws';
|
proxy.network = 'ws';
|
||||||
@@ -309,6 +311,12 @@ function URI_VMess() {
|
|||||||
proxy.network = 'http';
|
proxy.network = 'http';
|
||||||
} else if (['grpc'].includes(params.net)) {
|
} else if (['grpc'].includes(params.net)) {
|
||||||
proxy.network = 'grpc';
|
proxy.network = 'grpc';
|
||||||
|
} else if (
|
||||||
|
params.net === 'httpupgrade' ||
|
||||||
|
proxy.network === 'httpupgrade'
|
||||||
|
) {
|
||||||
|
proxy.network = 'ws';
|
||||||
|
httpupgrade = true;
|
||||||
}
|
}
|
||||||
if (proxy.network) {
|
if (proxy.network) {
|
||||||
let transportHost = params.host ?? params.obfsParam;
|
let transportHost = params.host ?? params.obfsParam;
|
||||||
@@ -341,10 +349,15 @@ function URI_VMess() {
|
|||||||
'_grpc-type': getIfNotBlank(params.type),
|
'_grpc-type': getIfNotBlank(params.type),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
proxy[`${proxy.network}-opts`] = {
|
const opts = {
|
||||||
path: getIfNotBlank(transportPath),
|
path: getIfNotBlank(transportPath),
|
||||||
headers: { Host: getIfNotBlank(transportHost) },
|
headers: { Host: getIfNotBlank(transportHost) },
|
||||||
};
|
};
|
||||||
|
if (httpupgrade) {
|
||||||
|
opts['v2ray-http-upgrade'] = true;
|
||||||
|
opts['v2ray-http-upgrade-fast-open'] = true;
|
||||||
|
}
|
||||||
|
proxy[`${proxy.network}-opts`] = opts;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete proxy.network;
|
delete proxy.network;
|
||||||
@@ -444,10 +457,13 @@ function URI_VLESS() {
|
|||||||
proxy[`${params.security}-opts`] = opts;
|
proxy[`${params.security}-opts`] = opts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let httpupgrade = false;
|
||||||
proxy.network = params.type;
|
proxy.network = params.type;
|
||||||
if (proxy.network === 'tcp' && params.headerType === 'http') {
|
if (proxy.network === 'tcp' && params.headerType === 'http') {
|
||||||
proxy.network = 'http';
|
proxy.network = 'http';
|
||||||
|
} else if (proxy.network === 'httpupgrade') {
|
||||||
|
proxy.network = 'ws';
|
||||||
|
httpupgrade = true;
|
||||||
}
|
}
|
||||||
if (!proxy.network && isShadowrocket && params.obfs) {
|
if (!proxy.network && isShadowrocket && params.obfs) {
|
||||||
proxy.network = params.obfs;
|
proxy.network = params.obfs;
|
||||||
@@ -485,6 +501,10 @@ function URI_VLESS() {
|
|||||||
if (['grpc'].includes(proxy.network)) {
|
if (['grpc'].includes(proxy.network)) {
|
||||||
opts['_grpc-type'] = params.mode || 'gun';
|
opts['_grpc-type'] = params.mode || 'gun';
|
||||||
}
|
}
|
||||||
|
if (httpupgrade) {
|
||||||
|
opts['v2ray-http-upgrade'] = true;
|
||||||
|
opts['v2ray-http-upgrade-fast-open'] = true;
|
||||||
|
}
|
||||||
if (Object.keys(opts).length > 0) {
|
if (Object.keys(opts).length > 0) {
|
||||||
proxy[`${proxy.network}-opts`] = opts;
|
proxy[`${proxy.network}-opts`] = opts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,12 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params["type"]) {
|
if (params["type"]) {
|
||||||
|
let httpupgrade
|
||||||
proxy.network = params["type"]
|
proxy.network = params["type"]
|
||||||
|
if(proxy.network === 'httpupgrade') {
|
||||||
|
proxy.network = 'ws'
|
||||||
|
httpupgrade = true
|
||||||
|
}
|
||||||
if (['grpc'].includes(proxy.network)) {
|
if (['grpc'].includes(proxy.network)) {
|
||||||
proxy[proxy.network + '-opts'] = {
|
proxy[proxy.network + '-opts'] = {
|
||||||
'grpc-service-name': params["serviceName"],
|
'grpc-service-name': params["serviceName"],
|
||||||
@@ -102,6 +107,10 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
if (params["host"]) {
|
if (params["host"]) {
|
||||||
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
||||||
}
|
}
|
||||||
|
if (httpupgrade) {
|
||||||
|
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade", true);
|
||||||
|
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,12 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params["type"]) {
|
if (params["type"]) {
|
||||||
|
let httpupgrade
|
||||||
proxy.network = params["type"]
|
proxy.network = params["type"]
|
||||||
|
if(proxy.network === 'httpupgrade') {
|
||||||
|
proxy.network = 'ws'
|
||||||
|
httpupgrade = true
|
||||||
|
}
|
||||||
if (['grpc'].includes(proxy.network)) {
|
if (['grpc'].includes(proxy.network)) {
|
||||||
proxy[proxy.network + '-opts'] = {
|
proxy[proxy.network + '-opts'] = {
|
||||||
'grpc-service-name': params["serviceName"],
|
'grpc-service-name': params["serviceName"],
|
||||||
@@ -100,6 +105,10 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
if (params["host"]) {
|
if (params["host"]) {
|
||||||
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
||||||
}
|
}
|
||||||
|
if (httpupgrade) {
|
||||||
|
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade", true);
|
||||||
|
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ const DOMAIN_RESOLVERS = {
|
|||||||
const cached = resourceCache.get(id);
|
const cached = resourceCache.get(id);
|
||||||
if (!noCache && cached) return cached;
|
if (!noCache && cached) return cached;
|
||||||
const resp = await $.http.get({
|
const resp = await $.http.get({
|
||||||
url: `http://223.6.6.6/resolve?name=${encodeURIComponent(
|
url: `http://223.6.6.6/resolve?edns_client_subnet=223.6.6.6/24&name=${encodeURIComponent(
|
||||||
domain,
|
domain,
|
||||||
)}&type=${type === 'IPv6' ? 'AAAA' : 'A'}&short=1`,
|
)}&type=${type === 'IPv6' ? 'AAAA' : 'A'}&short=1`,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -482,7 +482,7 @@ const DOMAIN_RESOLVERS = {
|
|||||||
const cached = resourceCache.get(id);
|
const cached = resourceCache.get(id);
|
||||||
if (!noCache && cached) return cached;
|
if (!noCache && cached) return cached;
|
||||||
const resp = await $.http.get({
|
const resp = await $.http.get({
|
||||||
url: `http://119.28.28.28/d?type=${
|
url: `http://119.28.28.28/d?ip=119.28.28.28&type=${
|
||||||
type === 'IPv6' ? 'AAAA' : 'A'
|
type === 'IPv6' ? 'AAAA' : 'A'
|
||||||
}&dn=${encodeURIComponent(domain)}`,
|
}&dn=${encodeURIComponent(domain)}`,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function URI_Producer() {
|
|||||||
const userinfo = `${proxy.cipher}:${proxy.password}`;
|
const userinfo = `${proxy.cipher}:${proxy.password}`;
|
||||||
result = `ss://${Base64.encode(userinfo)}@${proxy.server}:${
|
result = `ss://${Base64.encode(userinfo)}@${proxy.server}:${
|
||||||
proxy.port
|
proxy.port
|
||||||
}/`;
|
}${proxy.plugin ? '/' : ''}`;
|
||||||
if (proxy.plugin) {
|
if (proxy.plugin) {
|
||||||
result += '?plugin=';
|
result += '?plugin=';
|
||||||
const opts = proxy['plugin-opts'];
|
const opts = proxy['plugin-opts'];
|
||||||
@@ -55,7 +55,9 @@ export default function URI_Producer() {
|
|||||||
result = `${result}${proxy.plugin ? '&' : '?'}uot=1`;
|
result = `${result}${proxy.plugin ? '&' : '?'}uot=1`;
|
||||||
}
|
}
|
||||||
if (proxy.tfo) {
|
if (proxy.tfo) {
|
||||||
result = `${result}${proxy.plugin ? '&' : '?'}tfo=1`;
|
result = `${result}${
|
||||||
|
proxy.plugin || proxy['udp-over-tcp'] ? '&' : '?'
|
||||||
|
}tfo=1`;
|
||||||
}
|
}
|
||||||
result += `#${encodeURIComponent(proxy.name)}`;
|
result += `#${encodeURIComponent(proxy.name)}`;
|
||||||
break;
|
break;
|
||||||
@@ -82,6 +84,11 @@ export default function URI_Producer() {
|
|||||||
if (proxy.network === 'http') {
|
if (proxy.network === 'http') {
|
||||||
net = 'tcp';
|
net = 'tcp';
|
||||||
type = 'http';
|
type = 'http';
|
||||||
|
} else if (
|
||||||
|
proxy.network === 'ws' &&
|
||||||
|
proxy['ws-opts']?.['v2ray-http-upgrade']
|
||||||
|
) {
|
||||||
|
net = 'httpupgrade';
|
||||||
}
|
}
|
||||||
result = {
|
result = {
|
||||||
v: '2',
|
v: '2',
|
||||||
@@ -170,9 +177,15 @@ export default function URI_Producer() {
|
|||||||
if (proxy.flow) {
|
if (proxy.flow) {
|
||||||
flow = `&flow=${encodeURIComponent(proxy.flow)}`;
|
flow = `&flow=${encodeURIComponent(proxy.flow)}`;
|
||||||
}
|
}
|
||||||
let vlessTransport = `&type=${encodeURIComponent(
|
let vlessType = proxy.network;
|
||||||
proxy.network,
|
if (
|
||||||
)}`;
|
proxy.network === 'ws' &&
|
||||||
|
proxy['ws-opts']?.['v2ray-http-upgrade']
|
||||||
|
) {
|
||||||
|
vlessType = 'httpupgrade';
|
||||||
|
}
|
||||||
|
|
||||||
|
let vlessTransport = `&type=${encodeURIComponent(vlessType)}`;
|
||||||
if (['grpc'].includes(proxy.network)) {
|
if (['grpc'].includes(proxy.network)) {
|
||||||
// https://github.com/XTLS/Xray-core/issues/91
|
// https://github.com/XTLS/Xray-core/issues/91
|
||||||
vlessTransport += `&mode=${encodeURIComponent(
|
vlessTransport += `&mode=${encodeURIComponent(
|
||||||
@@ -218,7 +231,14 @@ export default function URI_Producer() {
|
|||||||
case 'trojan':
|
case 'trojan':
|
||||||
let trojanTransport = '';
|
let trojanTransport = '';
|
||||||
if (proxy.network) {
|
if (proxy.network) {
|
||||||
trojanTransport = `&type=${proxy.network}`;
|
let trojanType = proxy.network;
|
||||||
|
if (
|
||||||
|
proxy.network === 'ws' &&
|
||||||
|
proxy['ws-opts']?.['v2ray-http-upgrade']
|
||||||
|
) {
|
||||||
|
trojanType = 'httpupgrade';
|
||||||
|
}
|
||||||
|
trojanTransport = `&type=${encodeURIComponent(trojanType)}`;
|
||||||
if (['grpc'].includes(proxy.network)) {
|
if (['grpc'].includes(proxy.network)) {
|
||||||
let trojanTransportServiceName =
|
let trojanTransportServiceName =
|
||||||
proxy[`${proxy.network}-opts`]?.[
|
proxy[`${proxy.network}-opts`]?.[
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ import $ from '@/core/app';
|
|||||||
|
|
||||||
const tasks = new Map();
|
const tasks = new Map();
|
||||||
|
|
||||||
export default async function download(rawUrl, ua, timeout, proxy) {
|
export default async function download(
|
||||||
|
rawUrl,
|
||||||
|
ua,
|
||||||
|
timeout,
|
||||||
|
proxy,
|
||||||
|
skipCustomCache,
|
||||||
|
) {
|
||||||
let $arguments = {};
|
let $arguments = {};
|
||||||
let url = rawUrl.replace(/#noFlow$/, '');
|
let url = rawUrl.replace(/#noFlow$/, '');
|
||||||
const rawArgs = url.split('#');
|
const rawArgs = url.split('#');
|
||||||
@@ -39,6 +45,23 @@ export default async function download(rawUrl, ua, timeout, proxy) {
|
|||||||
? `#sub-store-cached-custom-${$arguments?.cacheKey}`
|
? `#sub-store-cached-custom-${$arguments?.cacheKey}`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
if (customCacheKey && !skipCustomCache) {
|
||||||
|
const cached = $.read(customCacheKey);
|
||||||
|
if (cached) {
|
||||||
|
$.info(
|
||||||
|
`乐观缓存: URL ${url}\n本次返回自定义缓存 ${$arguments?.cacheKey}\n并进行请求 尝试更新缓存`,
|
||||||
|
);
|
||||||
|
download(
|
||||||
|
rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/, ''),
|
||||||
|
ua,
|
||||||
|
timeout,
|
||||||
|
proxy,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// const downloadUrlMatch = url.match(/^\/api\/(file|module)\/(.+)/);
|
// const downloadUrlMatch = url.match(/^\/api\/(file|module)\/(.+)/);
|
||||||
// if (downloadUrlMatch) {
|
// if (downloadUrlMatch) {
|
||||||
// let type = downloadUrlMatch?.[1];
|
// let type = downloadUrlMatch?.[1];
|
||||||
@@ -81,7 +104,7 @@ export default async function download(rawUrl, ua, timeout, proxy) {
|
|||||||
|
|
||||||
// try to find in app cache
|
// try to find in app cache
|
||||||
const cached = resourceCache.get(id);
|
const cached = resourceCache.get(id);
|
||||||
if (!$arguments?.noCache && cached) {
|
if (!$arguments?.noCache && cached && !skipCustomCache) {
|
||||||
$.info(`使用缓存: ${url}`);
|
$.info(`使用缓存: ${url}`);
|
||||||
result = cached;
|
result = cached;
|
||||||
} else {
|
} else {
|
||||||
@@ -120,6 +143,9 @@ export default async function download(rawUrl, ua, timeout, proxy) {
|
|||||||
if (shouldCache) {
|
if (shouldCache) {
|
||||||
resourceCache.set(id, body);
|
resourceCache.set(id, body);
|
||||||
if (customCacheKey) {
|
if (customCacheKey) {
|
||||||
|
$.info(
|
||||||
|
`URL ${url}\n写入自定义缓存 ${$arguments?.cacheKey}`,
|
||||||
|
);
|
||||||
$.write(body, customCacheKey);
|
$.write(body, customCacheKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const {
|
|||||||
isShadowRocket,
|
isShadowRocket,
|
||||||
isLanceX,
|
isLanceX,
|
||||||
isEgern,
|
isEgern,
|
||||||
|
isGUIforCores,
|
||||||
} = ENV();
|
} = ENV();
|
||||||
let backend = 'Node';
|
let backend = 'Node';
|
||||||
if (isNode) backend = 'Node';
|
if (isNode) backend = 'Node';
|
||||||
@@ -20,6 +21,7 @@ if (isStash) backend = 'Stash';
|
|||||||
if (isShadowRocket) backend = 'ShadowRocket';
|
if (isShadowRocket) backend = 'ShadowRocket';
|
||||||
if (isEgern) backend = 'Egern';
|
if (isEgern) backend = 'Egern';
|
||||||
if (isLanceX) backend = 'LanceX';
|
if (isLanceX) backend = 'LanceX';
|
||||||
|
if (isGUIforCores) backend = 'GUI.for.Cores';
|
||||||
|
|
||||||
let meta = {};
|
let meta = {};
|
||||||
|
|
||||||
@@ -36,6 +38,10 @@ try {
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
meta.script = $script;
|
meta.script = $script;
|
||||||
}
|
}
|
||||||
|
if (typeof $Plugin !== 'undefined') {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
meta.plugin = $Plugin;
|
||||||
|
}
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
meta.node = {
|
meta.node = {
|
||||||
version: eval('process.version'),
|
version: eval('process.version'),
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import $ from '@/core/app';
|
||||||
|
|
||||||
const ISOFlags = {
|
const ISOFlags = {
|
||||||
'🏳️🌈': ['EXP', 'BAND'],
|
'🏳️🌈': ['EXP', 'BAND'],
|
||||||
'🇸🇱': ['TEST', 'SOS'],
|
'🇸🇱': ['TEST', 'SOS'],
|
||||||
@@ -427,3 +429,31 @@ export function getFlag(name) {
|
|||||||
export function getISO(name) {
|
export function getISO(name) {
|
||||||
return ISOFlags[getFlag(name)]?.[0];
|
return ISOFlags[getFlag(name)]?.[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MMDB {
|
||||||
|
constructor({ country, asn } = {}) {
|
||||||
|
if ($.env.isNode) {
|
||||||
|
const Reader = eval(`require("@maxmind/geoip2-node")`).Reader;
|
||||||
|
const fs = eval("require('fs')");
|
||||||
|
const countryFile =
|
||||||
|
country || eval('process.env.SUB_STORE_MMDB_COUNTRY_PATH');
|
||||||
|
const asnFile = asn || eval('process.env.SUB_STORE_MMDB_ASN_PATH');
|
||||||
|
if (countryFile) {
|
||||||
|
this.countryReader = Reader.openBuffer(
|
||||||
|
fs.readFileSync(countryFile),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (asnFile) {
|
||||||
|
if (!fs.existsSync(asnFile))
|
||||||
|
throw new Error('GeoLite2 ASN MMDB does not exist');
|
||||||
|
this.asnReader = Reader.openBuffer(fs.readFileSync(asnFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
geoip(ip) {
|
||||||
|
return this.countryReader?.country(ip)?.country?.isoCode;
|
||||||
|
}
|
||||||
|
ipaso(ip) {
|
||||||
|
return this.asnReader?.asn(ip)?.autonomousSystemOrganization;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
4
backend/src/vendor/express.js
vendored
4
backend/src/vendor/express.js
vendored
@@ -161,7 +161,7 @@ export default function express({ substore: $, port, host }) {
|
|||||||
|
|
||||||
function Response() {
|
function Response() {
|
||||||
let statusCode = 200;
|
let statusCode = 200;
|
||||||
const { isQX, isLoon, isSurge } = ENV();
|
const { isQX, isLoon, isSurge, isGUIforCores } = ENV();
|
||||||
const headers = DEFAULT_HEADERS;
|
const headers = DEFAULT_HEADERS;
|
||||||
const STATUS_CODE_MAP = {
|
const STATUS_CODE_MAP = {
|
||||||
200: 'HTTP/1.1 200 OK',
|
200: 'HTTP/1.1 200 OK',
|
||||||
@@ -184,7 +184,7 @@ export default function express({ substore: $, port, host }) {
|
|||||||
body,
|
body,
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
if (isQX) {
|
if (isQX || isGUIforCores) {
|
||||||
$done(response);
|
$done(response);
|
||||||
} else if (isLoon || isSurge) {
|
} else if (isLoon || isSurge) {
|
||||||
$done({
|
$done({
|
||||||
|
|||||||
42
backend/src/vendor/open-api.js
vendored
42
backend/src/vendor/open-api.js
vendored
@@ -8,6 +8,7 @@ const isStash =
|
|||||||
const isShadowRocket = 'undefined' !== typeof $rocket;
|
const isShadowRocket = 'undefined' !== typeof $rocket;
|
||||||
const isEgern = 'object' == typeof egern;
|
const isEgern = 'object' == typeof egern;
|
||||||
const isLanceX = 'undefined' != typeof $native;
|
const isLanceX = 'undefined' != typeof $native;
|
||||||
|
const isGUIforCores = typeof $Plugins !== 'undefined';
|
||||||
|
|
||||||
export class OpenAPI {
|
export class OpenAPI {
|
||||||
constructor(name = 'untitled', debug = false) {
|
constructor(name = 'untitled', debug = false) {
|
||||||
@@ -48,7 +49,10 @@ export class OpenAPI {
|
|||||||
this.cache = JSON.parse($prefs.valueForKey(this.name) || '{}');
|
this.cache = JSON.parse($prefs.valueForKey(this.name) || '{}');
|
||||||
if (isLoon || isSurge)
|
if (isLoon || isSurge)
|
||||||
this.cache = JSON.parse($persistentStore.read(this.name) || '{}');
|
this.cache = JSON.parse($persistentStore.read(this.name) || '{}');
|
||||||
|
if (isGUIforCores)
|
||||||
|
this.cache = JSON.parse(
|
||||||
|
$Plugins.SubStoreCache.get(this.name) || '{}',
|
||||||
|
);
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
// create a json for root cache
|
// create a json for root cache
|
||||||
const basePath =
|
const basePath =
|
||||||
@@ -86,6 +90,7 @@ export class OpenAPI {
|
|||||||
const data = JSON.stringify(this.cache, null, 2);
|
const data = JSON.stringify(this.cache, null, 2);
|
||||||
if (isQX) $prefs.setValueForKey(data, this.name);
|
if (isQX) $prefs.setValueForKey(data, this.name);
|
||||||
if (isLoon || isSurge) $persistentStore.write(data, this.name);
|
if (isLoon || isSurge) $persistentStore.write(data, this.name);
|
||||||
|
if (isGUIforCores) $Plugins.SubStoreCache.set(this.name, data);
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
const basePath =
|
const basePath =
|
||||||
eval('process.env.SUB_STORE_DATA_BASE_PATH') || '.';
|
eval('process.env.SUB_STORE_DATA_BASE_PATH') || '.';
|
||||||
@@ -118,6 +123,9 @@ export class OpenAPI {
|
|||||||
if (isNode) {
|
if (isNode) {
|
||||||
this.root[key] = data;
|
this.root[key] = data;
|
||||||
}
|
}
|
||||||
|
if (isGUIforCores) {
|
||||||
|
return $Plugins.SubStoreCache.set(key, data);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.cache[key] = data;
|
this.cache[key] = data;
|
||||||
}
|
}
|
||||||
@@ -137,6 +145,9 @@ export class OpenAPI {
|
|||||||
if (isNode) {
|
if (isNode) {
|
||||||
return this.root[key];
|
return this.root[key];
|
||||||
}
|
}
|
||||||
|
if (isGUIforCores) {
|
||||||
|
return $Plugins.SubStoreCache.get(key);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return this.cache[key];
|
return this.cache[key];
|
||||||
}
|
}
|
||||||
@@ -155,6 +166,9 @@ export class OpenAPI {
|
|||||||
if (isNode) {
|
if (isNode) {
|
||||||
delete this.root[key];
|
delete this.root[key];
|
||||||
}
|
}
|
||||||
|
if (isGUIforCores) {
|
||||||
|
return $Plugins.SubStoreCache.remove(key);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
delete this.cache[key];
|
delete this.cache[key];
|
||||||
}
|
}
|
||||||
@@ -220,6 +234,9 @@ export class OpenAPI {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isGUIforCores) {
|
||||||
|
$Plugins.Notify(title, subtitle + '\n' + content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// other helper functions
|
// other helper functions
|
||||||
@@ -240,7 +257,7 @@ export class OpenAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
done(value = {}) {
|
done(value = {}) {
|
||||||
if (isQX || isLoon || isSurge) {
|
if (isQX || isLoon || isSurge || isGUIforCores) {
|
||||||
$done(value);
|
$done(value);
|
||||||
} else if (isNode) {
|
} else if (isNode) {
|
||||||
if (typeof $context !== 'undefined') {
|
if (typeof $context !== 'undefined') {
|
||||||
@@ -262,11 +279,12 @@ export function ENV() {
|
|||||||
isShadowRocket,
|
isShadowRocket,
|
||||||
isEgern,
|
isEgern,
|
||||||
isLanceX,
|
isLanceX,
|
||||||
|
isGUIforCores,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function HTTP(defaultOptions = { baseURL: '' }) {
|
export function HTTP(defaultOptions = { baseURL: '' }) {
|
||||||
const { isQX, isLoon, isSurge, isNode } = ENV();
|
const { isQX, isLoon, isSurge, isNode, isGUIforCores } = ENV();
|
||||||
const methods = [
|
const methods = [
|
||||||
'GET',
|
'GET',
|
||||||
'POST',
|
'POST',
|
||||||
@@ -356,6 +374,24 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (isGUIforCores) {
|
||||||
|
worker = new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const response = await $Plugins.Requests({
|
||||||
|
method,
|
||||||
|
url: options.url,
|
||||||
|
headers: options.headers,
|
||||||
|
body: options.body,
|
||||||
|
});
|
||||||
|
resolve({
|
||||||
|
statusCode: response.status,
|
||||||
|
headers: response.headers,
|
||||||
|
body: response.body,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeoutid;
|
let timeoutid;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!name=Sub-Store
|
#!name=Sub-Store
|
||||||
#!desc=高级订阅管理工具. 定时任务默认为每天 23 点 55 分
|
#!desc=高级订阅管理工具. 定时任务默认为每天 23 点 55 分. 定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'
|
||||||
#!openUrl=https://sub.store
|
#!openUrl=https://sub.store
|
||||||
#!author=Peng-YM
|
#!author=Peng-YM
|
||||||
#!homepage=https://github.com/sub-store-org/Sub-Store
|
#!homepage=https://github.com/sub-store-org/Sub-Store
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Sub-Store",
|
"name": "Sub-Store",
|
||||||
"description": "定时任务默认为每天 23 点 55 分",
|
"description": "定时任务默认为每天 23 点 55 分. 定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'",
|
||||||
"task": [
|
"task": [
|
||||||
"55 23 * * * https://github.com/sub-store-org/Sub-Store/releases/latest/download/cron-sync-artifacts.min.js, tag=Sub-Store Sync, img-url=https://raw.githubusercontent.com/58xinian/icon/master/Sub-Store1.png"
|
"55 23 * * * https://github.com/sub-store-org/Sub-Store/releases/latest/download/cron-sync-artifacts.min.js, tag=Sub-Store Sync, img-url=https://raw.githubusercontent.com/58xinian/icon/master/Sub-Store1.png"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Telegram 频道: [`https://t.me/cool_scripts` ](https://t.me/cool_scripts)
|
|||||||
安装使用 覆写 [`https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Stash.stoverride`](https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Stash.stoverride) 即可。
|
安装使用 覆写 [`https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Stash.stoverride`](https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Stash.stoverride) 即可。
|
||||||
|
|
||||||
### 5. Shadowrocket
|
### 5. Shadowrocket
|
||||||
安装使用 模块 [`https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge.sgmodule`](https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge.sgmodule) 即可。
|
安装使用 模块 [`https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge-Noability.sgmodule`](https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge-Noability.sgmodule) 即可。
|
||||||
|
|
||||||
## 使用 Sub-Store
|
## 使用 Sub-Store
|
||||||
1. 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功。
|
1. 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功。
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Sub-Store
|
name: Sub-Store
|
||||||
desc: 高级订阅管理工具 @Peng-YM. 定时任务默认为每天 23 点 55 分
|
desc: 高级订阅管理工具 @Peng-YM. 定时任务默认为每天 23 点 55 分. 定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'
|
||||||
icon: https://raw.githubusercontent.com/cc63/ICON/main/Sub-Store.png
|
icon: https://raw.githubusercontent.com/cc63/ICON/main/Sub-Store.png
|
||||||
|
|
||||||
http:
|
http:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#!desc=支持 Surge 正式版的参数设置功能. 测落地功能 ability: http-client-policy, 同步配置的定时 cronexp: 55 23 * * *
|
#!desc=支持 Surge 正式版的参数设置功能. 测落地功能 ability: http-client-policy, 同步配置的定时 cronexp: 55 23 * * *
|
||||||
#!category=订阅管理
|
#!category=订阅管理
|
||||||
#!arguments=ability:http-client-policy,cronexp:55 23 * * *,sync:"Sub-Store Sync",timeout:120,engine:auto
|
#!arguments=ability:http-client-policy,cronexp:55 23 * * *,sync:"Sub-Store Sync",timeout:120,engine:auto
|
||||||
#!arguments-desc=\n1️⃣ ability\n\n默认已开启测落地能力\n需要配合脚本操作\n如 https://raw.githubusercontent.com/Keywos/rule/main/cname.js\n填写任意其他值关闭\n\n2️⃣ cronexp\n\n同步配置定时任务\n默认为每天 23 点 55 分\n\n3️⃣ sync\n\n自定义定时任务名\n便于在脚本编辑器中选择\n若设为 # 可取消定时任务\n\n4️⃣ timeout\n\n超时, 单位为秒\n\n5️⃣ engine\n\n默认为自动使用 webview 引擎, 可设为指定 jsc, 但 jsc 容易爆内存
|
#!arguments-desc=\n1️⃣ ability\n\n默认已开启测落地能力\n需要配合脚本操作\n如 https://raw.githubusercontent.com/Keywos/rule/main/cname.js\n填写任意其他值关闭\n\n2️⃣ cronexp\n\n同步配置定时任务\n默认为每天 23 点 55 分\n\n定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'\n\n3️⃣ sync\n\n自定义定时任务名\n便于在脚本编辑器中选择\n若设为 # 可取消定时任务\n\n4️⃣ timeout\n\n超时, 单位为秒\n\n5️⃣ engine\n\n默认为自动使用 webview 引擎, 可设为指定 jsc, 但 jsc 容易爆内存
|
||||||
|
|
||||||
[MITM]
|
[MITM]
|
||||||
hostname = %APPEND% sub.store
|
hostname = %APPEND% sub.store
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!name=Sub-Store
|
#!name=Sub-Store
|
||||||
#!desc=高级订阅管理工具 @Peng-YM 无 ability 参数版本,不会爆内存, 如果需要使用指定节点功能 例如[加旗帜脚本或者cname脚本] 可以用带 ability 参数. 定时任务默认为每天 23 点 55 分
|
#!desc=高级订阅管理工具 @Peng-YM 无 ability 参数版本,不会爆内存, 如果需要使用指定节点功能 例如[加旗帜脚本或者cname脚本] 可以用带 ability 参数. 定时任务默认为每天 23 点 55 分. 定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'
|
||||||
#!category=订阅管理
|
#!category=订阅管理
|
||||||
|
|
||||||
[MITM]
|
[MITM]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!name=Sub-Store
|
#!name=Sub-Store
|
||||||
#!desc=高级订阅管理工具 @Peng-YM 带 ability 参数版本, 使用 jsc 引擎时, 可能会爆内存, 如果不需要使用指定节点功能 例如[加旗帜脚本或者cname脚本] 可以用不带 ability 参数版本. 定时任务默认为每天 23 点 55 分
|
#!desc=高级订阅管理工具 @Peng-YM 带 ability 参数版本, 使用 jsc 引擎时, 可能会爆内存, 如果不需要使用指定节点功能 例如[加旗帜脚本或者cname脚本] 可以用不带 ability 参数版本. 定时任务默认为每天 23 点 55 分. 定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'
|
||||||
#!category=订阅管理
|
#!category=订阅管理
|
||||||
|
|
||||||
[MITM]
|
[MITM]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#!desc=支持 Surge 正式版的参数设置功能. 测落地功能 ability: http-client-policy, 同步配置的定时 cronexp: 55 23 * * *
|
#!desc=支持 Surge 正式版的参数设置功能. 测落地功能 ability: http-client-policy, 同步配置的定时 cronexp: 55 23 * * *
|
||||||
#!category=订阅管理
|
#!category=订阅管理
|
||||||
#!arguments=ability:http-client-policy,cronexp:55 23 * * *,sync:"Sub-Store Sync",timeout:120,engine:auto
|
#!arguments=ability:http-client-policy,cronexp:55 23 * * *,sync:"Sub-Store Sync",timeout:120,engine:auto
|
||||||
#!arguments-desc=\n1️⃣ ability\n\n默认已开启测落地能力\n需要配合脚本操作\n如 https://raw.githubusercontent.com/Keywos/rule/main/cname.js\n填写任意其他值关闭\n\n2️⃣ cronexp\n\n同步配置定时任务\n默认为每天 23 点 55 分\n\n3️⃣ sync\n\n自定义定时任务名\n便于在脚本编辑器中选择\n若设为 # 可取消定时任务\n\n4️⃣ timeout\n\n超时, 单位为秒\n\n5️⃣ engine\n\n默认为自动使用 webview 引擎, 可设为指定 jsc, 但 jsc 容易爆内存
|
#!arguments-desc=\n1️⃣ ability\n\n默认已开启测落地能力\n需要配合脚本操作\n如 https://raw.githubusercontent.com/Keywos/rule/main/cname.js\n填写任意其他值关闭\n\n2️⃣ cronexp\n\n同步配置定时任务\n默认为每天 23 点 55 分\n\n定时任务指定时将订阅/文件上传到私有 Gist. 在前端, 叫做 '同步' 或 '同步配置'\n\n3️⃣ sync\n\n自定义定时任务名\n便于在脚本编辑器中选择\n若设为 # 可取消定时任务\n\n4️⃣ timeout\n\n超时, 单位为秒\n\n5️⃣ engine\n\n默认为自动使用 webview 引擎, 可设为指定 jsc, 但 jsc 容易爆内存
|
||||||
|
|
||||||
[MITM]
|
[MITM]
|
||||||
hostname = %APPEND% sub.store
|
hostname = %APPEND% sub.store
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ function operator(proxies = [], targetPlatform, context) {
|
|||||||
// yaml, // yaml 解析和生成
|
// yaml, // yaml 解析和生成
|
||||||
// getFlag, // 获取 emoji 旗帜
|
// getFlag, // 获取 emoji 旗帜
|
||||||
// getISO, // 获取 ISO 3166-1 alpha-2 代码
|
// getISO, // 获取 ISO 3166-1 alpha-2 代码
|
||||||
|
// Gist, // Gist 类
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 示例: 给节点名添加前缀
|
// 示例: 给节点名添加前缀
|
||||||
@@ -94,6 +95,42 @@ function operator(proxies = [], targetPlatform, context) {
|
|||||||
// produceType: 'internal' // 'internal' produces an Array, otherwise produces a String( ProxyUtils.yaml.safeLoad('YAML String').proxies )
|
// produceType: 'internal' // 'internal' produces an Array, otherwise produces a String( ProxyUtils.yaml.safeLoad('YAML String').proxies )
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
// 4. 一个比较折腾的方案: 在脚本操作中, 把内容同步到另一个 gist
|
||||||
|
|
||||||
|
// async function operator(proxies = []) {
|
||||||
|
// const $ = $substore
|
||||||
|
// const GITHUB_TOKEN = 'ghp_xxxxxxxxxxxxxxxxxxxxx'
|
||||||
|
// const GIST_NAME = 'share'
|
||||||
|
// const FILENAME = 'mihomo.yaml'
|
||||||
|
// let files = {}
|
||||||
|
// let content = await produceArtifact({
|
||||||
|
// type: 'subscription',
|
||||||
|
// subscription: {},
|
||||||
|
// content: 'proxies:\n' + proxies.map((proxy) => ' - ' + JSON.stringify(proxy) + '\n').join(''),
|
||||||
|
// platform: 'ClashMeta',
|
||||||
|
// })
|
||||||
|
// const manager = new ProxyUtils.Gist({
|
||||||
|
// token: GITHUB_TOKEN,
|
||||||
|
// key: GIST_NAME,
|
||||||
|
// });
|
||||||
|
// files[encodeURIComponent(FILENAME)] = {
|
||||||
|
// content,
|
||||||
|
// };
|
||||||
|
// const res = await manager.upload(files);
|
||||||
|
// let body = {};
|
||||||
|
// try {
|
||||||
|
// body = JSON.parse(res.body);
|
||||||
|
// // eslint-disable-next-line no-empty
|
||||||
|
// } catch (e) {}
|
||||||
|
// const raw_url =
|
||||||
|
// body.files[encodeURIComponent(FILENAME)]?.raw_url;
|
||||||
|
// console.log(raw_url)
|
||||||
|
// const new_url = raw_url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1');
|
||||||
|
// console.log(new_url)
|
||||||
|
// $.notify('🌍 Sub-Store', `更新到 Gist: ${new_url}`);
|
||||||
|
// return proxies
|
||||||
|
// }
|
||||||
|
|
||||||
// // YAML
|
// // YAML
|
||||||
// ProxyUtils.yaml.load('YAML String')
|
// ProxyUtils.yaml.load('YAML String')
|
||||||
// ProxyUtils.yaml.safeLoad('YAML String')
|
// ProxyUtils.yaml.safeLoad('YAML String')
|
||||||
|
|||||||
Reference in New Issue
Block a user