fix: 处理预览时子订阅出错的情况

This commit is contained in:
xream 2023-12-08 18:16:50 +08:00
parent 69726cd5c4
commit d636e1b94c
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
3 changed files with 58 additions and 52 deletions

View File

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

@ -84,7 +84,8 @@ export default function ShadowRocket_Producer() {
} else if (proxy.type === 'hysteria2') { } else if (proxy.type === 'hysteria2') {
if ( if (
proxy['obfs-password'] && proxy['obfs-password'] &&
proxy.obfs == 'salamander') { proxy.obfs == 'salamander'
) {
proxy.obfs = proxy['obfs-password']; proxy.obfs = proxy['obfs-password'];
delete proxy['obfs-password']; delete proxy['obfs-password'];
} }

View File

@ -87,9 +87,10 @@ async function compareCollection(req, res) {
const collection = req.body; const collection = req.body;
const subnames = collection.subscriptions; const subnames = collection.subscriptions;
const results = {}; const results = {};
let hasError;
await Promise.all( await Promise.all(
subnames.map(async (name) => { subnames.map(async (name) => {
if (!hasError) {
const sub = findByName(allSubs, name); const sub = findByName(allSubs, name);
try { try {
let raw; let raw;
@ -133,6 +134,8 @@ async function compareCollection(req, res) {
); );
results[name] = currentProxies; results[name] = currentProxies;
} catch (err) { } catch (err) {
if (!hasError) {
hasError = true;
failed( failed(
res, res,
new InternalServerError( new InternalServerError(
@ -142,9 +145,11 @@ async function compareCollection(req, res) {
), ),
); );
} }
}
}
}), }),
); );
if (hasError) return;
// merge proxies with the original order // merge proxies with the original order
const original = Array.prototype.concat.apply( const original = Array.prototype.concat.apply(
[], [],