feat: produceArtifact 支持 Stash internal (Fixes #271)

This commit is contained in:
xream 2024-01-17 20:31:43 +08:00
parent 059c4bd148
commit 4966132397
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 225 additions and 223 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.14.173", "version": "2.14.174",
"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": {

View File

@ -2,12 +2,11 @@ import { isPresent } from '@/core/proxy-utils/producers/utils';
export default function Stash_Producer() { export default function Stash_Producer() {
const type = 'ALL'; const type = 'ALL';
const produce = (proxies) => { const produce = (proxies, type, opts = {}) => {
// https://stash.wiki/proxy-protocols/proxy-types#shadowsocks // https://stash.wiki/proxy-protocols/proxy-types#shadowsocks
return ( const list = proxies
'proxies:\n' +
proxies
.filter((proxy) => { .filter((proxy) => {
if (opts['include-unsupported-proxy']) return true;
if ( if (
![ ![
'ss', 'ss',
@ -40,8 +39,7 @@ export default function Stash_Producer() {
'chacha20-ietf-poly1305', 'chacha20-ietf-poly1305',
'xchacha20-ietf-poly1305', 'xchacha20-ietf-poly1305',
].includes(proxy.cipher)) || ].includes(proxy.cipher)) ||
(proxy.type === 'snell' && (proxy.type === 'snell' && String(proxy.version) === '4') ||
String(proxy.version) === '4') ||
(proxy.type === 'vless' && proxy['reality-opts']) (proxy.type === 'vless' && proxy['reality-opts'])
) { ) {
return false; return false;
@ -233,10 +231,14 @@ export default function Stash_Producer() {
) { ) {
delete proxy[`${proxy.network}-opts`]['_grpc-type']; delete proxy[`${proxy.network}-opts`]['_grpc-type'];
} }
return ' - ' + JSON.stringify(proxy) + '\n'; return proxy;
}) });
.join('') return type === 'internal'
); ? list
: 'proxies:\n' +
list
.map((proxy) => ' - ' + JSON.stringify(proxy) + '\n')
.join('');
}; };
return { type, produce }; return { type, produce };
} }