From e56c8d0cc69401d37d6276d29a31abcb746730fa Mon Sep 17 00:00:00 2001 From: Coldvvater <59505520+Coldvvater@users.noreply.github.com> Date: Sun, 1 Jan 2023 19:49:46 +0800 Subject: [PATCH] Delete JS directory --- JS/covid19.js | 84 ------------ JS/stream.js | 330 --------------------------------------------- JS/sub_info.js | 145 -------------------- JS/weekly_notes.js | 20 --- JS/weibolite.js | 132 ------------------ 5 files changed, 711 deletions(-) delete mode 100644 JS/covid19.js delete mode 100644 JS/stream.js delete mode 100644 JS/sub_info.js delete mode 100644 JS/weekly_notes.js delete mode 100644 JS/weibolite.js diff --git a/JS/covid19.js b/JS/covid19.js deleted file mode 100644 index 9953e767a..000000000 --- a/JS/covid19.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 原脚本作者: smartmimi - * 原脚本地址:https://github.com/smartmimi/conf/blob/master/surge/covid19.js - * 由@Coldvvater修改 - * 更新日期:2022.06.30 - * 版本:1.0 - */ - - -const read = $persistentStore.read("covid19area") ; -var list = read.split(","); -const url = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"; -var ala=""; -if (!read){ - $done({ - title: "新冠疫情查询", - style: "error", - content: "请在boxjs中完善信息" - }) -}; -function nowtime(){ - let now = new Date(); - let hour = now.getHours(); - let minutes = now.getMinutes(); - let hour_twoCode = hour > 9 ? hour : "0" + hour; - let minutes_twoCode = minutes > 9 ? minutes : "0" + minutes; - let time = hour_twoCode+":"+minutes_twoCode; - return time -} -function num(location, result) { - var loc = location; - var resu = result; - var loc_new = new RegExp(loc + "[\\s\\S]*?confirm[\\s\\S]{3}(\\d+)"); - var loc_now = new RegExp(loc + "[\\s\\S]*?nowConfirm[\\s\\S]{3}(\\d+)"); - var loc_wzz = new RegExp(loc + "[\\s\\S]*?wzz[\\s\\S]{3}(\\d+)"); - var loc_update = new RegExp(loc + "[\\s\\S]*?isUpdated[\\s\\S]{3}(\\b(true|false)\\b)"); - let loc_new_res = loc_new.exec(resu); - let loc_now_res = loc_now.exec(resu); - let loc_wzz_res = loc_wzz.exec(resu); - let loc_update_res = loc_update.exec(resu); - if (loc_new_res) { - //console.log("已获取" + loc + "的信息"); - ala = ala+update_icon(loc_update_res[1])+loc+ToDBC(loc_new_res[1].padStart(5," "))+"|"+ToDBC(loc_now_res[1].padStart(6," "))+"\n"; - // 无症状+"|"+ToDBC(loc_wzz_res[1].padStart(6," ")); - } else { - //console.log("获取" + loc + "的信息失败"); - ala = ala + loc + ": 查无数据\n"; - } -}; -$httpClient.get(url, function(error, response, data){ - let res = data; - for (var i = 0; i < list.length; i++) { - num(list[i], res); - if (i == list.length - 1) { - $done({ - title: "疫情查询:"+ToDBC(" ")+"新增|现存"+ToDBC(" ")+nowtime(), - content: ala.replace(/\n$/, ""), - icon: "heart.circle", - backgroundColor: '#18CDCD', - }); - } - } -}); -function ToDBC(txtstring) { - var tmp = ""; - for (var i = 0; i < txtstring.length; i++) { - if (txtstring.charCodeAt(i) == 32) { - tmp = tmp + String.fromCharCode(12288); - } - else if (txtstring.charCodeAt(i) < 127) { - tmp = tmp + String.fromCharCode(txtstring.charCodeAt(i) + 65248); - } - } - return tmp; -} -function update_icon(status){ - if(status== "true"){ - return '\u2714'; - } else if(status== "false"){ - return '\u3030'; - } else{ - return '\u2716'; - } -} diff --git a/JS/stream.js b/JS/stream.js deleted file mode 100644 index 032bce6e1..000000000 --- a/JS/stream.js +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 由@LucaLin233编写 - * 原脚本地址:https://raw.githubusercontent.com/LucaLin233/Luca_Conf/main/Surge/JS/stream-all.js - * 由@Rabbit-Spec修改 - * @Coldvvater次改 - * 更新日期:2022.07.06 - * 版本:2.2 - */ - -const REQUEST_HEADERS = { - 'User-Agent': - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36', - 'Accept-Language': 'en', -} - -// 即将登陆 -const STATUS_COMING = 2 -// 支持解锁 -const STATUS_AVAILABLE = 1 -// 不支持解锁 -const STATUS_NOT_AVAILABLE = 0 -// 检测超时 -const STATUS_TIMEOUT = -1 -// 检测异常 -const STATUS_ERROR = -2 - -const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36' - - - ; (async () => { - let panel_result = { - title: '流媒体解锁检测', - content: '', - icon: 'play.tv.fill', - backgroundColor: '#E40814', - } - let [{ region, status }] = await Promise.all([testDisneyPlus()]) - await Promise.all([check_youtube_premium(), check_netflix()]) - .then((result) => { - console.log(result) - let disney_result = "" - if (status == STATUS_COMING) { - //console.log(1) - disney_result = "Disney+: 即将登陆~" + region.toUpperCase() - } else if (status == STATUS_AVAILABLE) { - //console.log(2) - console.log(region) - disney_result = "Disney+: 已经解锁 ➟ " + region.toUpperCase() - // console.log(result["Disney"]) - } else if (status == STATUS_NOT_AVAILABLE) { - //console.log(3) - disney_result = "Disney+: 未支持 🚫 " - } else if (status == STATUS_TIMEOUT) { - disney_result = "Disney+: 检测超时 🚦" - } - result.push(disney_result) - console.log(result) - let content = result.join('\n') - console.log(content) - - panel_result['content'] = content - }) - .finally(() => { - $done(panel_result) - }) - })() -async function check_youtube_premium() { - let inner_check = () => { - return new Promise((resolve, reject) => { - let option = { - url: 'https://www.youtube.com/premium', - headers: REQUEST_HEADERS, - } - $httpClient.get(option, function (error, response, data) { - if (error != null || response.status !== 200) { - reject('Error') - return - } - - if (data.indexOf('Premium is not available in your country') !== -1) { - resolve('Not Available') - return - } - - let region = '' - let re = new RegExp('"countryCode":"(.*?)"', 'gm') - let result = re.exec(data) - if (result != null && result.length === 2) { - region = result[1] - } else if (data.indexOf('www.google.cn') !== -1) { - region = 'CN' - } else { - region = 'US' - } - resolve(region) - }) - }) - } - - let youtube_check_result = 'YouTube: ' - - await inner_check() - .then((code) => { - if (code === 'Not Available') { - youtube_check_result += '未支持 🚫' - } else { - youtube_check_result += '已经解锁 ➟ ' + code.toUpperCase() - } - }) - .catch((error) => { - youtube_check_result += '检测失败,请刷新面板' - }) - - return youtube_check_result -} - -async function check_netflix() { - let inner_check = (filmId) => { - return new Promise((resolve, reject) => { - let option = { - url: 'https://www.netflix.com/title/' + filmId, - headers: REQUEST_HEADERS, - } - $httpClient.get(option, function (error, response, data) { - if (error != null) { - reject('Error') - return - } - - if (response.status === 403) { - reject('Not Available') - return - } - - if (response.status === 404) { - resolve('Not Found') - return - } - - if (response.status === 200) { - let url = response.headers['x-originating-url'] - let region = url.split('/')[3] - region = region.split('-')[0] - if (region == 'title') { - region = 'us' - } - resolve(region) - return - } - - reject('Error') - }) - }) - } - - let netflix_check_result = 'Netflix☆: ' - - await inner_check(81215567) - .then((code) => { - if (code === 'Not Found') { - return inner_check(80018499) - } - netflix_check_result += '完整解锁 ➟ ' + code.toUpperCase() - return Promise.reject('BreakSignal') - }) - .then((code) => { - if (code === 'Not Found') { - return Promise.reject('Not Available') - } - - netflix_check_result += '仅解锁自制剧 ➟ ' + code.toUpperCase() - return Promise.reject('BreakSignal') - }) - .catch((error) => { - if (error === 'BreakSignal') { - return - } - if (error === 'Not Available') { - netflix_check_result += '未支持 🚫' - return - } - netflix_check_result += '检测失败,请刷新面板' - }) - - return netflix_check_result -} - -async function testDisneyPlus() { - try { - let { region, cnbl } = await Promise.race([testHomePage(), timeout(7000)]) - console.log(`homepage: region=${region}, cnbl=${cnbl}`) - // 即将登陆 - // if (cnbl == 2) { - // return { region, status: STATUS_COMING } - // } - let { countryCode, inSupportedLocation } = await Promise.race([getLocationInfo(), timeout(7000)]) - console.log(`getLocationInfo: countryCode=${countryCode}, inSupportedLocation=${inSupportedLocation}`) - - region = countryCode ?? region - console.log("region:" + region) - // 即将登陆 - if (inSupportedLocation === false || inSupportedLocation === 'false') { - return { region, status: STATUS_COMING } - } else { - // 支持解锁 - return { region, status: STATUS_AVAILABLE } - } - - } catch (error) { - console.log("error:" + error) - - // 不支持解锁 - if (error === 'Not Available') { - console.log("不支持") - return { status: STATUS_NOT_AVAILABLE } - } - - // 检测超时 - if (error === 'Timeout') { - return { status: STATUS_TIMEOUT } - } - - return { status: STATUS_ERROR } - } - -} - -function getLocationInfo() { - return new Promise((resolve, reject) => { - let opts = { - url: 'https://disney.api.edge.bamgrid.com/graph/v1/device/graphql', - headers: { - 'Accept-Language': 'en', - Authorization: 'ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84', - 'Content-Type': 'application/json', - 'User-Agent': UA, - }, - body: JSON.stringify({ - query: 'mutation registerDevice($input: RegisterDeviceInput!) { registerDevice(registerDevice: $input) { grant { grantType assertion } } }', - variables: { - input: { - applicationRuntime: 'chrome', - attributes: { - browserName: 'chrome', - browserVersion: '94.0.4606', - manufacturer: 'apple', - model: null, - operatingSystem: 'macintosh', - operatingSystemVersion: '10.15.7', - osDeviceIds: [], - }, - deviceFamily: 'browser', - deviceLanguage: 'en', - deviceProfile: 'macosx', - }, - }, - }), - } - - $httpClient.post(opts, function (error, response, data) { - if (error) { - reject('Error') - return - } - - if (response.status !== 200) { - console.log('getLocationInfo: ' + data) - reject('Not Available') - return - } - - data = JSON.parse(data) - if (data?.errors) { - console.log('getLocationInfo: ' + data) - reject('Not Available') - return - } - - let { - token: { accessToken }, - session: { - inSupportedLocation, - location: { countryCode }, - }, - } = data?.extensions?.sdk - resolve({ inSupportedLocation, countryCode, accessToken }) - }) - }) -} - -function testHomePage() { - return new Promise((resolve, reject) => { - let opts = { - url: 'https://www.disneyplus.com/', - headers: { - 'Accept-Language': 'en', - 'User-Agent': UA, - }, - } - - $httpClient.get(opts, function (error, response, data) { - if (error) { - reject('Error') - return - } - if (response.status !== 200 || data.indexOf('unavailable') !== -1) { - reject('Not Available') - return - } - - let match = data.match(/Region: ([A-Za-z]{2})[\s\S]*?CNBL: ([12])/) - if (!match) { - resolve({ region: '', cnbl: '' }) - return - } - - let region = match[1] - let cnbl = match[2] - resolve({ region, cnbl }) - }) - }) -} - -function timeout(delay = 5000) { - return new Promise((resolve, reject) => { - setTimeout(() => { - reject('Timeout') - }, delay) - }) -} diff --git a/JS/sub_info.js b/JS/sub_info.js deleted file mode 100644 index d38db3159..000000000 --- a/JS/sub_info.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 原脚本作者: smartmimi - * 原脚本地址:https://github.com/smartmimi/conf/blob/master/surge/sub_info_panel.js - * 由@Coldvvater修改 - * 更新日期:2022.06.30 - * 版本:1.0 - */ - -/* -Surge配置参考注释,感谢@asukanana,感谢@congcong.修改自@mieqq大佬的脚本https://raw.githubusercontent.com/mieqq/mieqq/master/sub_info_panel.js -boxjs中添加订阅https://raw.githubusercontent.com/smartmimi/conf/master/boxjs/cookie.boxjs.json -示例↓↓↓ ----------------------------------------- -[Script] -Sub_info = type=generic,timeout=10,script-path=https://raw.githubusercontent.com/smartmimi/conf/master/surge/sub_info_panel.js,script-update-interval=0 -[Panel] -Sub_info = script-name=Sub_info ----------------------------------------- -可选参数 reset_day,后面的数字替换成流量每月重置的日期,如1号就写1,8号就写8。如"&reset_day=8",不加该参数不显示流量重置信息。 -可选参数 expire,机场链接不带expire信息的,可以手动传入expire参数,如"&expire=2022-02-01",注意一定要按照yyyy-MM-dd的格式。 -可选参数"title=xxx" 可以自定义标题。 ----------------------------------------- -*/ - -(async () => { - let sub_title = $persistentStore.read("airport_title"); - let resetDay = parseInt($persistentStore.read("airport_rest_day") ); - let resetLeft = getRmainingDays(resetDay); - let urlcode = $persistentStore.read("airport_url"); - let usage = await getDataUsage(urlcode); - let used = usage.download + usage.upload; - let total = usage.total; - let expire = usage.expire || $persistentStore.read("airport_expire"); - //let prec = precent(used,total); - //let infoList = [`使用:${bytesToSize(used)} | ${bytesToSize(total)}\n${prec}`]; - let infoList = [`使用:${bytesToSize(used)} | ${bytesToSize(total)}`]; - - if (resetLeft) { - infoList.push(`重置:剩余${resetLeft}天`); - } - if (expire) { - if (/^[\d]+$/.test(expire)) expire *= 1000; - infoList.push(`到期:${formatTime(expire)}`); - } - - let body = infoList.join("\n"); - $done({ - title: sub_title+ " "+nowtime(), - content: body, - icon: "airplane.departure", - backgroundColor: "#009944" - }); -})(); - - -function getUserInfo(url) { - let request = { headers: { "User-Agent": "Quantumult%20X" }, url }; - return new Promise((resolve, reject) => - $httpClient.head(request, (err, resp) => { - if (err != null) { - reject(err); - return; - } - if (resp.status !== 200) { - reject("Not Available"); - return; - } - let header = Object.keys(resp.headers).find( - (key) => key.toLowerCase() === "subscription-userinfo" - ); - if (header) { - resolve(resp.headers[header]); - return; - } - reject("链接响应头不带有流量信息"); - }) - ); -} - -async function getDataUsage(url) { - const [err, data] = await getUserInfo(url) - .then((data) => [null, data]) - .catch((err) => [err, null]); - if (err) { - console.log(err); - return; - } - - return Object.fromEntries( - data - .match(/\w+=[\d.eE+]+/g) - .map((item) => item.split("=")) - .map(([k, v]) => [k, parseInt(v)]) - ); -} - -function getRmainingDays(resetDay) { - if (!resetDay) return; - let now = new Date(); - let today = now.getDate(); - let month = now.getMonth(); - let year = now.getFullYear(); - let daysInMonth; - if (resetDay > today) { - daysInMonth = 0; - } else { - daysInMonth = new Date(year, month + 1, 0).getDate(); - } - return daysInMonth - today + resetDay; -} - -function nowtime(){ - let now = new Date(); - let time = now.getHours()+":"+now.getMinutes()+":"+now.getSeconds(); - return time -} - -function bytesToSize(bytes) { - if (bytes === 0) return "0B"; - let k = 1024; - sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - let i = Math.floor(Math.log(bytes) / Math.log(k)); - return (bytes / Math.pow(k, i)).toFixed(2) + " " + sizes[i]; -} - -function formatTime(time) { - let dateObj = new Date(time); - let year = dateObj.getFullYear(); - let month = dateObj.getMonth() + 1; - let day = dateObj.getDate(); - return year + "年" + month + "月" + day + "日"; -} - -function precent(res,total){ - let num = Number(((res / total)*10).toFixed(0)); - let precentprint = ''; - for (var i =1;i<=10;i++){ - if (i <= num) { - precentprint += '🔴'; - }else{ - precentprint += '🟢'; - } - }; - return precentprint; -} diff --git a/JS/weekly_notes.js b/JS/weekly_notes.js deleted file mode 100644 index fb095c11f..000000000 --- a/JS/weekly_notes.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 原脚本作者: smartmimi - * 原脚本地址:https://github.com/smartmimi/conf/blob/master/surge/weekly_notes.js - * 由@Coldvvater修改 - * 更新日期:2022.06.30 - * 版本:1.0 - */ - -const weekly_notes_boxjs_title = $persistentStore.read("weekly_notes_title"); -var tnow = new Date(); -var tnoww = tnow.getDay(); -const weekly_notes_boxjs = $persistentStore.read(`weekly_notes_${tnoww}`); -$done({ - title: "周"+`${tnoww==0?"日":tnoww}`+ weekly_notes_boxjs_title, - content: weekly_notes_boxjs, - icon: "greetingcard", - backgroundColor: '#318BD5', -}) - - diff --git a/JS/weibolite.js b/JS/weibolite.js deleted file mode 100644 index e3921d715..000000000 --- a/JS/weibolite.js +++ /dev/null @@ -1,132 +0,0 @@ -/* -应用名称:自用微博国际版去广告脚本 -脚本作者:Cuttlefish -微信账号:公众号墨鱼手记 -更新时间:2022-11-13 -脚本版本:(0.0.6) -通知频道:https://t.me/ddgksf2021 -问题反馈:ddgksf2013@163.com -*/ -const mainConfig = {}; -const modifyCardsUrls = ['/cardlist', 'video/community_tab', '/searchall']; -const modifyTimeUrls = ['statuses/friends_timeline', 'statuses/unread_hot_timeline', 'groups/timeline']; -const modifyOtherUrls = { - 'ct=feed&a=trends': 'removeTopics',/* 屏蔽探索页面下的一些Topic */ - 'search_topic' : 'modifiedSearchTopic' -} -function getModifyMethod(url) { - for (const s of modifyCardsUrls) { - if(url.indexOf(s) > -1) { - return 'removeCards'; - } - } - for (const s of modifyTimeUrls) { - if(url.indexOf(s) > -1) { - return 'removeTimeLine'; - } - } - for(const [path, method] of Object.entries(modifyOtherUrls)) { - if(url.indexOf(path) > -1) { - return method; - } - } - return null; -} -function modifiedSearchTopic(data) { - data = {"data":[],"info":"","retcode":0,"ext":{"search_hot_simple":{"title":"\u70ed\u95e8\u641c\u7d22","desc":"","more":"\u66f4\u591a\u70ed\u641c"},"search_hot":{"title":"\u5fae\u535a\u70ed\u641c\u699c","desc":"\u5b9e\u65f6\u70ed\u70b9\uff0c\u6bcf\u5206\u949f\u66f4\u65b0\u4e00\u6b21","more":""},"search_city":{"title":"\u540c\u57ce\u70ed\u70b9","desc":"","more":""}}}; -} -function removeTopics(data) { - if(!data.data) { - return data; - } - //if(data.data.search_topic) {delete data.data.search_topic;} - if(data.data.topics) {delete data.data.topics;} - if(data.data.discover) {delete data.data.discover;} - - return data; -} -function isAd(data) { - if(!data) { - return false; - } - if(data.mblogtypename == '广告' || data.mblogtypename == '热推') {return true}; - if(data.mblogtypename == '廣告' || data.mblogtypename == '熱推') {return true}; - if(data.readtimetype == 'adMblog') {return true}; - if(data.promotion && data.promotion.type == 'ad') {return true}; - return false; -} - -function isBlock(data) { - let blockIds = mainConfig.blockIds || []; - if(blockIds.length === 0) { - return false; - } - let uid = data.user.id; - for (const blockId of blockIds) { - if(blockId == uid) { - return true; - } - } - return false; -} - -function removeTimeLine(data) { - for (const s of ["ad", "advertises", "trends"]) { - if(data[s]) { - delete data[s]; - } - } - if(!data.statuses) { - return; - } - let newStatuses = []; - for (const s of data.statuses) { - if(!isAd(s)) { - //lvZhouHandler(s); - if(!isBlock(s)) { - newStatuses.push(s); - } - } - } - data.statuses = newStatuses; -} -function removeCards(data) { - if(!data.cards) { - return; - } - let newCards = []; - for (const card of data.cards) { - let cardGroup = card.card_group; - if(cardGroup && cardGroup.length > 0) { - let newGroup = []; - for (const group of cardGroup) { - let cardType = group.card_type; - if(cardType != 118) { - newGroup.push(group); - } - } - card.card_group = newGroup; - newCards.push(card); - } else { - let cardType = card.card_type; - if([9,165].indexOf(cardType) > -1) { - if(!isAd(card.mblog)) { - newCards.push(card); - } - } else { - newCards.push(card); - } - } - } - data.cards = newCards; -} -var body = $response.body; -var url = $request.url; -let method = getModifyMethod(url); -if(method) { - var func = eval(method); - let data = JSON.parse(body); - new func(data); - body = JSON.stringify(data); -} -$done({body});