mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-04 06:50:39 +08:00
Use babel relative import path
This commit is contained in:
parent
6bfe2700cf
commit
8fe2280232
@ -10,5 +10,18 @@
|
|||||||
"@babel/preset-env"
|
"@babel/preset-env"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"babel-plugin-relative-path-import",
|
||||||
|
{
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"rootPathPrefix": "@",
|
||||||
|
"rootPathSuffix": "src"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
4
backend/dist/sub-store-parser.loon.min.js
vendored
4
backend/dist/sub-store-parser.loon.min.js
vendored
@ -6,8 +6,8 @@
|
|||||||
* ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗
|
* ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗
|
||||||
* ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
* ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
||||||
* Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket!
|
* Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket!
|
||||||
* @updated: 2022/6/16 12:57:15
|
* @updated: 2022/6/16 14:23:56
|
||||||
* @version: 2.0
|
* @version: 2.0.1
|
||||||
* @author: Peng-YM
|
* @author: Peng-YM
|
||||||
* @github: https://github.com/Peng-YM/Sub-Store
|
* @github: https://github.com/Peng-YM/Sub-Store
|
||||||
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
||||||
|
@ -43,7 +43,20 @@ function scripts(src, dest) {
|
|||||||
return () => {
|
return () => {
|
||||||
return browserify(src)
|
return browserify(src)
|
||||||
.transform('babelify', {
|
.transform('babelify', {
|
||||||
presets: [['@babel/preset-env']]
|
presets: [['@babel/preset-env']],
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
'babel-plugin-relative-path-import',
|
||||||
|
{
|
||||||
|
paths: [
|
||||||
|
{
|
||||||
|
'rootPathPrefix': '@',
|
||||||
|
'rootPathSuffix': 'src',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.plugin('tinyify')
|
.plugin('tinyify')
|
||||||
.bundle()
|
.bundle()
|
||||||
|
38
backend/package-lock.json
generated
38
backend/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "1.6",
|
"version": "2.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "1.6",
|
"version": "2.0",
|
||||||
"license": "GPL",
|
"license": "GPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
@ -23,6 +23,7 @@
|
|||||||
"@babel/register": "^7.17.7",
|
"@babel/register": "^7.17.7",
|
||||||
"@types/gulp": "^4.0.9",
|
"@types/gulp": "^4.0.9",
|
||||||
"axios": "^0.20.0",
|
"axios": "^0.20.0",
|
||||||
|
"babel-plugin-relative-path-import": "^2.0.1",
|
||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
"browser-pack-flat": "^3.4.2",
|
"browser-pack-flat": "^3.4.2",
|
||||||
"browserify": "^17.0.0",
|
"browserify": "^17.0.0",
|
||||||
@ -2917,6 +2918,15 @@
|
|||||||
"@babel/core": "^7.0.0-0"
|
"@babel/core": "^7.0.0-0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/babel-plugin-relative-path-import": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/babel-plugin-relative-path-import/-/babel-plugin-relative-path-import-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-jOtB/Lef7QFNAEGRV4VmUvP/VsizpvOVonrTeTTE8TxVIR0FL/wJTzFQp4ei5Jf5+EWklFORmnsXOjLxvNVeRg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"slash": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/babelify": {
|
"node_modules/babelify": {
|
||||||
"version": "10.0.0",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/babelify/-/babelify-10.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/babelify/-/babelify-10.0.0.tgz",
|
||||||
@ -11243,6 +11253,15 @@
|
|||||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/slash": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/slash/-/slash-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/snapdragon": {
|
"node_modules/snapdragon": {
|
||||||
"version": "0.8.2",
|
"version": "0.8.2",
|
||||||
"resolved": "https://registry.npmmirror.com/snapdragon/-/snapdragon-0.8.2.tgz",
|
"resolved": "https://registry.npmmirror.com/snapdragon/-/snapdragon-0.8.2.tgz",
|
||||||
@ -15693,6 +15712,15 @@
|
|||||||
"@babel/helper-define-polyfill-provider": "^0.3.1"
|
"@babel/helper-define-polyfill-provider": "^0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"babel-plugin-relative-path-import": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/babel-plugin-relative-path-import/-/babel-plugin-relative-path-import-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-jOtB/Lef7QFNAEGRV4VmUvP/VsizpvOVonrTeTTE8TxVIR0FL/wJTzFQp4ei5Jf5+EWklFORmnsXOjLxvNVeRg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"slash": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"babelify": {
|
"babelify": {
|
||||||
"version": "10.0.0",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/babelify/-/babelify-10.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/babelify/-/babelify-10.0.0.tgz",
|
||||||
@ -22607,6 +22635,12 @@
|
|||||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"slash": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/slash/-/slash-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"snapdragon": {
|
"snapdragon": {
|
||||||
"version": "0.8.2",
|
"version": "0.8.2",
|
||||||
"resolved": "https://registry.npmmirror.com/snapdragon/-/snapdragon-0.8.2.tgz",
|
"resolved": "https://registry.npmmirror.com/snapdragon/-/snapdragon-0.8.2.tgz",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.0",
|
"version": "2.0.1",
|
||||||
"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": {
|
||||||
"test": "gulp peggy && npx cross-env BABEL_ENV=test mocha --require @babel/register --recursive",
|
"test": "gulp peggy && npx cross-env BABEL_ENV=test mocha src/test/**/*.spec.js --require @babel/register --recursive",
|
||||||
"serve": "node sub-store.min.js",
|
"serve": "node sub-store.min.js",
|
||||||
"start": "nodemon --exec node_modules/.bin/babel-node src/main.js",
|
"start": "nodemon --exec node_modules/.bin/babel-node src/main.js",
|
||||||
"build": "gulp"
|
"build": "gulp"
|
||||||
@ -26,6 +26,7 @@
|
|||||||
"@babel/register": "^7.17.7",
|
"@babel/register": "^7.17.7",
|
||||||
"@types/gulp": "^4.0.9",
|
"@types/gulp": "^4.0.9",
|
||||||
"axios": "^0.20.0",
|
"axios": "^0.20.0",
|
||||||
|
"babel-plugin-relative-path-import": "^2.0.1",
|
||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
"browser-pack-flat": "^3.4.2",
|
"browser-pack-flat": "^3.4.2",
|
||||||
"browserify": "^17.0.0",
|
"browserify": "^17.0.0",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { isIPv4, isIPv6 } from '../../../utils';
|
import { isIPv4, isIPv6 } from '@/utils';
|
||||||
import { FULL } from '../../../utils/logical';
|
import { FULL } from '@/utils/logical';
|
||||||
import { getFlag } from '../../../utils/geo';
|
import { getFlag } from '@/utils/geo';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
import $ from '../../app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
// force to set some properties (e.g., skip-cert-verify, udp, tfo, etc.)
|
// force to set some properties (e.g., skip-cert-verify, udp, tfo, etc.)
|
||||||
function SetPropertyOperator({ key, value }) {
|
function SetPropertyOperator({ key, value }) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import RULE_PREPROCESSORS from './preprocessors';
|
import RULE_PREPROCESSORS from './preprocessors';
|
||||||
import RULE_PRODUCERS from './producers';
|
import RULE_PRODUCERS from './producers';
|
||||||
import RULE_PARSERS from './parsers';
|
import RULE_PARSERS from './parsers';
|
||||||
import $ from '../app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
export const RuleUtils = (function () {
|
export const RuleUtils = (function () {
|
||||||
function preprocess(raw) {
|
function preprocess(raw) {
|
||||||
|
@ -18,6 +18,6 @@ console.log(
|
|||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
import serve from './restful';
|
import serve from '@/restful';
|
||||||
|
|
||||||
serve();
|
serve();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import { ProxyUtils } from '../core/proxy-utils';
|
import { ProxyUtils } from '@/core/proxy-utils';
|
||||||
import { RuleUtils } from '../core/rule-utils';
|
import { RuleUtils } from '@/core/rule-utils';
|
||||||
|
|
||||||
const RESOURCE_TYPE = {
|
const RESOURCE_TYPE = {
|
||||||
PROXY: 1,
|
PROXY: 1,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { ProxyUtils } from '../core/proxy-utils';
|
import { ProxyUtils } from '@/core/proxy-utils';
|
||||||
import { RuleUtils } from '../core/rule-utils';
|
import { RuleUtils } from '@/core/rule-utils';
|
||||||
import download from '../utils/download';
|
import download from '@/utils/download';
|
||||||
import Gist from '../utils/gist';
|
import Gist from '@/utils/gist';
|
||||||
import $ from '../core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SUBS_KEY,
|
SUBS_KEY,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { getPlatformFromHeaders, getFlowHeaders } from './subscriptions';
|
import { getPlatformFromHeaders, getFlowHeaders } from './subscriptions';
|
||||||
import { SUBS_KEY, COLLECTIONS_KEY } from './constants';
|
import { SUBS_KEY, COLLECTIONS_KEY } from './constants';
|
||||||
import { produceArtifact } from './artifacts';
|
import { produceArtifact } from './artifacts';
|
||||||
import $ from '../core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
export default function register($app) {
|
export default function register($app) {
|
||||||
if (!$.read(COLLECTIONS_KEY)) $.write({}, COLLECTIONS_KEY);
|
if (!$.read(COLLECTIONS_KEY)) $.write({}, COLLECTIONS_KEY);
|
||||||
|
@ -3,10 +3,10 @@ import {
|
|||||||
GIST_BACKUP_KEY,
|
GIST_BACKUP_KEY,
|
||||||
GIST_BACKUP_FILE_NAME,
|
GIST_BACKUP_FILE_NAME,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { ENV, HTTP } from '../vendor/open-api';
|
import { ENV, HTTP } from '@/vendor/open-api';
|
||||||
import express from '../vendor/express';
|
import express from '@/vendor/express';
|
||||||
import Gist from '../utils/gist';
|
import Gist from '@/utils/gist';
|
||||||
import $ from '../core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
import registerSubscriptionRoutes from './subscriptions';
|
import registerSubscriptionRoutes from './subscriptions';
|
||||||
import registerCollectionRoutes from './collections';
|
import registerCollectionRoutes from './collections';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { SETTINGS_KEY } from './constants';
|
import { SETTINGS_KEY } from './constants';
|
||||||
import $ from '../core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
export default function register($app) {
|
export default function register($app) {
|
||||||
if (!$.read(SETTINGS_KEY)) $.write({}, SETTINGS_KEY);
|
if (!$.read(SETTINGS_KEY)) $.write({}, SETTINGS_KEY);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { SUBS_KEY, COLLECTIONS_KEY } from './constants';
|
import { SUBS_KEY, COLLECTIONS_KEY } from './constants';
|
||||||
import { produceArtifact } from './artifacts';
|
import { produceArtifact } from './artifacts';
|
||||||
import $ from '../core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
export default function register($app) {
|
export default function register($app) {
|
||||||
if (!$.read(SUBS_KEY)) $.write({}, SUBS_KEY);
|
if (!$.read(SUBS_KEY)) $.write({}, SUBS_KEY);
|
||||||
|
@ -1,128 +1,128 @@
|
|||||||
import { expect } from 'chai';
|
import getLoonParser from '@/core/proxy-utils/parsers/peggy/loon';
|
||||||
import getLoonParser from '../../src/core/proxy-utils/peggy/loon';
|
|
||||||
import testcases from './testcases';
|
|
||||||
import { describe, it } from 'mocha';
|
import { describe, it } from 'mocha';
|
||||||
|
import testcases from './testcases';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
const parser = getLoonParser();
|
const parser = getLoonParser();
|
||||||
|
|
||||||
describe('Loon', function() {
|
describe('Loon', function () {
|
||||||
describe('shadowsocks', function() {
|
describe('shadowsocks', function () {
|
||||||
it('test shadowsocks simple', function() {
|
it('test shadowsocks simple', function () {
|
||||||
const { input, expected } = testcases.SS.SIMPLE;
|
const { input, expected } = testcases.SS.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + tls', function() {
|
it('test shadowsocks obfs + tls', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_TLS;
|
const { input, expected } = testcases.SS.OBFS_TLS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + http', function() {
|
it('test shadowsocks obfs + http', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_HTTP;
|
const { input, expected } = testcases.SS.OBFS_HTTP;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('shadowsocksr', function() {
|
describe('shadowsocksr', function () {
|
||||||
it('test shadowsocksr simple', function() {
|
it('test shadowsocksr simple', function () {
|
||||||
const { input, expected } = testcases.SSR.SIMPLE;
|
const { input, expected } = testcases.SSR.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('trojan', function() {
|
describe('trojan', function () {
|
||||||
it('test trojan simple', function() {
|
it('test trojan simple', function () {
|
||||||
const { input, expected } = testcases.TROJAN.SIMPLE;
|
const { input, expected } = testcases.TROJAN.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + ws', function() {
|
it('test trojan + ws', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WS;
|
const { input, expected } = testcases.TROJAN.WS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + wss', function() {
|
it('test trojan + wss', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WSS;
|
const { input, expected } = testcases.TROJAN.WSS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('vmess', function() {
|
describe('vmess', function () {
|
||||||
it('test vmess simple', function() {
|
it('test vmess simple', function () {
|
||||||
const { input, expected } = testcases.VMESS.SIMPLE;
|
const { input, expected } = testcases.VMESS.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + aead', function() {
|
it('test vmess + aead', function () {
|
||||||
const { input, expected } = testcases.VMESS.AEAD;
|
const { input, expected } = testcases.VMESS.AEAD;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + ws', function() {
|
it('test vmess + ws', function () {
|
||||||
const { input, expected } = testcases.VMESS.WS;
|
const { input, expected } = testcases.VMESS.WS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + wss', function() {
|
it('test vmess + wss', function () {
|
||||||
const { input, expected } = testcases.VMESS.WSS;
|
const { input, expected } = testcases.VMESS.WSS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + http', function() {
|
it('test vmess + http', function () {
|
||||||
const { input, expected } = testcases.VMESS.HTTP;
|
const { input, expected } = testcases.VMESS.HTTP;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + http + tls', function() {
|
it('test vmess + http + tls', function () {
|
||||||
const { input, expected } = testcases.VMESS.HTTP_TLS;
|
const { input, expected } = testcases.VMESS.HTTP_TLS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('vless', function() {
|
describe('vless', function () {
|
||||||
it('test vless simple', function() {
|
it('test vless simple', function () {
|
||||||
const { input, expected } = testcases.VLESS.SIMPLE;
|
const { input, expected } = testcases.VLESS.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon)
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vless + ws', function() {
|
it('test vless + ws', function () {
|
||||||
const { input, expected } = testcases.VLESS.WS;
|
const { input, expected } = testcases.VLESS.WS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vless + wss', function() {
|
it('test vless + wss', function () {
|
||||||
const { input, expected } = testcases.VLESS.WSS;
|
const { input, expected } = testcases.VLESS.WSS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vless + http', function() {
|
it('test vless + http', function () {
|
||||||
const { input, expected } = testcases.VLESS.HTTP;
|
const { input, expected } = testcases.VLESS.HTTP;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vless + http + tls', function() {
|
it('test vless + http + tls', function () {
|
||||||
const { input, expected } = testcases.VLESS.HTTP_TLS;
|
const { input, expected } = testcases.VLESS.HTTP_TLS;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
expect(proxy).eql(expected.Loon);
|
expect(proxy).eql(expected.Loon);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('http(s)', function() {
|
describe('http(s)', function () {
|
||||||
it('test http simple', function () {
|
it('test http simple', function () {
|
||||||
const { input, expected } = testcases.HTTP.SIMPLE;
|
const { input, expected } = testcases.HTTP.SIMPLE;
|
||||||
const proxy = parser.parse(input.Loon);
|
const proxy = parser.parse(input.Loon);
|
||||||
@ -141,4 +141,4 @@ describe('Loon', function() {
|
|||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -1,95 +1,93 @@
|
|||||||
import getQXParser from '../../src/core/proxy-utils/peggy/qx';
|
import getQXParser from '@/core/proxy-utils/parsers/peggy/qx';
|
||||||
import { expect } from 'chai';
|
|
||||||
import testcases from './testcases';
|
|
||||||
import { describe, it } from 'mocha';
|
import { describe, it } from 'mocha';
|
||||||
|
import testcases from './testcases';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
const parser = getQXParser();
|
const parser = getQXParser();
|
||||||
|
|
||||||
describe('QX', function() {
|
describe('QX', function () {
|
||||||
describe('shadowsocks', function() {
|
describe('shadowsocks', function () {
|
||||||
it('test shadowsocks simple', function() {
|
it('test shadowsocks simple', function () {
|
||||||
const { input, expected } = testcases.SS.SIMPLE;
|
const { input, expected } = testcases.SS.SIMPLE;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + tls', function() {
|
it('test shadowsocks obfs + tls', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_TLS;
|
const { input, expected } = testcases.SS.OBFS_TLS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + http', function() {
|
it('test shadowsocks obfs + http', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_HTTP;
|
const { input, expected } = testcases.SS.OBFS_HTTP;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks v2ray-plugin + ws', function() {
|
it('test shadowsocks v2ray-plugin + ws', function () {
|
||||||
const { input, expected } = testcases.SS.V2RAY_PLUGIN_WS;
|
const { input, expected } = testcases.SS.V2RAY_PLUGIN_WS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks v2ray-plugin + wss', function() {
|
it('test shadowsocks v2ray-plugin + wss', function () {
|
||||||
const { input, expected } = testcases.SS.V2RAY_PLUGIN_WSS;
|
const { input, expected } = testcases.SS.V2RAY_PLUGIN_WSS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('shadowsocksr', function() {
|
describe('shadowsocksr', function () {
|
||||||
it('test shadowsocksr simple', function() {
|
it('test shadowsocksr simple', function () {
|
||||||
const { input, expected } = testcases.SSR.SIMPLE;
|
const { input, expected } = testcases.SSR.SIMPLE;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('trojan', function() {
|
describe('trojan', function () {
|
||||||
it('test trojan simple', function() {
|
it('test trojan simple', function () {
|
||||||
const { input, expected } = testcases.TROJAN.SIMPLE;
|
const { input, expected } = testcases.TROJAN.SIMPLE;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + ws', function() {
|
it('test trojan + ws', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WS;
|
const { input, expected } = testcases.TROJAN.WS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + wss', function() {
|
it('test trojan + wss', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WSS;
|
const { input, expected } = testcases.TROJAN.WSS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('vmess', function() {
|
describe('vmess', function () {
|
||||||
it('test vmess simple', function() {
|
it('test vmess simple', function () {
|
||||||
const { input, expected } = testcases.VMESS.SIMPLE;
|
const { input, expected } = testcases.VMESS.SIMPLE;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected.QX);
|
expect(proxy).eql(expected.QX);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess aead', function() {
|
it('test vmess aead', function () {
|
||||||
const { input, expected } = testcases.VMESS.AEAD;
|
const { input, expected } = testcases.VMESS.AEAD;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected.QX);
|
expect(proxy).eql(expected.QX);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + ws', function() {
|
it('test vmess + ws', function () {
|
||||||
const { input, expected } = testcases.VMESS.WS;
|
const { input, expected } = testcases.VMESS.WS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected.QX);
|
expect(proxy).eql(expected.QX);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + wss', function() {
|
it('test vmess + wss', function () {
|
||||||
const { input, expected } = testcases.VMESS.WSS;
|
const { input, expected } = testcases.VMESS.WSS;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected.QX);
|
expect(proxy).eql(expected.QX);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + http', function() {
|
it('test vmess + http', function () {
|
||||||
const { input, expected } = testcases.VMESS.HTTP;
|
const { input, expected } = testcases.VMESS.HTTP;
|
||||||
const proxy = parser.parse(input.QX);
|
const proxy = parser.parse(input.QX);
|
||||||
expect(proxy).eql(expected.QX);
|
expect(proxy).eql(expected.QX);
|
||||||
@ -135,4 +133,4 @@ describe('QX', function() {
|
|||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -1,69 +1,69 @@
|
|||||||
import getSurgeParser from '../../src/core/proxy-utils/peggy/surge';
|
import getSurgeParser from '@/core/proxy-utils/parsers/peggy/surge';
|
||||||
import { expect } from 'chai';
|
|
||||||
import testcases from './testcases';
|
|
||||||
import { describe, it } from 'mocha';
|
import { describe, it } from 'mocha';
|
||||||
|
import testcases from './testcases';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
const parser = getSurgeParser();
|
const parser = getSurgeParser();
|
||||||
|
|
||||||
describe('Surge', function() {
|
describe('Surge', function () {
|
||||||
describe('shadowsocks', function() {
|
describe('shadowsocks', function () {
|
||||||
it('test shadowsocks simple', function() {
|
it('test shadowsocks simple', function () {
|
||||||
const { input, expected } = testcases.SS.SIMPLE;
|
const { input, expected } = testcases.SS.SIMPLE;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + tls', function() {
|
it('test shadowsocks obfs + tls', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_TLS;
|
const { input, expected } = testcases.SS.OBFS_TLS;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
it('test shadowsocks obfs + http', function() {
|
it('test shadowsocks obfs + http', function () {
|
||||||
const { input, expected } = testcases.SS.OBFS_HTTP;
|
const { input, expected } = testcases.SS.OBFS_HTTP;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('trojan', function() {
|
describe('trojan', function () {
|
||||||
it('test trojan simple', function() {
|
it('test trojan simple', function () {
|
||||||
const { input, expected } = testcases.TROJAN.SIMPLE;
|
const { input, expected } = testcases.TROJAN.SIMPLE;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + ws', function() {
|
it('test trojan + ws', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WS;
|
const { input, expected } = testcases.TROJAN.WS;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test trojan + wss', function() {
|
it('test trojan + wss', function () {
|
||||||
const { input, expected } = testcases.TROJAN.WSS;
|
const { input, expected } = testcases.TROJAN.WSS;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('vmess', function() {
|
describe('vmess', function () {
|
||||||
it('test vmess simple', function() {
|
it('test vmess simple', function () {
|
||||||
const { input, expected } = testcases.VMESS.SIMPLE;
|
const { input, expected } = testcases.VMESS.SIMPLE;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected.Surge);
|
expect(proxy).eql(expected.Surge);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess aead', function() {
|
it('test vmess aead', function () {
|
||||||
const { input, expected } = testcases.VMESS.AEAD;
|
const { input, expected } = testcases.VMESS.AEAD;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected.Surge);
|
expect(proxy).eql(expected.Surge);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + ws', function() {
|
it('test vmess + ws', function () {
|
||||||
const { input, expected } = testcases.VMESS.WS;
|
const { input, expected } = testcases.VMESS.WS;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected.Surge);
|
expect(proxy).eql(expected.Surge);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('test vmess + wss', function() {
|
it('test vmess + wss', function () {
|
||||||
const { input, expected } = testcases.VMESS.WSS;
|
const { input, expected } = testcases.VMESS.WSS;
|
||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected.Surge);
|
expect(proxy).eql(expected.Surge);
|
||||||
@ -128,5 +128,5 @@ describe('Surge', function() {
|
|||||||
const proxy = parser.parse(input.Surge);
|
const proxy = parser.parse(input.Surge);
|
||||||
expect(proxy).eql(expected);
|
expect(proxy).eql(expected);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
@ -29,7 +29,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ss',
|
type: 'ss',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
OBFS_TLS: {
|
OBFS_TLS: {
|
||||||
@ -40,7 +44,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ss',
|
type: 'ss',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
plugin: 'obfs',
|
plugin: 'obfs',
|
||||||
'plugin-opts': {
|
'plugin-opts': {
|
||||||
mode: 'tls',
|
mode: 'tls',
|
||||||
@ -57,7 +65,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ss',
|
type: 'ss',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
plugin: 'obfs',
|
plugin: 'obfs',
|
||||||
'plugin-opts': {
|
'plugin-opts': {
|
||||||
mode: 'http',
|
mode: 'http',
|
||||||
@ -72,7 +84,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ss',
|
type: 'ss',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
plugin: 'v2ray-plugin',
|
plugin: 'v2ray-plugin',
|
||||||
'plugin-opts': {
|
'plugin-opts': {
|
||||||
mode: 'websocket',
|
mode: 'websocket',
|
||||||
@ -87,7 +103,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ss',
|
type: 'ss',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
plugin: 'v2ray-plugin',
|
plugin: 'v2ray-plugin',
|
||||||
'plugin-opts': {
|
'plugin-opts': {
|
||||||
mode: 'websocket',
|
mode: 'websocket',
|
||||||
@ -106,7 +126,11 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'ssr',
|
type: 'ssr',
|
||||||
name, server, port, cipher, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
cipher,
|
||||||
|
password,
|
||||||
obfs: ssr_obfs,
|
obfs: ssr_obfs,
|
||||||
protocol: ssr_protocol,
|
protocol: ssr_protocol,
|
||||||
'obfs-param': ssr_obfs_param,
|
'obfs-param': ssr_obfs_param,
|
||||||
@ -123,7 +147,10 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'trojan',
|
type: 'trojan',
|
||||||
name, server, port, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
password,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
WS: {
|
WS: {
|
||||||
@ -134,16 +161,18 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'trojan',
|
type: 'trojan',
|
||||||
name, server, port, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
password,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
,
|
|
||||||
},
|
},
|
||||||
WSS: {
|
WSS: {
|
||||||
input: {
|
input: {
|
||||||
@ -153,13 +182,16 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'trojan',
|
type: 'trojan',
|
||||||
name, server, port, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
password,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
tls: true,
|
tls: true,
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'skip-cert-verify': true,
|
'skip-cert-verify': true,
|
||||||
@ -177,15 +209,26 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
QX: {
|
QX: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
},
|
},
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
},
|
},
|
||||||
Surge: {
|
Surge: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -198,15 +241,28 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
QX: {
|
QX: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher, alterId: 0,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
|
alterId: 0,
|
||||||
},
|
},
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher, alterId: 0,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
|
alterId: 0,
|
||||||
},
|
},
|
||||||
Surge: {
|
Surge: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
||||||
alterId: 0,
|
alterId: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -220,34 +276,45 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
QX: {
|
QX: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Surge: {
|
Surge: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -262,12 +329,16 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
QX: {
|
QX: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -276,12 +347,16 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -290,12 +365,15 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
Surge: {
|
Surge: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid, // Surge lacks support for specifying cipher for vmess protocol!
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -312,23 +390,31 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
QX: {
|
QX: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'http',
|
network: 'http',
|
||||||
'http-opts': {
|
'http-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'http',
|
network: 'http',
|
||||||
'http-opts': {
|
'http-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -341,12 +427,16 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vmess',
|
type: 'vmess',
|
||||||
name, server, port, uuid, cipher,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
|
cipher,
|
||||||
network: 'http',
|
network: 'http',
|
||||||
'http-opts': {
|
'http-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -364,7 +454,10 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vless',
|
type: 'vless',
|
||||||
name, server, port, uuid,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -373,19 +466,20 @@ function createTestCases() {
|
|||||||
Loon: `${name}=vless,${server},${port},"${uuid}",transport=ws,host=${obfs_host},path=${obfs_path}`,
|
Loon: `${name}=vless,${server},${port},"${uuid}",transport=ws,host=${obfs_host},path=${obfs_path}`,
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
|
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vless',
|
type: 'vless',
|
||||||
name, server, port, uuid,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
WSS: {
|
WSS: {
|
||||||
@ -393,22 +487,23 @@ function createTestCases() {
|
|||||||
Loon: `${name}=vless,${server},${port},"${uuid}",transport=ws,host=${obfs_host},path=${obfs_path},over-tls=true,tls-name=${sni},skip-cert-verify=true`,
|
Loon: `${name}=vless,${server},${port},"${uuid}",transport=ws,host=${obfs_host},path=${obfs_path},over-tls=true,tls-name=${sni},skip-cert-verify=true`,
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
|
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vless',
|
type: 'vless',
|
||||||
name, server, port, uuid,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
network: 'ws',
|
network: 'ws',
|
||||||
'ws-opts': {
|
'ws-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
'skip-cert-verify': true,
|
'skip-cert-verify': true,
|
||||||
sni,
|
sni,
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
HTTP: {
|
HTTP: {
|
||||||
@ -416,15 +511,17 @@ function createTestCases() {
|
|||||||
Loon: `${name}=vless,${server},${port},"${uuid}",transport=http,host=${obfs_host},path=${obfs_path}`,
|
Loon: `${name}=vless,${server},${port},"${uuid}",transport=http,host=${obfs_host},path=${obfs_path}`,
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
|
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vless',
|
type: 'vless',
|
||||||
name, server, port, uuid,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
network: 'http',
|
network: 'http',
|
||||||
'http-opts': {
|
'http-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -437,12 +534,15 @@ function createTestCases() {
|
|||||||
expected: {
|
expected: {
|
||||||
Loon: {
|
Loon: {
|
||||||
type: 'vless',
|
type: 'vless',
|
||||||
name, server, port, uuid,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
uuid,
|
||||||
network: 'http',
|
network: 'http',
|
||||||
'http-opts': {
|
'http-opts': {
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
'headers': {
|
headers: {
|
||||||
'Host': obfs_host,
|
Host: obfs_host,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -461,8 +561,10 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'http',
|
type: 'http',
|
||||||
name, server, port,
|
name,
|
||||||
}
|
server,
|
||||||
|
port,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
AUTH: {
|
AUTH: {
|
||||||
input: {
|
input: {
|
||||||
@ -472,8 +574,12 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'http',
|
type: 'http',
|
||||||
name, server, port, username, password
|
name,
|
||||||
}
|
server,
|
||||||
|
port,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
TLS: {
|
TLS: {
|
||||||
input: {
|
input: {
|
||||||
@ -483,12 +589,16 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'http',
|
type: 'http',
|
||||||
name, server, port, username, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
sni,
|
sni,
|
||||||
'skip-cert-verify': true,
|
'skip-cert-verify': true,
|
||||||
tls: true
|
tls: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const SOCKS5 = {
|
const SOCKS5 = {
|
||||||
SIMPLE: {
|
SIMPLE: {
|
||||||
@ -498,8 +608,10 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'socks5',
|
type: 'socks5',
|
||||||
name, server, port,
|
name,
|
||||||
}
|
server,
|
||||||
|
port,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
AUTH: {
|
AUTH: {
|
||||||
input: {
|
input: {
|
||||||
@ -508,8 +620,12 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'socks5',
|
type: 'socks5',
|
||||||
name, server, port, username, password
|
name,
|
||||||
}
|
server,
|
||||||
|
port,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
TLS: {
|
TLS: {
|
||||||
input: {
|
input: {
|
||||||
@ -518,12 +634,16 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'socks5',
|
type: 'socks5',
|
||||||
name, server, port, username, password,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
sni,
|
sni,
|
||||||
'skip-cert-verify': true,
|
'skip-cert-verify': true,
|
||||||
tls: true
|
tls: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const SNELL = {
|
const SNELL = {
|
||||||
SIMPLE: {
|
SIMPLE: {
|
||||||
@ -532,8 +652,12 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'snell',
|
type: 'snell',
|
||||||
name, server, port, psk: password, version: 3
|
name,
|
||||||
}
|
server,
|
||||||
|
port,
|
||||||
|
psk: password,
|
||||||
|
version: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
OBFS_HTTP: {
|
OBFS_HTTP: {
|
||||||
input: {
|
input: {
|
||||||
@ -541,13 +665,17 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'snell',
|
type: 'snell',
|
||||||
name, server, port, psk: password, version: 3,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
psk: password,
|
||||||
|
version: 3,
|
||||||
'obfs-opts': {
|
'obfs-opts': {
|
||||||
mode: 'http',
|
mode: 'http',
|
||||||
host: obfs_host,
|
host: obfs_host,
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
OBFS_TLS: {
|
OBFS_TLS: {
|
||||||
input: {
|
input: {
|
||||||
@ -555,18 +683,29 @@ function createTestCases() {
|
|||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
type: 'snell',
|
type: 'snell',
|
||||||
name, server, port, psk: password, version: 3,
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
psk: password,
|
||||||
|
version: 3,
|
||||||
'obfs-opts': {
|
'obfs-opts': {
|
||||||
mode: 'tls',
|
mode: 'tls',
|
||||||
host: obfs_host,
|
host: obfs_host,
|
||||||
path: obfs_path,
|
path: obfs_path,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
SS, SSR, VMESS, VLESS, TROJAN, HTTP, SOCKS5, SNELL,
|
SS,
|
||||||
|
SSR,
|
||||||
|
VMESS,
|
||||||
|
VLESS,
|
||||||
|
TROJAN,
|
||||||
|
HTTP,
|
||||||
|
SOCKS5,
|
||||||
|
SNELL,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createTestCases();
|
export default createTestCases();
|
@ -1,4 +1,4 @@
|
|||||||
import { HTTP } from '../vendor/open-api';
|
import { HTTP } from '@/vendor/open-api';
|
||||||
|
|
||||||
const cache = new Map();
|
const cache = new Map();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HTTP } from '../vendor/open-api';
|
import { HTTP } from '@/vendor/open-api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gist backup
|
* Gist backup
|
||||||
|
4
backend/sub-store.min.js
vendored
4
backend/sub-store.min.js
vendored
@ -6,8 +6,8 @@
|
|||||||
* ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗
|
* ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗
|
||||||
* ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
* ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
|
||||||
* Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket!
|
* Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket!
|
||||||
* @updated: 2022/6/16 12:57:15
|
* @updated: 2022/6/16 14:23:56
|
||||||
* @version: 2.0
|
* @version: 2.0.1
|
||||||
* @author: Peng-YM
|
* @author: Peng-YM
|
||||||
* @github: https://github.com/Peng-YM/Sub-Store
|
* @github: https://github.com/Peng-YM/Sub-Store
|
||||||
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
||||||
|
Loading…
x
Reference in New Issue
Block a user