feat: Added dedicated Stash producer

This commit is contained in:
Peng-YM 2022-06-20 21:51:13 +08:00
parent bea2c64e40
commit d602dbeb7c
8 changed files with 39 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,11 +1,16 @@
export default function Clash_Producer() {
const type = 'ALL';
const produce = (proxies) => {
proxies.filter((proxy) => {
if (proxy.type === 'vless') return false;
return true;
});
return (
'proxies:\n' +
proxies
.map((proxy) => {
delete proxy.supported;
delete proxy['tls-fingerprint'];
delete proxy['vmess-aead'];
return ' - ' + JSON.stringify(proxy) + '\n';
})
.join('')

View File

@ -1,5 +1,6 @@
import Surge_Producer from './surge';
import Clash_Producer from './clash';
import Stash_Producer from './stash';
import Loon_Producer from './loon';
import URI_Producer from './uri';
import QX_Producer from './qx';
@ -17,4 +18,5 @@ export default {
Clash: Clash_Producer(),
URI: URI_Producer(),
JSON: JSON_Producer(),
Stash: Stash_Producer(),
};

View File

@ -0,0 +1,16 @@
export default function Stash_Producer() {
const type = 'ALL';
const produce = (proxies) => {
return (
'proxies:\n' +
proxies
.map((proxy) => {
delete proxy['tls-fingerprint'];
delete proxy['vmess-aead'];
return ' - ' + JSON.stringify(proxy) + '\n';
})
.join('')
);
};
return { type, produce };
}

View File

@ -204,11 +204,10 @@ export function getPlatformFromHeaders(headers) {
return 'Surge';
} else if (UA.indexOf('Decar') !== -1 || UA.indexOf('Loon') !== -1) {
return 'Loon';
} else if (
UA.indexOf('Stash') !== -1 ||
UA.indexOf('Shadowrocket') !== -1
) {
} else if (UA.indexOf('Shadowrocket') !== -1) {
return 'Clash';
} else if (UA.indexOf('Stash') !== -1) {
return 'Stash';
} else {
return null;
}

View File

@ -2,7 +2,10 @@
const isQX = typeof $task !== 'undefined';
const isLoon = typeof $loon !== 'undefined';
const isSurge = typeof $httpClient !== 'undefined' && !isLoon;
const isNode = eval(`typeof process !== "undefined"`);
const isNode = eval(`typeof process !== "undefined"`); // eval is needed in order to avoid browserify processing
const isStash =
'undefined' !== typeof $environment && $environment['stash-version'];
const isShadowRocket = 'undefined' !== typeof $rocket;
export class OpenAPI {
constructor(name = 'untitled', debug = false) {
@ -218,7 +221,7 @@ export class OpenAPI {
}
export function ENV() {
return { isQX, isLoon, isSurge, isNode };
return { isQX, isLoon, isSurge, isNode, isStash, isShadowRocket };
}
export function HTTP(defaultOptions = { baseURL: '' }) {

File diff suppressed because one or more lines are too long