From bff31187d8ac32bdc3a006ebf0b3da901ebc7517 Mon Sep 17 00:00:00 2001
From: Peng-YM <1048217874pengym@gmail.com>
Date: Mon, 31 Aug 2020 00:15:48 +0800
Subject: [PATCH] =?UTF-8?q?[Bug=20Fixed]=20=E4=BF=AE=E5=A4=8DLoon=20VMess?=
=?UTF-8?q?=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/.idea/workspace.xml | 70 +++++++++++++++++++------------------
backend/sub-store.js | 11 +++---
web/src/views/SubEditor.vue | 12 ++++++-
3 files changed, 52 insertions(+), 41 deletions(-)
diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml
index b83ab25..6c01522 100644
--- a/backend/.idea/workspace.xml
+++ b/backend/.idea/workspace.xml
@@ -20,7 +20,9 @@
-
+
+
+
@@ -78,7 +80,7 @@
-
+
@@ -98,161 +100,161 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/backend/sub-store.js b/backend/sub-store.js
index 787e091..34a8c95 100644
--- a/backend/sub-store.js
+++ b/backend/sub-store.js
@@ -12,6 +12,7 @@ const $ = API("sub-store", true);
// Constants
const SUBS_KEY = "subs";
const COLLECTIONS_KEY = "collections";
+const RESOURCE_CACHE_KEY = "resources";
// SOME INITIALIZATIONS
if (!$.read(SUBS_KEY)) $.write({}, SUBS_KEY);
@@ -96,7 +97,7 @@ async function refreshResource(req, res) {
message: `Cannot refresh remote resource: ${url}\n Reason: ${err}`
});
});
- $.write(cachedResources, cachedResources);
+ $.write(cachedResources, RESOURCE_CACHE_KEY);
res.json({
status: "success"
});
@@ -105,7 +106,7 @@ async function refreshResource(req, res) {
// download subscription, for APP only
async function downloadSub(req, res) {
const {name} = req.params;
- const platform = getPlatformFromHeaders(req.headers);
+ const platform = req.query.target || getPlatformFromHeaders(req.headers);
const allSubs = $.read(SUBS_KEY);
if (allSubs[name]) {
const sub = allSubs[name];
@@ -127,13 +128,11 @@ async function downloadSub(req, res) {
}
async function parseSub(sub, platform) {
-
// always download from url
const raw = await $.http.get(sub.url).then(resp => resp.body).catch(err => {
throw new Error(err);
});
-
$.log("=======================================================================");
$.log(`Processing subscription: ${sub.name}, target platform ==> ${platform}.`);
$.log(`Initializing parser...`);
@@ -1325,14 +1324,14 @@ function Loon_Producer() {
obfs_opts = "";
if (proxy.network === 'ws') {
const host = proxy['ws-headers'].Host;
- obfs_opts = `,transport:ws,host:${host},path:${proxy['ws-path']}`;
+ obfs_opts = `,transport:ws,host:${host},path:${proxy['ws-path'] || "/"}`;
} else {
obfs_opts = `,transport:tcp`;
}
if (proxy.tls) {
obfs_opts += `,tls-name=${proxy.sni},skip-cert-verify:${proxy.scert}`;
}
- return `${proxy.name}=vmess,${proxy.server},${proxy.port},${proxy.cipher},over-tls:${proxy.tls}${obfs_opts}`;
+ return `${proxy.name}=vmess,${proxy.server},${proxy.port},${proxy.cipher === 'auto' ? 'none' : proxy.cipher},"${proxy.uuid}"over-tls:${proxy.tls}${obfs_opts}`;
case "trojan":
return `${proxy.name}=trojan,${proxy.server},${proxy.port},${proxy.password},tls-name:${proxy.sni},skip-cert-verify:${proxy.scert}`;
case "http":
diff --git a/web/src/views/SubEditor.vue b/web/src/views/SubEditor.vue
index 7b82193..270c647 100644
--- a/web/src/views/SubEditor.vue
+++ b/web/src/views/SubEditor.vue
@@ -137,6 +137,8 @@