Skip to content

Commit 432b49d

Browse files
authored
Merge pull request cmliu#864 from cmliu/beta2.0
Beta2.0
2 parents fd999db + c24b1b0 commit 432b49d

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
| KEY | `CMLiussss` || 快速订阅密钥,访问`/CMLiussss`即可快读订阅。 |
121121
| HOST | `edt-pages.github.io` || 强制固定伪装域名 |
122122
| UUID | `90cd4a77-141a-43c9-991b-08263cfe9c10` || 强制固定UUID |
123+
| PATH | `/` || 强制固定路径 |
123124
| PROXYIP | `proxyip.cmliussss.net:443` || 更换默认内置PROXYIP |
124125
| URL | `https://blog.cmliussss.com` || 主页反代伪装(乱设容易触发反诈,反代被墙的网站会加速域名被墙) |
125126
| GO2SOCKS5 | `blog.cmliussss.com`,`*.ip111.cn`,`*google.com` || 设置`SOCKS5``HTTP`变量之后,可设置强制使用socks5访问名单(设置为`*`可作为全局代理) |

_worker.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
}
4848
}
4949
return fetch(Pages静态页面 + '/login');
50-
} else if (访问路径 == 'admin' || 访问路径.startsWith('admin/')) {//验证cookie后响应管理页面
50+
} else if (访问路径 === 'admin' || 访问路径.startsWith('admin/')) {//验证cookie后响应管理页面
5151
const cookies = request.headers.get('Cookie') || '';
5252
const authCookie = cookies.split(';').find(c => c.trim().startsWith('auth='))?.split('=')[1];
5353
// 没有cookie或cookie错误,跳转到/login页面
@@ -88,11 +88,11 @@ export default {
8888
return new Response(JSON.stringify(检测代理响应, null, 2), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
8989
}
9090

91-
config_JSON = await 读取config_JSON(env, host, userID);
91+
config_JSON = await 读取config_JSON(env, host, userID, env.PATH);
9292

9393
if (访问路径 === 'admin/init') {// 重置配置为默认值
9494
try {
95-
config_JSON = await 读取config_JSON(env, host, userID, true);
95+
config_JSON = await 读取config_JSON(env, host, userID, env.PATH, true);
9696
ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Init_Config', config_JSON));
9797
config_JSON.init = '配置已重置为默认值';
9898
return new Response(JSON.stringify(config_JSON, null, 2), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
@@ -189,7 +189,7 @@ export default {
189189
} else if (访问路径 === 'sub') {//处理订阅请求
190190
const 订阅TOKEN = await MD5MD5(host + userID);
191191
if (url.searchParams.get('token') === 订阅TOKEN) {
192-
config_JSON = await 读取config_JSON(env, host, userID);
192+
config_JSON = await 读取config_JSON(env, host, userID, env.PATH);
193193
ctx.waitUntil(请求日志记录(env, request, 访问IP, 'Get_SUB', config_JSON));
194194
const ua = UA.toLowerCase();
195195
const expire = 4102329600;//2099-12-31 到期时间
@@ -814,7 +814,7 @@ async function MD5MD5(文本) {
814814
}
815815

816816
function 随机路径() {
817-
const 常用路径目录 = ["#","about","account","acg","act","activity","ad","admin","ads","ajax","album","albums","anime","api","app","apps","archive","archives","article","articles","ask","auth","avatar","bbs","bd","blog","blogs","book","books","bt","buy","cart","category","categories","cb","channel","channels","chat","china","city","class","classify","clip","clips","club","cn","code","collect","collection","comic","comics","community","company","config","contact","content","course","courses","cp","data","detail","details","dh","directory","discount","discuss","dl","dload","doc","docs","document","documents","doujin","download","downloads","drama","edu","en","ep","episode","episodes","event","events","f","faq","favorite","favourites","favs","feedback","file","files","film","films","forum","forums","friend","friends","game","games","gif","go","go.html","go.php","group","groups","help","home","hot","htm","html","image","images","img","index","info","intro","item","items","ja","jp","jump","jump.html","jump.php","jumping","knowledge","lang","lesson","lessons","lib","library","link","links","list","live","lives","login","logout","m","mag","magnet","mall","manhua","map","member","members","message","messages","mobile","movie","movies","music","my","new","news","note","novel","novels","online","order","out","out.html","out.php","outbound","p","page","pages","pay","payment","pdf","photo","photos","pic","pics","picture","pictures","play","player","playlist","post","posts","product","products","program","programs","project","qa","question","rank","ranking","read","readme","redirect","redirect.html","redirect.php","reg","register","res","resource","retrieve","sale","search","season","seasons","section","seller","series","service","services","setting","settings","share","shop","show","shows","site","soft","sort","source","special","star","stars","static","stock","store","stream","streaming","streams","student","study","tag","tags","task","teacher","team","tech","temp","test","thread","tool","tools","topic","topics","torrent","trade","travel","tv","txt","type","u","upload","uploads","url","urls","user","users","v","version","video","videos","view","vip","vod","watch","web","wenku","wiki","work","www","zh","zh-cn","zh-tw","zip"];
817+
const 常用路径目录 = ["#", "about", "account", "acg", "act", "activity", "ad", "admin", "ads", "ajax", "album", "albums", "anime", "api", "app", "apps", "archive", "archives", "article", "articles", "ask", "auth", "avatar", "bbs", "bd", "blog", "blogs", "book", "books", "bt", "buy", "cart", "category", "categories", "cb", "channel", "channels", "chat", "china", "city", "class", "classify", "clip", "clips", "club", "cn", "code", "collect", "collection", "comic", "comics", "community", "company", "config", "contact", "content", "course", "courses", "cp", "data", "detail", "details", "dh", "directory", "discount", "discuss", "dl", "dload", "doc", "docs", "document", "documents", "doujin", "download", "downloads", "drama", "edu", "en", "ep", "episode", "episodes", "event", "events", "f", "faq", "favorite", "favourites", "favs", "feedback", "file", "files", "film", "films", "forum", "forums", "friend", "friends", "game", "games", "gif", "go", "go.html", "go.php", "group", "groups", "help", "home", "hot", "htm", "html", "image", "images", "img", "index", "info", "intro", "item", "items", "ja", "jp", "jump", "jump.html", "jump.php", "jumping", "knowledge", "lang", "lesson", "lessons", "lib", "library", "link", "links", "list", "live", "lives", "login", "logout", "m", "mag", "magnet", "mall", "manhua", "map", "member", "members", "message", "messages", "mobile", "movie", "movies", "music", "my", "new", "news", "note", "novel", "novels", "online", "order", "out", "out.html", "out.php", "outbound", "p", "page", "pages", "pay", "payment", "pdf", "photo", "photos", "pic", "pics", "picture", "pictures", "play", "player", "playlist", "post", "posts", "product", "products", "program", "programs", "project", "qa", "question", "rank", "ranking", "read", "readme", "redirect", "redirect.html", "redirect.php", "reg", "register", "res", "resource", "retrieve", "sale", "search", "season", "seasons", "section", "seller", "series", "service", "services", "setting", "settings", "share", "shop", "show", "shows", "site", "soft", "sort", "source", "special", "star", "stars", "static", "stock", "store", "stream", "streaming", "streams", "student", "study", "tag", "tags", "task", "teacher", "team", "tech", "temp", "test", "thread", "tool", "tools", "topic", "topics", "torrent", "trade", "travel", "tv", "txt", "type", "u", "upload", "uploads", "url", "urls", "user", "users", "v", "version", "video", "videos", "view", "vip", "vod", "watch", "web", "wenku", "wiki", "work", "www", "zh", "zh-cn", "zh-tw", "zip"];
818818
const 随机数 = Math.floor(Math.random() * 3 + 1);
819819
const 随机路径 = 常用路径目录.sort(() => 0.5 - Math.random()).slice(0, 随机数).join('/');
820820
return `/${随机路径}`;
@@ -840,7 +840,7 @@ function 批量替换域名(内容, host, 每组数量 = 2) {
840840
});
841841
}
842842

843-
async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
843+
async function 读取config_JSON(env, hostname, userID, path, 重置配置 = false) {
844844
const host = 随机替换通配符(hostname);
845845
const 初始化开始时间 = performance.now();
846846
const 默认配置JSON = {
@@ -913,7 +913,7 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
913913

914914
config_JSON.HOST = host;
915915
config_JSON.UUID = userID;
916-
config_JSON.PATH = config_JSON.反代.SOCKS5.启用 ? ('/' + config_JSON.反代.SOCKS5.启用 + (config_JSON.反代.SOCKS5.全局 ? '://' : '=') + config_JSON.反代.SOCKS5.账号) : (config_JSON.反代.PROXYIP === 'auto' ? '/' : `/proxyip=${config_JSON.反代.PROXYIP}`);
916+
config_JSON.PATH = path ? (path.startsWith('/') ? path : '/' + path) : (config_JSON.反代.SOCKS5.启用 ? ('/' + config_JSON.反代.SOCKS5.启用 + (config_JSON.反代.SOCKS5.全局 ? '://' : '=') + config_JSON.反代.SOCKS5.账号) : (config_JSON.反代.PROXYIP === 'auto' ? '/' : `/proxyip=${config_JSON.反代.PROXYIP}`));
917917
const TLS分片参数 = config_JSON.TLS分片 == 'Shadowrocket' ? `&fragment=${encodeURIComponent('1,40-60,30-50,tlshello')}` : config_JSON.TLS分片 == 'Happ' ? `&fragment=${encodeURIComponent('3,1,tlshello')}` : '';
918918
config_JSON.LINK = `${config_JSON.协议类型}://${userID}@${host}:443?security=tls&type=${config_JSON.传输协议}&host=${host}&sni=${host}&path=${encodeURIComponent(config_JSON.启用0RTT ? config_JSON.PATH + '?ed=2560' : config_JSON.PATH) + TLS分片参数}&encryption=none${config_JSON.跳过证书验证 ? '&allowInsecure=1' : ''}#${encodeURIComponent(config_JSON.优选订阅生成.SUBNAME)}`;
919919
config_JSON.优选订阅生成.TOKEN = await MD5MD5(hostname + userID);

0 commit comments

Comments
 (0)