Skip to content

Commit

Permalink
fix: 修复 URI 报错
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jul 19, 2024
1 parent 10ec8a2 commit 317a804
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.352",
"version": "2.14.353",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
22 changes: 20 additions & 2 deletions backend/src/core/proxy-utils/producers/v2ray.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
/* eslint-disable no-case-declarations */
import { Base64 } from 'js-base64';
import URI_Producer from './uri';
import $ from '@/core/app';

const URI = URI_Producer();

export default function V2Ray_Producer() {
const type = 'ALL';
const produce = (proxies) =>
Base64.encode(proxies.map((proxy) => URI.produce(proxy)).join('\n'));
const produce = (proxies) => {
let result = [];
proxies.map((proxy) => {
try {
result.push(URI.produce(proxy));
} catch (err) {
$.error(
`Cannot produce proxy: ${JSON.stringify(
proxy,
null,
2,
)}\nReason: ${err}`,
);
}
});

return Base64.encode(result.join('\n'));
};

return { type, produce };
}

0 comments on commit 317a804

Please sign in to comment.