mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-04 01:53:14 +08:00
Support remote script
This commit is contained in:
16
backend/.idea/workspace.xml
generated
16
backend/.idea/workspace.xml
generated
@@ -20,7 +20,20 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8b97a098-48b2-4e64-a9ef-522fe2d30b52" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/../web/src/router/index.js" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../web/src/views/Dashboard.vue" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../web/src/views/Subscription.vue" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../web/src/views/User.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/sub-store.js" beforeDir="false" afterPath="$PROJECT_DIR$/sub-store.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../web/package-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/../web/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/App.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/assets/logo.svg" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/assets/logo.svg" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/components/BottomNav.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/components/BottomNav.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/components/TopToolbar.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/components/TopToolbar.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/main.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/main.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/plugins/vuetify.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/plugins/vuetify.js" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -52,6 +65,8 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1597827738046</updated>
|
||||
<workItem from="1597827739128" duration="775000" />
|
||||
<workItem from="1597902241253" duration="776000" />
|
||||
<workItem from="1598004165212" duration="170000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@@ -68,5 +83,6 @@
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="oldMeFiltersMigrated" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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);
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user