mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-27 23:13:43 +00:00
Merge pull request #93 from qwerzl/master
This commit is contained in:
2 files changed
+5
-5
No files matched your search
@@ -2261,7 +2261,7 @@ var ProxyUtils = (function () {
|
||||
"🇰🇭": ["柬埔寨"],
|
||||
"🇺🇦": ["烏克蘭", "乌克兰"],
|
||||
"🇭🇷": ["克罗地亚", "HR", "克羅地亞"],
|
||||
"🇨🇦": ["Canada", "CANADA", "CAN", "Waterloo", "加拿大", "蒙特利尔", "温哥华", "楓葉", "枫叶", "滑铁卢", "多伦多"],
|
||||
"🇨🇦": ["Canada", "CANADA", "CAN", "Waterloo", "加拿大", "蒙特利尔", "温哥华", "楓葉", "枫叶", "滑铁卢", "多伦多", "CA"],
|
||||
"🇨🇭": ["瑞士", "苏黎世", "Switzerland"],
|
||||
"🇳🇬": ["尼日利亚", "NG", "尼日利亞"],
|
||||
"🇨🇿": ["Czechia", "捷克"],
|
||||
@@ -2309,7 +2309,7 @@ var ProxyUtils = (function () {
|
||||
"🇻🇪": ["VE", "委内瑞拉"],
|
||||
"🇮🇹": ["Italy", "IT", "Nachash", "意大利", "米兰", "義大利"],
|
||||
"🇿🇦": ["South Africa", "南非"],
|
||||
"🇦🇪": ["United Arab Emirates", "阿联酋", "迪拜"],
|
||||
"🇦🇪": ["United Arab Emirates", "阿联酋", "迪拜", "AE"],
|
||||
"🇧🇷": ["BR", "Brazil", "巴西", "圣保罗"],
|
||||
"🇯🇵": ["JP", "Japan", "JAPAN", "日本", "东京", "大阪", "埼玉", "沪日", "穗日", "川日", "中日", "泉日", "杭日", "深日", "辽日", "广日"],
|
||||
"🇦🇷": ["AR", "阿根廷"],
|
||||
@@ -8289,4 +8289,4 @@ function ResourceDownloader() {
|
||||
return {
|
||||
download
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -1,2 +1,2 @@
|
||||
// UPDATED AT: 2022年 5月18日 星期三 19时19分13秒 CST
|
||||
const $=API("sub-store"),Base64=new Base64Code,$downloader=new ResourceDownloader;function service(){console.log("\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 © 𝑷𝒆𝒏𝒈-𝒀𝑴\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n");const e=express(),t="settings",n="subs",r="collections",s="rules",o="builtin",i="artifacts",a="Auto Generated Sub-Store Backup",c="Sub-Store",l="Sub-Store Artifacts Repository";async function p(e){const{gistToken:n}=$.read(t);return n?new Gist({token:n,key:l}).upload(e):Promise.reject("未设置Gist Token!")}async function u(e){const{headers:t}=await $.http.get({url:e,headers:{"User-Agent":"Quantumult/1.0.13 (iPhone10,3; iOS 14.0)"}});return t[Object.keys(t).filter(e=>/SUBSCRIPTION-USERINFO/i.test(e))[0]]}function f(e){const t=Object.keys(e);let n="";for(let r of t)if(/USER-AGENT/i.test(r)){n=e[r];break}return-1!==n.indexOf("Quantumult%20X")?"QX":-1!==n.indexOf("Surge")?"Surge":-1!==n.indexOf("Decar")||-1!==n.indexOf("Loon")?"Loon":-1!==n.indexOf("Stash")||-1!==n.indexOf("Shadowrocket")?"Clash":null}async function d({type:e,item:t,platform:r,noProcessor:s}={platform:"JSON",noProcessor:!1}){if("subscription"===e){const e=t,n=await $downloader.download(e.url,e.ua);let o=ProxyUtils.parse(n);s||(o=await ProxyUtils.process(o,e.process||[],r));const i={};return o.forEach(e=>{i[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(o,r)}if("collection"===e){const e=$.read(n),o=t,i=o.subscriptions;let a=[],c=0;if(await Promise.all(i.map(async t=>{const n=e[t];try{$.info(`正在处理子订阅:${n.name}...`);const e=await $downloader.download(n.url,n.ua);let t=ProxyUtils.parse(e);s||(t=await ProxyUtils.process(t,n.process||[],r)),a=a.concat(t),c++,$.info(`✅ 子订阅:${n.name}加载成功,进度--${100*(c/i.length).toFixed(1)}% `)}catch(e){c++,$.error(`❌ 处理组合订阅中的子订阅: ${n.name}时出现错误:${e},该订阅已被跳过!进度--${100*(c/i.length).toFixed(1)}%`)}})),s||(a=await ProxyUtils.process(a,o.process||[],r)),0===a.length)throw new Error("组合订阅中不含有效节点!");const l={};return a.forEach(e=>{l[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(a,r)}if("rule"===e){const e=t;let n=[];for(let t=0;t<e.urls.length;t++){const r=e.urls[t];$.info(`正在处理URL:${r},进度--${100*((t+1)/e.urls.length).toFixed(1)}% `);try{const{body:e}=await $downloader.download(r),t=RuleUtils.parse(e);n=n.concat(t)}catch(e){$.error(`处理分流订阅中的URL: ${r}时出现错误:${e}! 该订阅已被跳过。`)}}return n=await RuleUtils.process(n,[{type:"Remove Duplicate Filter"}]),RuleUtils.produce(n,r)}}$.read(n)||$.write({},n),$.read(r)||$.write({},r),$.read(t)||$.write({},t),$.read(s)||$.write({},s),$.read(i)||$.write({},i),$.write({rules:getBuiltInRules()},o),e.get("/download/collection/:name",async function(e,t){const{name:s}=e.params,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON",a=$.read(r)[s];$.info(`正在下载组合订阅:${s}`);const c=$.read(n),l=a.subscriptions;if(l.length>0){const e=c[l[0]],n=await u(e.url);n&&t.set("subscription-userinfo",n)}if(a)try{const e=await d({type:"collection",item:a,platform:i,noProcessor:o});"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 下载组合订阅错误:${s}!`,`🤔 原因:${e}`),t.status(500).json({status:"failed",message:e})}else $.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 未找到组合订阅:${s}!`),t.status(404).json({status:"failed"})}),e.get("/download/:name",async function(e,t){const{name:r}=e.params,{cache:s}=e.query,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON";$.info(`正在下载订阅:${r}`);const a=$.read(n)[r];if(a)try{const e=await d({type:"subscription",item:a,platform:i,noProcessor:o}),n=await u(a.url);n&&t.set("subscription-userinfo",n),"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载订阅失败",`❌ 无法下载订阅:${r}!`,`🤔 原因:${JSON.stringify(e)}`),$.error(JSON.stringify(e)),t.status(500).json({status:"failed",message:e})}else $Line truncated
|
||||
// UPDATED AT: Fri 20 May 2022 07:34:40 AM CST
|
||||
const $=API("sub-store"),Base64=new Base64Code,$downloader=new ResourceDownloader;function service(){console.log("\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 © 𝑷𝒆𝒏𝒈-𝒀𝑴\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n");const e=express(),t="settings",n="subs",r="collections",s="rules",o="builtin",i="artifacts",a="Auto Generated Sub-Store Backup",c="Sub-Store",l="Sub-Store Artifacts Repository";async function p(e){const{gistToken:n}=$.read(t);return n?new Gist({token:n,key:l}).upload(e):Promise.reject("未设置Gist Token!")}async function u(e){const{headers:t}=await $.http.get({url:e,headers:{"User-Agent":"Quantumult/1.0.13 (iPhone10,3; iOS 14.0)"}});return t[Object.keys(t).filter(e=>/SUBSCRIPTION-USERINFO/i.test(e))[0]]}function f(e){const t=Object.keys(e);let n="";for(let r of t)if(/USER-AGENT/i.test(r)){n=e[r];break}return-1!==n.indexOf("Quantumult%20X")?"QX":-1!==n.indexOf("Surge")?"Surge":-1!==n.indexOf("Decar")||-1!==n.indexOf("Loon")?"Loon":-1!==n.indexOf("Stash")||-1!==n.indexOf("Shadowrocket")?"Clash":null}async function d({type:e,item:t,platform:r,noProcessor:s}={platform:"JSON",noProcessor:!1}){if("subscription"===e){const e=t,n=await $downloader.download(e.url,e.ua);let o=ProxyUtils.parse(n);s||(o=await ProxyUtils.process(o,e.process||[],r));const i={};return o.forEach(e=>{i[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(o,r)}if("collection"===e){const e=$.read(n),o=t,i=o.subscriptions;let a=[],c=0;if(await Promise.all(i.map(async t=>{const n=e[t];try{$.info(`正在处理子订阅:${n.name}...`);const e=await $downloader.download(n.url,n.ua);let t=ProxyUtils.parse(e);s||(t=await ProxyUtils.process(t,n.process||[],r)),a=a.concat(t),c++,$.info(`✅ 子订阅:${n.name}加载成功,进度--${100*(c/i.length).toFixed(1)}% `)}catch(e){c++,$.error(`❌ 处理组合订阅中的子订阅: ${n.name}时出现错误:${e},该订阅已被跳过!进度--${100*(c/i.length).toFixed(1)}%`)}})),s||(a=await ProxyUtils.process(a,o.process||[],r)),0===a.length)throw new Error("组合订阅中不含有效节点!");const l={};return a.forEach(e=>{l[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(a,r)}if("rule"===e){const e=t;let n=[];for(let t=0;t<e.urls.length;t++){const r=e.urls[t];$.info(`正在处理URL:${r},进度--${100*((t+1)/e.urls.length).toFixed(1)}% `);try{const{body:e}=await $downloader.download(r),t=RuleUtils.parse(e);n=n.concat(t)}catch(e){$.error(`处理分流订阅中的URL: ${r}时出现错误:${e}! 该订阅已被跳过。`)}}return n=await RuleUtils.process(n,[{type:"Remove Duplicate Filter"}]),RuleUtils.produce(n,r)}}$.read(n)||$.write({},n),$.read(r)||$.write({},r),$.read(t)||$.write({},t),$.read(s)||$.write({},s),$.read(i)||$.write({},i),$.write({rules:getBuiltInRules()},o),e.get("/download/collection/:name",async function(e,t){const{name:s}=e.params,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON",a=$.read(r)[s];$.info(`正在下载组合订阅:${s}`);const c=$.read(n),l=a.subscriptions;if(l.length>0){const e=c[l[0]],n=await u(e.url);n&&t.set("subscription-userinfo",n)}if(a)try{const e=await d({type:"collection",item:a,platform:i,noProcessor:o});"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 下载组合订阅错误:${s}!`,`🤔 原因:${e}`),t.status(500).json({status:"failed",message:e})}else $.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 未找到组合订阅:${s}!`),t.status(404).json({status:"failed"})}),e.get("/download/:name",async function(e,t){const{name:r}=e.params,{cache:s}=e.query,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON";$.info(`正在下载订阅:${r}`);const a=$.read(n)[r];if(a)try{const e=await d({type:"subscription",item:a,platform:i,noProcessor:o}),n=await u(a.url);n&&t.set("subscription-userinfo",n),"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载订阅失败",`❌ 无法下载订阅:${r}!`,`🤔 原因:${JSON.stringify(e)}`),$.error(JSON.stringify(e)),t.status(500).json({status:"failed",message:e})}else $Line truncated
|
||||
Reference in new issue
Block a user