From 8ddf2625939da30fb792d676bc0f2789e2449b58 Mon Sep 17 00:00:00 2001
From: Tipx-L <138244655+Tipx-L@users.noreply.github.com>
Date: Fri, 29 Sep 2023 11:33:29 -0700
Subject: [PATCH] Change update URLs.
---
game/config.js | 3 ++-
game/game.js | 71 ++++++++++++++++++--------------------------------
2 files changed, 27 insertions(+), 47 deletions(-)
diff --git a/game/config.js b/game/config.js
index 6a5fb309e..d33b563fc 100644
--- a/game/config.js
+++ b/game/config.js
@@ -1,6 +1,7 @@
window.config={
extension_sources:{
- Coding:'https://raw.fgit.cf/libccy/noname-extension/master/',
+ 'GitHub Proxy':'https://ghproxy.com/https://raw.githubusercontent.com/libccy/noname-extension/master/',
+ FastGit:'https://raw.fgit.cf/libccy/noname-extension/master/',
GitHub:'https://raw.githubusercontent.com/libccy/noname-extension/master/'
},
extension_source:'Coding',
diff --git a/game/game.js b/game/game.js
index 0901cc9c7..0d38919be 100644
--- a/game/game.js
+++ b/game/game.js
@@ -1000,7 +1000,7 @@
init:'coding',
unfrequent:true,
item:{
- coding:'Github Proxy',
+ coding:'FastGit',
github:'GitHub',
},
onclick:function(item){
@@ -1010,15 +1010,10 @@
},
extension_source:{
name:'获取扩展地址',
- init:'Coding',
+ init:'GitHub Proxy',
unfrequent:true,
item:{},
- intro:function(){
- return '获取在线扩展时的地址。当前地址:
'+lib.config.extension_sources[lib.config.extension_source];
- },
- onclick:function(item){
- game.saveConfig('extension_source',item);
- },
+ intro:()=>`获取在线扩展时的地址。当前地址:${document.createElement('br').outerHTML}${lib.config.extension_sources[lib.config.extension_source]}`
},
extension_create:{
name:'添加获取扩展地址',
@@ -47480,47 +47475,31 @@
var li1=document.createElement('li');
var li2=document.createElement('li');
var li3=document.createElement('li');
- var trimurl=function(str){
- if(str==lib.updateURLS.github){
- return 'GitHub';
+ const trimURL=url=>{
+ const updateURLS=lib.updateURLS;
+ for(const key in updateURLS){
+ const updateURL=updateURLS[key];
+ if(url==updateURL) return lib.configMenu.general.config.update_link.item[key];
}
- if(str==lib.updateURLS.coding){
- return 'Coding';
+ let index=url.indexOf('://');
+ if(index!=-1) url=url.slice(index+3);
+ index=url.indexOf('/');
+ if(index!=-1) url=url.slice(0,index);
+ if(url.length>15){
+ const list=url.split('.');
+ if(list.length>1) list.shift();
+ url=list.join('.');
}
- var index;
- index=str.indexOf('://');
- if(index!=-1){
- str=str.slice(index+3);
+ if(url.length>15){
+ const list=url.split('.');
+ if(list.length>1) list.pop();
+ url=list.join('.');
}
- index=str.indexOf('/');
- if(index!=-1){
- str=str.slice(0,index);
- }
- if(str.length>15){
- var list=str.split('.');
- if(list.length>1){
- list.shift();
- }
- str=list[0];
- for(var i=1;i