diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml
index d6fa6b7..d5f5bf9 100644
--- a/backend/.idea/workspace.xml
+++ b/backend/.idea/workspace.xml
@@ -20,7 +20,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -52,6 +65,8 @@
1597827738046
+
+
@@ -68,5 +83,6 @@
+
\ No newline at end of file
diff --git a/backend/sub-store.js b/backend/sub-store.js
index f30172a..3e65322 100644
--- a/backend/sub-store.js
+++ b/backend/sub-store.js
@@ -123,6 +123,7 @@ async function parseSub(sub, platform) {
const $operator = ProxyOperator();
for (const item of sub.process || []) {
+ // process script
if (item.type.indexOf("Script") !== -1) {
if (item.args && item.args[0].indexOf("http") !== -1) {
// if this is remote script
@@ -201,7 +202,9 @@ async function updateSub(req, res) {
...allSubs[name],
...sub
};
- allSubs[name] = newSub;
+ // allow users to update the subscription name
+ delete allSubs[name];
+ allSubs[sub.name || name] = newSub;
$.write(allSubs, SUBS_KEY);
res.json({
status: "success",
@@ -316,7 +319,9 @@ async function updateCollection(req, res) {
...allCol[name],
...collection
};
- allCol[name] = newCol;
+ // allow users to update collection name
+ delete allCol[name];
+ allCol[collection.name || name] = newCol;
$.write(allCol, COLLECTIONS_KEY);
res.json({
status: "success",
@@ -1489,6 +1494,15 @@ function ScriptOperator(script) {
name: "Script Operator",
func: (proxies) => {
;(function () {
+ // interface to get internal operators
+ const $get = (name, args) => {
+ const operator = AVAILABLE_OPERATORS[name];
+ if (operator) {
+ return operator(args).func;
+ } else {
+ throw new Error(`No operator named ${name} is found!`);
+ }
+ };
eval(script);
return func(proxies);
})();
@@ -1588,15 +1602,24 @@ function TypeFilter(...types) {
}
WARNING:
1. This function name should be `func`!
- 2. Always declare variable before using it!
+ 2. Always declare variables before using them!
*/
function ScriptFilter(script) {
return {
name: "Script Filter",
func: (proxies) => {
!(function () {
+ // interface to get internal filters
+ const $get = (name, args) => {
+ const filter = AVAILABLE_FILTERS[name];
+ if (filter) {
+ return filter(args).func;
+ } else {
+ throw new Error(`No filter named ${name} is found!`);
+ }
+ };
eval(script);
- return filter(proxies);
+ return func(proxies);
})();
}
}
diff --git a/web/package-lock.json b/web/package-lock.json
index cb8a818..a4f62b2 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -11114,6 +11114,11 @@
}
}
},
+ "vue-router": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz",
+ "integrity": "sha512-BADg1mjGWX18Dpmy6bOGzGNnk7B/ZA0RxuA6qedY/YJwirMfKXIDzcccmHbQI0A6k5PzMdMloc0ElHfyOoX35A=="
+ },
"vue-style-loader": {
"version": "4.1.2",
"resolved": "https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.2.tgz",
diff --git a/web/package.json b/web/package.json
index 987491f..357116d 100644
--- a/web/package.json
+++ b/web/package.json
@@ -13,6 +13,7 @@
"lodash": "^4.17.20",
"material-design-icons-iconfont": "^5.0.1",
"vue": "^2.6.11",
+ "vue-router": "^3.4.3",
"vuetify": "^2.2.11"
},
"devDependencies": {
diff --git a/web/src/App.vue b/web/src/App.vue
index 1db3065..73f9289 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -1,6 +1,9 @@
+
+
+
@@ -15,16 +18,15 @@ export default {
BottomNav
},
- props: {
- source: String,
- },
-
- data: () => ({
- drawer: null,
- }),
-
created() {
- this.$vuetify.theme.dark = true
+ this.$vuetify.theme.dark = true;
+ this.$vuetify.theme.themes.dark.primary = '#d02f2f';
},
+
+ computed: {
+ isDarkMode() {
+ return true;
+ }
+ }
}
\ No newline at end of file
diff --git a/web/src/assets/logo.svg b/web/src/assets/logo.svg
index 145b6d1..28a0573 100644
--- a/web/src/assets/logo.svg
+++ b/web/src/assets/logo.svg
@@ -1 +1,10 @@
-
+
diff --git a/web/src/components/BottomNav.vue b/web/src/components/BottomNav.vue
index 090ca73..efb79d0 100644
--- a/web/src/components/BottomNav.vue
+++ b/web/src/components/BottomNav.vue
@@ -2,24 +2,24 @@
-
+
首页
dashboard
-
+
订阅
favorite
-
- 机场
- code
+
+ 我的
+ settings
@@ -31,7 +31,7 @@
export default {
data: () => {
return {
- activeItem: 'collection'
+ activeItem: 'subscription'
}
}
}
diff --git a/web/src/components/TopToolbar.vue b/web/src/components/TopToolbar.vue
index b7751ba..8d5909e 100644
--- a/web/src/components/TopToolbar.vue
+++ b/web/src/components/TopToolbar.vue
@@ -28,9 +28,9 @@
@@ -50,10 +50,10 @@ export default {
},
methods: {
- toggleMenu: function() {
+ toggleMenu: function () {
this.showMenu = !this.showMenu;
},
- doNothing: function() {
+ doNothing: function () {
}
}
diff --git a/web/src/main.js b/web/src/main.js
index a21e528..5a1ea5e 100644
--- a/web/src/main.js
+++ b/web/src/main.js
@@ -1,10 +1,12 @@
import Vue from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify';
+import router from './router';
Vue.config.productionTip = false
new Vue({
- vuetify,
- render: h => h(App)
+ vuetify,
+ router,
+ render: h => h(App)
}).$mount('#app')
diff --git a/web/src/plugins/vuetify.js b/web/src/plugins/vuetify.js
index 22251c3..00ba4d3 100644
--- a/web/src/plugins/vuetify.js
+++ b/web/src/plugins/vuetify.js
@@ -4,5 +4,4 @@ import 'material-design-icons-iconfont/dist/material-design-icons.css'
Vue.use(Vuetify);
-export default new Vuetify({
-});
+export default new Vuetify({});
diff --git a/web/src/router/index.js b/web/src/router/index.js
new file mode 100644
index 0000000..ddd8bb9
--- /dev/null
+++ b/web/src/router/index.js
@@ -0,0 +1,32 @@
+import Vue from 'vue';
+import Router from 'vue-router';
+
+import Subscription from "@/views/Subscription";
+import Dashboard from "@/views/Dashboard";
+import User from "@/views/User";
+
+Vue.use(Router);
+
+const router = new Router({
+ mode: "history",
+ base: process.env.BASE_URL,
+ routes: [
+ {
+ path: "/",
+ name: "subscriptions",
+ component: Subscription
+ },
+ {
+ path: "/dashboard",
+ name: "dashboard",
+ component: Dashboard
+ },
+ {
+ path: "/user",
+ name: "user",
+ component: User
+ }
+ ]
+});
+
+export default router;
\ No newline at end of file
diff --git a/web/src/views/Dashboard.vue b/web/src/views/Dashboard.vue
new file mode 100644
index 0000000..d1eae2c
--- /dev/null
+++ b/web/src/views/Dashboard.vue
@@ -0,0 +1,15 @@
+
+
+ 首页
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/src/views/Subscription.vue b/web/src/views/Subscription.vue
new file mode 100644
index 0000000..7a27b20
--- /dev/null
+++ b/web/src/views/Subscription.vue
@@ -0,0 +1,10 @@
+
+
+ 订阅
+
+
+
+
+
\ No newline at end of file
diff --git a/web/src/views/User.vue b/web/src/views/User.vue
new file mode 100644
index 0000000..f670d8f
--- /dev/null
+++ b/web/src/views/User.vue
@@ -0,0 +1,15 @@
+
+
+ 用户
+
+
+
+
+
+
\ No newline at end of file