Bug Fixed for reording multiple processors

This commit is contained in:
Peng-YM 2020-09-04 15:05:25 +08:00
parent 2e758ec7c8
commit 3ed39271b1
4 changed files with 144 additions and 89 deletions

View File

@ -22,9 +22,8 @@
<list default="true" id="8b97a098-48b2-4e64-a9ef-522fe2d30b52" name="Default Changelist" comment="">
<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/src/components/RegexFilter.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/components/RegexFilter.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../web/src/components/ScriptFilter.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/components/ScriptFilter.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../web/src/components/ScriptOperator.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/components/ScriptOperator.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../web/src/views/SubEditor.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/views/SubEditor.vue" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -52,6 +51,7 @@
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="restartRequiresConfirmation" value="false" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RunManager">
@ -104,6 +104,7 @@
<workItem from="1599108801252" duration="5007000" />
<workItem from="1599123166646" duration="2000" />
<workItem from="1599123176701" duration="51000" />
<workItem from="1599137069057" duration="3450000" />
</task>
<servers />
</component>
@ -123,55 +124,55 @@
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state width="1322" height="302" key="GridCell.Tab.0.bottom" timestamp="1599121249077">
<state width="1322" height="340" key="GridCell.Tab.0.bottom" timestamp="1599203090695">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.0.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358068" />
<state width="850" height="374" key="GridCell.Tab.0.bottom/51.23.1741.1097@51.23.1741.1097" timestamp="1598805773766" />
<state width="849" height="374" key="GridCell.Tab.0.bottom/53.23.1739.1097@53.23.1739.1097" timestamp="1598865052766" />
<state width="850" height="374" key="GridCell.Tab.0.bottom/55.23.1737.1097@55.23.1737.1097" timestamp="1598850298702" />
<state width="1322" height="340" key="GridCell.Tab.0.bottom/55.23.1737.1097@55.23.1737.1097" timestamp="1599197609082" />
<state width="849" height="374" key="GridCell.Tab.0.bottom/60.23.1732.1097@60.23.1732.1097" timestamp="1598872847575" />
<state width="849" height="374" key="GridCell.Tab.0.bottom/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992684" />
<state width="840" height="374" key="GridCell.Tab.0.bottom/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.0.bottom/70.23.1722.1097@70.23.1722.1097" timestamp="1598946266532" />
<state width="1322" height="302" key="GridCell.Tab.0.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249077" />
<state width="1322" height="302" key="GridCell.Tab.0.center" timestamp="1599121249077">
<state width="1322" height="340" key="GridCell.Tab.0.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090695" />
<state width="1322" height="340" key="GridCell.Tab.0.center" timestamp="1599203090694">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.0.center/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358067" />
<state width="850" height="374" key="GridCell.Tab.0.center/51.23.1741.1097@51.23.1741.1097" timestamp="1598805773766" />
<state width="849" height="374" key="GridCell.Tab.0.center/53.23.1739.1097@53.23.1739.1097" timestamp="1598865052765" />
<state width="850" height="374" key="GridCell.Tab.0.center/55.23.1737.1097@55.23.1737.1097" timestamp="1598850298701" />
<state width="1322" height="340" key="GridCell.Tab.0.center/55.23.1737.1097@55.23.1737.1097" timestamp="1599197609081" />
<state width="849" height="374" key="GridCell.Tab.0.center/60.23.1732.1097@60.23.1732.1097" timestamp="1598872847574" />
<state width="849" height="374" key="GridCell.Tab.0.center/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992684" />
<state width="840" height="374" key="GridCell.Tab.0.center/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.0.center/70.23.1722.1097@70.23.1722.1097" timestamp="1598946266532" />
<state width="1322" height="302" key="GridCell.Tab.0.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249077" />
<state width="1322" height="302" key="GridCell.Tab.0.left" timestamp="1599121249077">
<state width="1322" height="340" key="GridCell.Tab.0.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090694" />
<state width="1322" height="340" key="GridCell.Tab.0.left" timestamp="1599203090694">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.0.left/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358067" />
<state width="850" height="374" key="GridCell.Tab.0.left/51.23.1741.1097@51.23.1741.1097" timestamp="1598805773765" />
<state width="849" height="374" key="GridCell.Tab.0.left/53.23.1739.1097@53.23.1739.1097" timestamp="1598865052763" />
<state width="850" height="374" key="GridCell.Tab.0.left/55.23.1737.1097@55.23.1737.1097" timestamp="1598850298699" />
<state width="1322" height="340" key="GridCell.Tab.0.left/55.23.1737.1097@55.23.1737.1097" timestamp="1599197609081" />
<state width="849" height="374" key="GridCell.Tab.0.left/60.23.1732.1097@60.23.1732.1097" timestamp="1598872847574" />
<state width="849" height="374" key="GridCell.Tab.0.left/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992683" />
<state width="840" height="374" key="GridCell.Tab.0.left/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.0.left/70.23.1722.1097@70.23.1722.1097" timestamp="1598946266531" />
<state width="1322" height="302" key="GridCell.Tab.0.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249077" />
<state width="1322" height="302" key="GridCell.Tab.0.right" timestamp="1599121249077">
<state width="1322" height="340" key="GridCell.Tab.0.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090694" />
<state width="1322" height="340" key="GridCell.Tab.0.right" timestamp="1599203090694">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.0.right/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358068" />
<state width="850" height="374" key="GridCell.Tab.0.right/51.23.1741.1097@51.23.1741.1097" timestamp="1598805773766" />
<state width="849" height="374" key="GridCell.Tab.0.right/53.23.1739.1097@53.23.1739.1097" timestamp="1598865052766" />
<state width="850" height="374" key="GridCell.Tab.0.right/55.23.1737.1097@55.23.1737.1097" timestamp="1598850298701" />
<state width="1322" height="340" key="GridCell.Tab.0.right/55.23.1737.1097@55.23.1737.1097" timestamp="1599197609082" />
<state width="849" height="374" key="GridCell.Tab.0.right/60.23.1732.1097@60.23.1732.1097" timestamp="1598872847575" />
<state width="849" height="374" key="GridCell.Tab.0.right/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992684" />
<state width="840" height="374" key="GridCell.Tab.0.right/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.0.right/70.23.1722.1097@70.23.1722.1097" timestamp="1598946266532" />
<state width="1322" height="302" key="GridCell.Tab.0.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249077" />
<state width="1322" height="302" key="GridCell.Tab.1.bottom" timestamp="1599121249078">
<state width="1322" height="340" key="GridCell.Tab.0.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090694" />
<state width="1322" height="577" key="GridCell.Tab.1.bottom" timestamp="1599203090628">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.1.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358069" />
@ -182,8 +183,8 @@
<state width="849" height="374" key="GridCell.Tab.1.bottom/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992587" />
<state width="840" height="374" key="GridCell.Tab.1.bottom/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="840" height="374" key="GridCell.Tab.1.bottom/70.23.1722.1097@70.23.1722.1097" timestamp="1598932593853" />
<state width="1322" height="302" key="GridCell.Tab.1.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249078" />
<state width="1322" height="302" key="GridCell.Tab.1.center" timestamp="1599121249078">
<state width="1322" height="577" key="GridCell.Tab.1.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090628" />
<state width="1322" height="577" key="GridCell.Tab.1.center" timestamp="1599203090628">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.1.center/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358069" />
@ -194,8 +195,8 @@
<state width="849" height="374" key="GridCell.Tab.1.center/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992587" />
<state width="840" height="374" key="GridCell.Tab.1.center/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.1.center/70.23.1722.1097@70.23.1722.1097" timestamp="1598932593853" />
<state width="1322" height="302" key="GridCell.Tab.1.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249078" />
<state width="1322" height="302" key="GridCell.Tab.1.left" timestamp="1599121249077">
<state width="1322" height="577" key="GridCell.Tab.1.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090628" />
<state width="1322" height="577" key="GridCell.Tab.1.left" timestamp="1599203090627">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.1.left/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358069" />
@ -206,8 +207,8 @@
<state width="849" height="374" key="GridCell.Tab.1.left/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992587" />
<state width="840" height="374" key="GridCell.Tab.1.left/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.1.left/70.23.1722.1097@70.23.1722.1097" timestamp="1598932593852" />
<state width="1322" height="302" key="GridCell.Tab.1.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249077" />
<state width="1322" height="302" key="GridCell.Tab.1.right" timestamp="1599121249078">
<state width="1322" height="577" key="GridCell.Tab.1.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090627" />
<state width="1322" height="577" key="GridCell.Tab.1.right" timestamp="1599203090628">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.1.right/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358069" />
@ -218,8 +219,8 @@
<state width="849" height="374" key="GridCell.Tab.1.right/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992587" />
<state width="840" height="374" key="GridCell.Tab.1.right/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305944" />
<state width="840" height="374" key="GridCell.Tab.1.right/70.23.1722.1097@70.23.1722.1097" timestamp="1598932593853" />
<state width="1322" height="302" key="GridCell.Tab.1.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249078" />
<state width="1322" height="302" key="GridCell.Tab.2.bottom" timestamp="1599121249079">
<state width="1322" height="577" key="GridCell.Tab.1.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090628" />
<state width="1322" height="577" key="GridCell.Tab.2.bottom" timestamp="1599203090629">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.2.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358071" />
@ -230,8 +231,8 @@
<state width="849" height="374" key="GridCell.Tab.2.bottom/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.2.bottom/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.2.bottom/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659637" />
<state width="1322" height="302" key="GridCell.Tab.2.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249079" />
<state width="1322" height="302" key="GridCell.Tab.2.center" timestamp="1599121249079">
<state width="1322" height="577" key="GridCell.Tab.2.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090629" />
<state width="1322" height="577" key="GridCell.Tab.2.center" timestamp="1599203090629">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.2.center/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358070" />
@ -242,8 +243,8 @@
<state width="849" height="374" key="GridCell.Tab.2.center/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.2.center/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.2.center/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659636" />
<state width="1322" height="302" key="GridCell.Tab.2.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249079" />
<state width="1322" height="302" key="GridCell.Tab.2.left" timestamp="1599121249078">
<state width="1322" height="577" key="GridCell.Tab.2.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090629" />
<state width="1322" height="577" key="GridCell.Tab.2.left" timestamp="1599203090628">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.2.left/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358070" />
@ -254,8 +255,8 @@
<state width="849" height="374" key="GridCell.Tab.2.left/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992587" />
<state width="840" height="374" key="GridCell.Tab.2.left/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.2.left/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659636" />
<state width="1322" height="302" key="GridCell.Tab.2.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249078" />
<state width="1322" height="302" key="GridCell.Tab.2.right" timestamp="1599121249079">
<state width="1322" height="577" key="GridCell.Tab.2.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090628" />
<state width="1322" height="577" key="GridCell.Tab.2.right" timestamp="1599203090629">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.2.right/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358070" />
@ -266,8 +267,8 @@
<state width="849" height="374" key="GridCell.Tab.2.right/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.2.right/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.2.right/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659636" />
<state width="1322" height="302" key="GridCell.Tab.2.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249079" />
<state width="1322" height="302" key="GridCell.Tab.3.bottom" timestamp="1599121249080">
<state width="1322" height="577" key="GridCell.Tab.2.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090629" />
<state width="1322" height="577" key="GridCell.Tab.3.bottom" timestamp="1599203090630">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.3.bottom/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358072" />
@ -278,8 +279,8 @@
<state width="849" height="374" key="GridCell.Tab.3.bottom/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.3.bottom/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305946" />
<state width="1300" height="374" key="GridCell.Tab.3.bottom/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659637" />
<state width="1322" height="302" key="GridCell.Tab.3.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249080" />
<state width="1322" height="302" key="GridCell.Tab.3.center" timestamp="1599121249080">
<state width="1322" height="577" key="GridCell.Tab.3.bottom/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090630" />
<state width="1322" height="577" key="GridCell.Tab.3.center" timestamp="1599203090630">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.3.center/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358071" />
@ -290,8 +291,8 @@
<state width="849" height="374" key="GridCell.Tab.3.center/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.3.center/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.3.center/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659637" />
<state width="1322" height="302" key="GridCell.Tab.3.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249080" />
<state width="1322" height="302" key="GridCell.Tab.3.left" timestamp="1599121249079">
<state width="1322" height="577" key="GridCell.Tab.3.center/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090630" />
<state width="1322" height="577" key="GridCell.Tab.3.left" timestamp="1599203090629">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.3.left/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358071" />
@ -302,8 +303,8 @@
<state width="849" height="374" key="GridCell.Tab.3.left/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.3.left/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305945" />
<state width="1300" height="374" key="GridCell.Tab.3.left/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659637" />
<state width="1322" height="302" key="GridCell.Tab.3.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249079" />
<state width="1322" height="302" key="GridCell.Tab.3.right" timestamp="1599121249080">
<state width="1322" height="577" key="GridCell.Tab.3.left/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090629" />
<state width="1322" height="577" key="GridCell.Tab.3.right" timestamp="1599203090630">
<screen x="70" y="23" width="2490" height="1417" />
</state>
<state width="840" height="374" key="GridCell.Tab.3.right/0.0.1792.1120@0.0.1792.1120" timestamp="1598115358072" />
@ -314,7 +315,7 @@
<state width="849" height="374" key="GridCell.Tab.3.right/62.23.1730.1097@62.23.1730.1097" timestamp="1598899992588" />
<state width="840" height="374" key="GridCell.Tab.3.right/67.23.1725.1097@67.23.1725.1097" timestamp="1598947305946" />
<state width="1300" height="374" key="GridCell.Tab.3.right/70.23.1722.1097@70.23.1722.1097" timestamp="1598931659637" />
<state width="1322" height="302" key="GridCell.Tab.3.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599121249080" />
<state width="1322" height="577" key="GridCell.Tab.3.right/70.23.2490.1417@70.23.2490.1417" timestamp="1599203090630" />
<state x="161" y="268" width="670" height="676" key="search.everywhere.popup" timestamp="1598787117227">
<screen x="53" y="23" width="1739" height="1097" />
</state>

View File

@ -8,7 +8,7 @@
* 2. 节点过滤重命名排序等
* 3. 订阅拆分组合
*/
const $ = API("sub-store", true);
const $ = API("sub-store");
const $app = express();
$.http = HTTP({
@ -45,7 +45,7 @@ if (!$.read(SUBS_KEY)) $.write({}, SUBS_KEY);
if (!$.read(COLLECTIONS_KEY)) $.write({}, COLLECTIONS_KEY);
// BACKEND API
$.log("Initializing Express...");
$.info("Initializing Express...");
// download
$app.get("/download/collection/:name", downloadCollection);
@ -76,7 +76,7 @@ $app.all("/", async (req, res) => {
res.send("Hello from Sub-Store! Made with ❤️ by Peng-YM.");
});
$.log("Express initialized");
$.info("Express initialized");
$app.start();
/**************************** API -- Subscriptions ***************************************/
@ -151,13 +151,13 @@ async function parseSub(sub, platform) {
$.write(raw, `#${sub.url}`);
}
$.log(
$.info(
"======================================================================="
);
$.log(
$.info(
`Processing subscription: ${sub.name}, target platform ==> ${platform}.`
);
$.log(`Initializing parsers...`);
$.info(`Initializing parsers...`);
const $parser = ProxyParser(platform);
// Parsers
$parser.addParsers([
@ -186,7 +186,7 @@ async function parseSub(sub, platform) {
Surge_Http,
]);
$.log(`Parsers initialized.`);
$.info(`Parsers initialized.`);
let proxies = $parser.parse(raw);
// filters
@ -195,12 +195,13 @@ async function parseSub(sub, platform) {
const $operator = ProxyOperator();
for (const item of sub.process || []) {
let script;
// process script
if (item.type.indexOf("Script") !== -1) {
const {mode, content} = item.args;
if (mode === "link") {
// if this is remote script, download it
item.args = await $.http
script = await $.http
.get(content)
.then((resp) => resp.body)
.catch((err) => {
@ -209,30 +210,49 @@ async function parseSub(sub, platform) {
);
});
} else {
item.args = content;
script = content;
}
}
if (item.type.indexOf("Filter") !== -1) {
const filter = AVAILABLE_FILTERS[item.type];
if (filter) {
$filter.setFilter(filter(item.args));
proxies = $filter.process(proxies);
$.log(
$.info(
`Applying filter "${item.type}" with arguments:\n >>> ${
JSON.stringify(item.args) || "None"
}`
);
if (item.type.indexOf("Script") !== -1) {
$filter.setFilter(filter(script));
} else {
$filter.setFilter(filter(item.args));
}
try {
proxies = $filter.process(proxies);
} catch (err) {
$.error(
`Failed to apply filter "${item.type}"!\n REASON: ${err}`
);
}
}
} else if (item.type.indexOf("Operator") !== -1) {
const operator = AVAILABLE_OPERATORS[item.type];
if (operator) {
$operator.setOperator(operator(item.args));
proxies = $operator.process(proxies);
$.log(
$.info(
`Applying operator "${item.type}" with arguments: \n >>> ${
item.args || "None"
JSON.stringify(item.args) || "None"
}`
);
if (item.type.indexOf("Script") !== -1) {
$operator.setOperator(operator(script));
} else {
$operator.setOperator(operator(item.args));
}
try {
proxies = $operator.process(proxies);
} catch (err) {
`Failed to apply operator "${item.type}"!\n REASON: ${err}`
}
}
}
}
@ -330,7 +350,7 @@ async function newSub(req, res) {
async function updateSub(req, res) {
const {name} = req.params;
$.log(`Updating subscription: ${name}`);
$.info(`Updating subscription: ${name}`);
let sub = req.body;
const allSubs = $.read(SUBS_KEY);
if (allSubs[name]) {
@ -528,7 +548,7 @@ function ProxyParser(targetPlatform) {
function addParsers(args) {
args.forEach((a) => parsers.push(a()));
$.log(`${args.length} parser added.`);
$.info(`${args.length} parser added.`);
}
function addProducers(args) {
@ -2557,7 +2577,7 @@ function express(port = 3000) {
// adapter
app.start = () => {
app.listen(port, () => {
$.log(`Express started on port: ${port}`);
$.info(`Express started on port: ${port}`);
});
};
return app;
@ -2581,8 +2601,6 @@ function express(port = 3000) {
// dispatch url to route
const dispatch = (request, start = 0) => {
let {method, url, headers, body} = request;
console.log("DISPATCHING: " + method + ": " + url);
if (/json/i.test(headers["Content-Type"])) {
body = JSON.parse(body);
}
@ -2657,7 +2675,6 @@ function express(port = 3000) {
// start service
app.start = () => {
console.log(`STARTING TO ROUTE: ${JSON.stringify($request)}`);
dispatch($request);
};

View File

@ -2,7 +2,7 @@
<v-card class="ml-1 mr-1 mb-1 mt-1">
<v-card-title>
<v-icon left color="primary">code</v-icon>
脚本过滤器
脚本操作
<v-spacer></v-spacer>
<v-btn icon @click="$emit('up', idx)">
<v-icon>keyboard_arrow_up</v-icon>

View File

@ -139,9 +139,9 @@
</v-subheader>
<v-divider></v-divider>
<component v-for="(p, idx) in processors"
<component v-for="p in processors"
:is="p.component"
:key="idx"
:key="p.id"
:args="p.args"
@dataChanged="dataChanged"
@deleteProcess="deleteProcess"
@ -258,15 +258,17 @@ export default {
udp: "DEFAULT",
scert: "DEFAULT",
tfo: "DEFAULT",
process: [],
}
},
process: [],
}
},
created() {
const name = this.$route.params.name;
const sub = (typeof name === 'undefined' || name === 'UNTITLED') ? {} : this.$store.state.subscriptions[name];
this.$store.commit("SET_NAV_TITLE", sub.name ? `订阅编辑 -- ${sub.name}` : "新建订阅");
this.options = loadSubscription(this.options, sub);
const {options, process} = loadSubscription(this.options, sub);
this.options = options;
this.process = process;
},
computed: {
availableProcessors() {
@ -274,10 +276,11 @@ export default {
},
processors() {
return this.options.process.map(p => {
return this.process.map(p => {
return {
component: AVAILABLE_PROCESSORS[p.type].component,
args: p.args
args: p.args,
id: p.id
}
});
}
@ -285,21 +288,21 @@ export default {
methods: {
save() {
if (this.options.name && this.options.url) {
const sub = buildSubscription(this.options);
const sub = buildSubscription(this.options, this.process);
if (this.$route.params.name !== "UNTITLED") {
this.$store.dispatch("UPDATE_SUBSCRIPTION", {
name: this.$route.params.name,
sub
}).then(() => {
showInfo(`成功保存订阅:${this.options.name}`)
showInfo(`成功保存订阅:${this.options.name}`);
}).catch(() => {
showError(`发生错误,无法保存订阅!`)
showError(`发生错误,无法保存订阅!`);
});
} else {
this.$store.dispatch("NEW_SUBSCRIPTION", sub).then(() => {
showInfo(`成功创建订阅:${this.options.name}`)
showInfo(`成功创建订阅:${this.options.name}`);
}).catch(() => {
showError(`发生错误,无法创建订阅!`)
showError(`发生错误,无法创建订阅!`);
});
}
}
@ -310,30 +313,55 @@ export default {
},
dataChanged(content) {
const process = this.options.process[content.idx];
process.args = content.args;
this.options.process.splice(content.idx, 1, process);
let index = 0;
for (; index < this.process[index].length; index++) {
if (this.process.id === content.idx) {
break;
}
}
this.process[index].args = content.args;
},
addProcess(type) {
this.options.process.push({type});
this.process.push({type, id: uuidv4()});
this.dialog = false;
},
deleteProcess(key) {
this.options.process.splice(key, 1);
deleteProcess(id) {
let index = 0;
for (; index < this.process[index].length; index++) {
if (this.process.id === id) {
break;
}
}
this.process.splice(index, 1);
},
moveUp(index) {
moveUp(id) {
let index = 0;
for (; index < this.process.length; index++) {
if (this.process[index].id === id) {
break;
}
}
if (index === 0) return;
// otherwise swap with previous one
this.options.process.splice(index - 1, 2, this.options.process[index], this.options.process[index - 1]);
const prev = this.process[index - 1];
const cur = this.process[index];
this.process.splice(index - 1, 2, cur, prev);
},
moveDown(index) {
if (index === this.options.process.length) return;
moveDown(id) {
let index = 0;
for (; index < this.process.length; index++) {
if (this.process[index].id === id) {
break;
}
}
// otherwise swap with latter one
this.options.process.splice(index, 2, this.options.process[index + 1], this.options.process[index]);
const cur = this.process[index];
const next = this.process[index + 1]
this.process.splice(index, 2, next, cur);
}
}
}
@ -343,8 +371,9 @@ function loadSubscription(options, sub) {
...options,
name: sub.name,
url: sub.url,
process: []
}
let process = []
// flag
for (const p of (sub.process || [])) {
switch (p.type) {
@ -355,13 +384,14 @@ function loadSubscription(options, sub) {
options[p.args.key] = p.args.value ? "FORCE_OPEN" : "FORCE_CLOSE";
break
default:
options.process.push(p);
p.id = uuidv4();
process.push(p);
}
}
return options;
return {options, process};
}
function buildSubscription(options) {
function buildSubscription(options, process) {
const sub = {
name: options.name,
url: options.url,
@ -382,11 +412,18 @@ function buildSubscription(options) {
});
}
}
for (const p of options.process) {
for (const p of process) {
sub.process.push(p);
}
return sub;
}
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
</script>
<style>