pref: format @/game.

This commit is contained in:
Rintim 2024-04-16 00:49:47 +08:00
parent 16555acdd8
commit 5197d6b2ce
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
18 changed files with 34474 additions and 32178 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// apk每次安装后第一次启动加载Service Worker会失败 // apk每次安装后第一次启动加载Service Worker会失败
// 所以每次导入这个ts判断是否会成功失败的话重启一次 // 所以每次导入这个ts判断是否会成功失败的话重启一次
export const text: string = 'ts文件导入成功'; export const text: string = "ts文件导入成功";

View File

@ -1,40 +1,152 @@
window.config = { window.config = {
extension_sources: { extension_sources: {
'GitHub Proxy':'https://mirror.ghproxy.com/https://raw.githubusercontent.com/libccy/noname-extension/master/', "GitHub Proxy":
FastGit:'https://raw.fgit.cf/libccy/noname-extension/master/', "https://mirror.ghproxy.com/https://raw.githubusercontent.com/libccy/noname-extension/master/",
GitHub:'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:'GitHub Proxy', extension_source: "GitHub Proxy",
forbidai:['ns_liuzhang'], forbidai: ["ns_liuzhang"],
forbidai_user: [], forbidai_user: [],
forbidall: [], forbidall: [],
forbidstone:['zhugedan','pal_xuanxiao','hs_malfurion','lusu','chenlin','hs_siwangzhiyi', forbidstone: [
'gjqt_bailitusu','yuanshao','swd_anka','swd_nicole','daqiao','re_daqiao','hs_xuanzhuanjijia', "zhugedan",
'zhuran','huatuo','swd_tuwei','hs_guldan','wangyi','caoang','swd_guyue','swd_rongshuang', "pal_xuanxiao",
'swd_jiangziya','guojia','re_guojia','shen_caocao','swd_qiner','caopi','hs_yngvar','guansuo', "hs_malfurion",
'gjqt_aruan','swd_hanluo','hs_anduin','swd_huanglei','yxs_yujix','yxs_luzhishen','swd_muyun','ow_tianshi', "lusu",
'pal_yuejinzhao','hs_antonidas','xushi','hs_lreno' "chenlin",
"hs_siwangzhiyi",
"gjqt_bailitusu",
"yuanshao",
"swd_anka",
"swd_nicole",
"daqiao",
"re_daqiao",
"hs_xuanzhuanjijia",
"zhuran",
"huatuo",
"swd_tuwei",
"hs_guldan",
"wangyi",
"caoang",
"swd_guyue",
"swd_rongshuang",
"swd_jiangziya",
"guojia",
"re_guojia",
"shen_caocao",
"swd_qiner",
"caopi",
"hs_yngvar",
"guansuo",
"gjqt_aruan",
"swd_hanluo",
"hs_anduin",
"swd_huanglei",
"yxs_yujix",
"yxs_luzhishen",
"swd_muyun",
"ow_tianshi",
"pal_yuejinzhao",
"hs_antonidas",
"xushi",
"hs_lreno",
], ],
forbidchess:['hetaihou','swd_kangnalishi'], forbidchess: ["hetaihou", "swd_kangnalishi"],
forbidboss:['caiwenji','gjqt_aruan','pal_xuanxiao','swd_hupo'], forbidboss: ["caiwenji", "gjqt_aruan", "pal_xuanxiao", "swd_hupo"],
forbiddouble:['zhugedan','swd_kangnalishi','dongzhuo','wutugu','hs_siwangzhiyi','hs_ronghejuren','hs_shanlingjuren'], forbiddouble: [
forbidthreecard:['qiankunbiao','shenhuofeiya','gw_ciguhanshuang','gw_birinongwu','gw_qinpendayu','gw_poxiao'], "zhugedan",
zhinang_tricks:['guohe','wuxie','wuzhong','dongzhuxianji'], "swd_kangnalishi",
connect_zhinang_tricks:['guohe','wuxie','wuzhong','dongzhuxianji'], "dongzhuo",
"wutugu",
"hs_siwangzhiyi",
"hs_ronghejuren",
"hs_shanlingjuren",
],
forbidthreecard: [
"qiankunbiao",
"shenhuofeiya",
"gw_ciguhanshuang",
"gw_birinongwu",
"gw_qinpendayu",
"gw_poxiao",
],
zhinang_tricks: ["guohe", "wuxie", "wuzhong", "dongzhuxianji"],
connect_zhinang_tricks: ["guohe", "wuxie", "wuzhong", "dongzhuxianji"],
all: { all: {
sgscharacters:['standard','shenhua','xinghuoliaoyuan','refresh','yijiang','sp','sp2','xianding','huicui','extra','old','mobile','shiji','tw','yingbian','offline','jsrg','sb','clan','collab','onlyOL'], sgscharacters: [
sgscards:['standard','extra','sp','guozhan','zhulu','yingbian','yongjian'], "standard",
sgsmodes:['identity','guozhan','versus','doudizhu','single','brawl','connect'], "shenhua",
stockmode:['identity','guozhan','versus','boss','doudizhu','single','chess','stone','connect','brawl','tafang'], "xinghuoliaoyuan",
stockextension:['boss','cardpile','coin','wuxing'], "refresh",
layout:['default','newlayout'], "yijiang",
theme:['woodden','music','simple'], "sp",
card_font:['xiaozhuan','huangcao','caoshu','xingshu'], "sp2",
double_hp:['hejiansan','pingjun','zuidazhi','zuixiaozhi','zonghe'], "xianding",
image_background_filter:['default','blur','gray','sepia','invert','saturate','contrast','hue','brightness'], "huicui",
"extra",
"old",
"mobile",
"shiji",
"tw",
"yingbian",
"offline",
"jsrg",
"sb",
"clan",
"collab",
"onlyOL",
],
sgscards: [
"standard",
"extra",
"sp",
"guozhan",
"zhulu",
"yingbian",
"yongjian",
],
sgsmodes: [
"identity",
"guozhan",
"versus",
"doudizhu",
"single",
"brawl",
"connect",
],
stockmode: [
"identity",
"guozhan",
"versus",
"boss",
"doudizhu",
"single",
"chess",
"stone",
"connect",
"brawl",
"tafang",
],
stockextension: ["boss", "cardpile", "coin", "wuxing"],
layout: ["default", "newlayout"],
theme: ["woodden", "music", "simple"],
card_font: ["xiaozhuan", "huangcao", "caoshu", "xingshu"],
double_hp: ["hejiansan", "pingjun", "zuidazhi", "zuixiaozhi", "zonghe"],
image_background_filter: [
"default",
"blur",
"gray",
"sepia",
"invert",
"saturate",
"contrast",
"hue",
"brightness",
],
}, },
game:'sgs', game: "sgs",
duration: 500, duration: 500,
hoveration: 1000, hoveration: 1000,
doubleclick_intro: true, doubleclick_intro: true,
@ -42,8 +154,8 @@ window.config={
volumn_background: 8, volumn_background: 8,
volumn_audio: 8, volumn_audio: 8,
connect_avatar:'caocao', connect_avatar: "caocao",
connect_nickname:'无名玩家', connect_nickname: "无名玩家",
config_menu: true, config_menu: true,
auto_popped_config: true, auto_popped_config: true,
auto_popped_history: false, auto_popped_history: false,
@ -57,11 +169,11 @@ window.config={
right_info: true, right_info: true,
longpress_info: true, longpress_info: true,
long_info: true, long_info: true,
background_music:'music_default', background_music: "music_default",
background_audio: true, background_audio: true,
background_speak: true, background_speak: true,
glow_phase:'yellow', glow_phase: "yellow",
die_move:'flip', die_move: "flip",
skin: {}, skin: {},
gameRecord: {}, gameRecord: {},
@ -80,20 +192,20 @@ window.config={
alteredSkills: [], alteredSkills: [],
brokenFile: [], brokenFile: [],
theme:'woodden', theme: "woodden",
layout:'mobile', layout: "mobile",
card_style:'default', card_style: "default",
cardback_style:'default', cardback_style: "default",
hp_style:'default', hp_style: "default",
image_character:'default', image_character: "default",
image_background:'default', image_background: "default",
asset_image: true, asset_image: true,
asset_font: true, asset_font: true,
card_font:'xiaozhuan', card_font: "xiaozhuan",
show_statusbar_ios:'off', show_statusbar_ios: "off",
show_statusbar_android: false, show_statusbar_android: false,
show_name: true, show_name: true,
show_replay: false, show_replay: false,
@ -115,29 +227,57 @@ window.config={
vertical_scroll: false, vertical_scroll: false,
handcard_scroll: 0, handcard_scroll: 0,
animation: true, animation: true,
skill_animation_type:'default', skill_animation_type: "default",
paused: false, paused: false,
title: false, title: false,
button_press: true, button_press: true,
damage_shake: true, damage_shake: true,
log_highlight: true, log_highlight: true,
player_border:'normal', player_border: "normal",
radius_size:'default', radius_size: "default",
modeconfig: false, modeconfig: false,
gameconfig: false, gameconfig: false,
appearence: false, appearence: false,
video:'20', video: "20",
coin: 0, coin: 0,
intro:'i', intro: "i",
right_click:'pause', right_click: "pause",
sort:'type_sort', sort: "type_sort",
cards:['standard','extra'], cards: ["standard", "extra"],
characters:['standard','shenhua','sp','sp2','yijiang','refresh','xinghuoliaoyuan','mobile','extra','yingbian','sb','tw','offline','clan','collab','xianding','huicui','shiji','jsrg','onlyOL'], characters: [
connect_characters:['diy'], "standard",
connect_cards:['huanlekapai','guozhan','sp','zhulu','yingbian','yongjian'], "shenhua",
"sp",
"sp2",
"yijiang",
"refresh",
"xinghuoliaoyuan",
"mobile",
"extra",
"yingbian",
"sb",
"tw",
"offline",
"clan",
"collab",
"xianding",
"huicui",
"shiji",
"jsrg",
"onlyOL",
],
connect_characters: ["diy"],
connect_cards: [
"huanlekapai",
"guozhan",
"sp",
"zhulu",
"yingbian",
"yongjian",
],
plays: [], plays: [],
extensions: [], extensions: [],
banned: [], banned: [],
@ -147,30 +287,51 @@ window.config={
customcardpile: {}, customcardpile: {},
addedpile: {}, addedpile: {},
mode:'identity', mode: "identity",
mode_config: { mode_config: {
global: { global: {
player_number: 8, player_number: 8,
auto_identity:'off', auto_identity: "off",
double_character: false, double_character: false,
save_progress: true, save_progress: true,
free_choose: true, free_choose: true,
swap: true, swap: true,
change_identity: true, change_identity: true,
battle_number: 3, battle_number: 3,
double_hp:'pingjun', double_hp: "pingjun",
}, },
identity: { identity: {
identity: [ identity: [
['zhu','fan'], ["zhu", "fan"],
['zhu','nei','fan'], ["zhu", "nei", "fan"],
['zhu','zhong','nei','fan'], ["zhu", "zhong", "nei", "fan"],
['zhu','zhong','nei','fan','fan'], ["zhu", "zhong", "nei", "fan", "fan"],
['zhu','zhong','nei','fan','fan','fan'], ["zhu", "zhong", "nei", "fan", "fan", "fan"],
['zhu','zhong','zhong','nei','fan','fan','fan'], ["zhu", "zhong", "zhong", "nei", "fan", "fan", "fan"],
['zhu','zhong','zhong','nei','fan','fan','fan','fan'], ["zhu", "zhong", "zhong", "nei", "fan", "fan", "fan", "fan"],
['zhu','zhong','zhong','zhong','nei','fan','fan','fan','fan'], [
['zhu','zhong','zhong','zhong','nei','nei','fan','fan','fan','fan'], "zhu",
"zhong",
"zhong",
"zhong",
"nei",
"fan",
"fan",
"fan",
"fan",
],
[
"zhu",
"zhong",
"zhong",
"zhong",
"nei",
"nei",
"fan",
"fan",
"fan",
"fan",
],
], ],
choice: { choice: {
zhu: 3, zhu: 3,
@ -179,71 +340,71 @@ window.config={
fan: 3, fan: 3,
}, },
show_identity: true, show_identity: true,
difficulty:'normal', difficulty: "normal",
dierestart:true dierestart: true,
}, },
guozhan: { guozhan: {
difficulty:'normal', difficulty: "normal",
initshow_draw:'mark', initshow_draw: "mark",
dierestart:true dierestart: true,
}, },
}, },
current_mode: {}, current_mode: {},
customforbid: [], customforbid: [],
forbid: [ forbid: [
['huashen'], ["huashen"],
['rehuashen'], ["rehuashen"],
['xinmanjuan'], ["xinmanjuan"],
//['xinleiji','fuji'], //['xinleiji','fuji'],
['xinleiji','xinfu_jijun'], ["xinleiji", "xinfu_jijun"],
['reluanji','jueqing'], ["reluanji", "jueqing"],
['lianying','rende'], ["lianying", "rende"],
['lianying','anxian'], ["lianying", "anxian"],
['lianying','yinguo'], ["lianying", "yinguo"],
['lianying','qingjian'], ["lianying", "qingjian"],
['boss_juejing','rende'], ["boss_juejing", "rende"],
['boss_juejing','anxian'], ["boss_juejing", "anxian"],
['boss_juejing','yinguo'], ["boss_juejing", "yinguo"],
['boss_juejing','qingjian'], ["boss_juejing", "qingjian"],
['shangshi','rende'], ["shangshi", "rende"],
['shangshi','anxian'], ["shangshi", "anxian"],
['shangshi','yinguo'], ["shangshi", "yinguo"],
['shangshi','qingjian'], ["shangshi", "qingjian"],
['rende','relianying'], ["rende", "relianying"],
['anxian','relianying'], ["anxian", "relianying"],
['yinguo','relianying'], ["yinguo", "relianying"],
['shenxing','relianying'], ["shenxing", "relianying"],
['qingjian','relianying'], ["qingjian", "relianying"],
['rende','yuling'], ["rende", "yuling"],
['anxian','yuling'], ["anxian", "yuling"],
['yinguo','yuling'], ["yinguo", "yuling"],
['qingjian','yuling'], ["qingjian", "yuling"],
//['qingnang','yiji'], //['qingnang','yiji'],
//['qingnang','reyiji'], //['qingnang','reyiji'],
//['qingjian','tuntian'], //['qingjian','tuntian'],
// ['yiji','tuntian'], // ['yiji','tuntian'],
// ['reyiji','tuntian'], // ['reyiji','tuntian'],
['tuntian','guidao'], ["tuntian", "guidao"],
['tuntian','tiandao'], ["tuntian", "tiandao"],
['tuntian','huanshi'], ["tuntian", "huanshi"],
// ['tuntian','guicai'], // ['tuntian','guicai'],
// ['jiang','chongzhen'], // ['jiang','chongzhen'],
// ['fenji','yuling'], // ['fenji','yuling'],
['jiushi','guixin'], ["jiushi", "guixin"],
['xiuhua','qiaoxie'], ["xiuhua", "qiaoxie"],
['xiuhua','xuanfeng'], ["xiuhua", "xuanfeng"],
['xiuhua','duanxing'], ["xiuhua", "duanxing"],
['xiuhua','xiaoji'], ["xiuhua", "xiaoji"],
['xiuhua','xiaoji'], ["xiuhua", "xiaoji"],
// ['jiushi','jushou'], // ['jiushi','jushou'],
// ['jiushi','kuiwei'], // ['jiushi','kuiwei'],
['zishu','xinfu_songsang'], ["zishu", "xinfu_songsang"],
['zishu','shenxing'], ["zishu", "shenxing"],
['minishendao','luoshen'], ["minishendao", "luoshen"],
['minishendao','reluoshen'], ["minishendao", "reluoshen"],
['akane_quanqing','lianying'], ["akane_quanqing", "lianying"],
['akane_quanqing','relianying'], ["akane_quanqing", "relianying"],
['akane_quanqing','shangshi'], ["akane_quanqing", "shangshi"],
['dcruyi','cxliushi'], ["dcruyi", "cxliushi"],
] ],
}; };

View File

@ -1,26 +1,25 @@
var fs=require('fs'); var fs = require("fs");
var path=require('path'); var path = require("path");
var exec = require('child_process').exec; var exec = require("child_process").exec;
global.window = global; global.window = global;
require(__dirname+'/update.js'); require(__dirname + "/update.js");
require(__dirname+'/asset.js'); require(__dirname + "/asset.js");
var updates = window.noname_update; var updates = window.noname_update;
var newversion = false; var newversion = false;
var commit=false var commit = false;
if (process.argv[2]) { if (process.argv[2]) {
if (/[0-9]/.test(process.argv[2][0])) { if (/[0-9]/.test(process.argv[2][0])) {
newversion = true; newversion = true;
updates.update = updates.version; updates.update = updates.version;
updates.version = '1.9.' + process.argv[2]; updates.version = "1.9." + process.argv[2];
commit = updates.version; commit = updates.version;
} } else {
else{
commit = process.argv[2]; commit = process.argv[2];
} }
} }
var assetlist=''; var assetlist = "";
var skinlist='window.noname_skin_list={\n'; var skinlist = "window.noname_skin_list={\n";
var entrylist = []; var entrylist = [];
var entrymap = {}; var entrymap = {};
var get = function (dir, callback) { var get = function (dir, callback) {
@ -30,33 +29,41 @@ var get = function(dir,callback){
var filename = list.shift(); var filename = list.shift();
var delay = false; var delay = false;
if (!/\.|~|_/.test(filename[0])) { if (!/\.|~|_/.test(filename[0])) {
var url=dir+'/'+filename; var url = dir + "/" + filename;
var stat = fs.statSync(url); var stat = fs.statSync(url);
if (stat.isFile()) { if (stat.isFile()) {
if(['.jpg','.png','.mp3','.ttf'].indexOf(path.extname(url))!=-1){ if (
var assetentry=path.relative(path.dirname(__dirname),url); [".jpg", ".png", ".mp3", ".ttf"].indexOf(
assetlist+=',\n\t\''+assetentry+'\''; path.extname(url)
) != -1
) {
var assetentry = path.relative(
path.dirname(__dirname),
url
);
assetlist += ",\n\t'" + assetentry + "'";
entrylist.push(assetentry); entrylist.push(assetentry);
} }
} } else if (stat.isDirectory()) {
else if(stat.isDirectory()){ if (dir == path.dirname(__dirname) + "/image/skin") {
if(dir==path.dirname(__dirname)+'/image/skin'){
fs.readdir(url, function (err, list) { fs.readdir(url, function (err, list) {
var num = 0; var num = 0;
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
var url2=url+'/'+list[i]; var url2 = url + "/" + list[i];
var stat = fs.statSync(url2); var stat = fs.statSync(url2);
if(stat.isFile()&&path.extname(url2)=='.jpg'){ if (
stat.isFile() &&
path.extname(url2) == ".jpg"
) {
num++; num++;
} }
} }
skinlist+='\t'+filename+':'+num+',\n'; skinlist += "\t" + filename + ":" + num + ",\n";
entrymap[filename] = num; entrymap[filename] = num;
shift(); shift();
}); });
delay = true; delay = true;
} } else {
else{
get(url, shift); get(url, shift);
delay = true; delay = true;
} }
@ -65,16 +72,14 @@ var get = function(dir,callback){
if (!delay) { if (!delay) {
shift(); shift();
} }
} } else {
else{
callback(); callback();
} }
} };
shift(); shift();
}); });
}; };
get(path.dirname(__dirname), function () { get(path.dirname(__dirname), function () {
var diff = false; var diff = false;
if (window.noname_asset_list.length == entrylist.length + 1) { if (window.noname_asset_list.length == entrylist.length + 1) {
@ -98,79 +103,96 @@ get(path.dirname(__dirname),function(){
} }
} }
} }
} } else {
else{
diff = true; diff = true;
} }
var next = function () { var next = function () {
exec('git diff --name-only', (error, stdout, stderr) => { exec("git diff --name-only", (error, stdout, stderr) => {
var updatelist='window.noname_update={\n\tversion:\''+updates.version+'\','; var updatelist =
updatelist+='\n\tupdate:\''+(updates.update||'')+'\','; "window.noname_update={\n\tversion:'" + updates.version + "',";
updatelist += "\n\tupdate:'" + (updates.update || "") + "',";
var apply = function (name, list) { var apply = function (name, list) {
updatelist+='\n\t'+name+':[\n'; updatelist += "\n\t" + name + ":[\n";
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
updatelist+='\t\t\''+list[i]+'\''; updatelist += "\t\t'" + list[i] + "'";
if (i < list.length - 1) { if (i < list.length - 1) {
updatelist+=','; updatelist += ",";
} }
updatelist+='\n'; updatelist += "\n";
} }
updatelist+='\t]'; updatelist += "\t]";
}; };
if (updates.changeLog) { if (updates.changeLog) {
apply('changeLog',updates.changeLog); apply("changeLog", updates.changeLog);
updatelist+=','; updatelist += ",";
} }
if (updates.players) { if (updates.players) {
apply('players',updates.players); apply("players", updates.players);
updatelist+=','; updatelist += ",";
} }
if (updates.cards) { if (updates.cards) {
apply('cards',updates.cards); apply("cards", updates.cards);
updatelist+=','; updatelist += ",";
} }
var changes = stdout.split('\n'); var changes = stdout.split("\n");
for (var i = 0; i < changes.length; i++) { for (var i = 0; i < changes.length; i++) {
var extname = path.extname(changes[i]); var extname = path.extname(changes[i]);
if(!changes[i]||(extname!='.js'&&extname!='.css')||changes[i]=='game/update.js'){ if (
!changes[i] ||
(extname != ".js" && extname != ".css") ||
changes[i] == "game/update.js"
) {
changes.splice(i--, 1); changes.splice(i--, 1);
} }
} }
var files; var files;
if (newversion) { if (newversion) {
files = []; files = [];
} } else {
else{
files = updates.files || []; files = updates.files || [];
} }
for (var i = 0; i < changes.length; i++) { for (var i = 0; i < changes.length; i++) {
if (files.indexOf(changes[i]) === -1) { if (files.indexOf(changes[i]) === -1) {
files.push(changes[i]) files.push(changes[i]);
} }
} }
files.sort(function (a, b) { files.sort(function (a, b) {
if (a > b) return 1; if (a > b) return 1;
if (a < b) return -1; if (a < b) return -1;
return 0; return 0;
})
apply('files',files);
fs.writeFile('game/update.js',updatelist+'\n};','utf-8',function(){
console.log('updated update.js');
if(commit && typeof commit==='string'){
exec('git add . && git commit -am '+commit);
console.log('committed '+commit);
}
});
}); });
apply("files", files);
fs.writeFile(
"game/update.js",
updatelist + "\n};",
"utf-8",
function () {
console.log("updated update.js");
if (commit && typeof commit === "string") {
exec("git add . && git commit -am " + commit);
console.log("committed " + commit);
} }
}
);
});
};
if (diff) { if (diff) {
var assetversion='window.noname_asset_list=[\n\t\''+updates.version+'\''; var assetversion =
fs.writeFile('game/asset.js',assetversion+assetlist+'\n];\n'+skinlist.slice(0,skinlist.length-2)+'\n};','utf-8',function(){ "window.noname_asset_list=[\n\t'" + updates.version + "'";
console.log('udpated asset.js'); fs.writeFile(
"game/asset.js",
assetversion +
assetlist +
"\n];\n" +
skinlist.slice(0, skinlist.length - 2) +
"\n};",
"utf-8",
function () {
console.log("udpated asset.js");
next(); next();
});
} }
else{ );
} else {
next(); next();
} }
}); });

View File

@ -3,15 +3,19 @@ import { canUseHttpProtocol, sendUpdate } from "../noname/init/index.js";
import { userAgent } from "../noname/util/index.js"; import { userAgent } from "../noname/util/index.js";
const coreAndVersion = get.coreInfo(); const coreAndVersion = get.coreInfo();
const core = coreAndVersion[0], version = coreAndVersion[1]; const core = coreAndVersion[0],
version = coreAndVersion[1];
//@todo: 77 -> 80 //@todo: 77 -> 80
if (core === 'chrome' && !isNaN(version) && version < 77) { if (core === "chrome" && !isNaN(version) && version < 77) {
const tip = '检测到您的浏览器内核版本小于77请及时升级浏览器或手机webview内核'; const tip =
"检测到您的浏览器内核版本小于77请及时升级浏览器或手机webview内核";
console.warn(tip); console.warn(tip);
game.print(tip); game.print(tip);
const redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n目前使用的浏览器UA信息为\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端可能需要科学上网`; const redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n目前使用的浏览器UA信息为\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端可能需要科学上网`;
if (confirm(redirect_tip)) { if (confirm(redirect_tip)) {
window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); window.open(
"https://github.com/libccy/noname/releases/tag/chromium77-client"
);
} }
} }
@ -27,10 +31,15 @@ boot().then(() => {
// 导出数据到根目录的noname.config.txt // 导出数据到根目录的noname.config.txt
let data; let data;
let export_data = function (data) { let export_data = function (data) {
game.promises.writeFile(lib.init.encode(JSON.stringify(data)), './', 'noname.config.txt') game.promises
.writeFile(
lib.init.encode(JSON.stringify(data)),
"./",
"noname.config.txt"
)
.then(saveProtocol) .then(saveProtocol)
.catch(e => { .catch((e) => {
console.error('升级失败:', e); console.error("升级失败:", e);
}); });
}; };
// @ts-ignore // @ts-ignore
@ -42,13 +51,12 @@ boot().then(() => {
} }
} }
export_data(data); export_data(data);
} } else {
else { game.getDB("config", null, function (data1) {
game.getDB('config', null, function (data1) { game.getDB("data", null, function (data2) {
game.getDB('data', null, function (data2) {
export_data({ export_data({
config: data1, config: data1,
data: data2 data: data2,
}); });
}); });
}); });
@ -56,10 +64,13 @@ boot().then(() => {
// 保存协议的切换状态 // 保存协议的切换状态
function saveProtocol() { function saveProtocol() {
const url = sendUpdate(); const url = sendUpdate();
if (typeof url == 'string') { if (typeof url == "string") {
if (typeof window.require == 'function' && typeof window.process == 'object') { if (
typeof window.require == "function" &&
typeof window.process == "object"
) {
// @ts-ignore // @ts-ignore
const remote = require('@electron/remote'); const remote = require("@electron/remote");
const thisWindow = remote.getCurrentWindow(); const thisWindow = remote.getCurrentWindow();
thisWindow.loadURL(url); thisWindow.loadURL(url);
} else { } else {
@ -71,62 +82,86 @@ boot().then(() => {
// 成功导入后删除noname.config.txt // 成功导入后删除noname.config.txt
let searchParams = new URLSearchParams(location.search); let searchParams = new URLSearchParams(location.search);
for (let [key, value] of searchParams) { for (let [key, value] of searchParams) {
if (key === 'sendUpdate' && value === 'true') { if (key === "sendUpdate" && value === "true") {
game.promises.readFileAsText('noname.config.txt').then(data => { game.promises
return /** @type {Promise<void>} */(new Promise(async (resolve, reject) => { .readFileAsText("noname.config.txt")
if (!data) return reject('!data'); .then((data) => {
return /** @type {Promise<void>} */ (
new Promise(async (resolve, reject) => {
if (!data) return reject("!data");
try { try {
data = JSON.parse(lib.init.decode(data)); data = JSON.parse(lib.init.decode(data));
if (!data || typeof data != 'object') { if (!data || typeof data != "object") {
throw ('err'); throw "err";
} }
// @ts-ignore // @ts-ignore
if (lib.db && (!data.config || !data.data)) { if (
throw ('err'); lib.db &&
(!data.config || !data.data)
) {
throw "err";
} }
} } catch (e) {
catch (e) {
console.log(e); console.log(e);
if (e == 'err') { if (e == "err") {
alert('导入文件格式不正确'); alert("导入文件格式不正确");
reject('导入文件格式不正确'); reject("导入文件格式不正确");
} else { } else {
alert('导入失败: ' + e.message); alert("导入失败: " + e.message);
reject('导入失败: ' + e.message); reject("导入失败: " + e.message);
} }
return; return;
} }
alert('导入成功, 即将自动重启'); alert("导入成功, 即将自动重启");
// @ts-ignore // @ts-ignore
if (!lib.db) { if (!lib.db) {
const noname_inited = localStorage.getItem('noname_inited'); const noname_inited =
const onlineKey = localStorage.getItem(lib.configprefix + 'key'); localStorage.getItem("noname_inited");
const onlineKey = localStorage.getItem(
lib.configprefix + "key"
);
localStorage.clear(); localStorage.clear();
if (noname_inited) { if (noname_inited) {
localStorage.setItem('noname_inited', noname_inited); localStorage.setItem(
"noname_inited",
noname_inited
);
} }
if (onlineKey) { if (onlineKey) {
localStorage.setItem(lib.configprefix + 'key', onlineKey); localStorage.setItem(
lib.configprefix + "key",
onlineKey
);
} }
for (let i in data) { for (let i in data) {
localStorage.setItem(i, data[i]); localStorage.setItem(i, data[i]);
} }
} } else {
else {
for (let i in data.config) { for (let i in data.config) {
await game.putDB('config', i, data.config[i]); await game.putDB(
"config",
i,
data.config[i]
);
lib.config[i] = data.config[i]; lib.config[i] = data.config[i];
} }
for (let i in data.data) { for (let i in data.data) {
await game.putDB('data', i, data.data[i]); await game.putDB(
"data",
i,
data.data[i]
);
} }
} }
lib.init.background(); lib.init.background();
resolve(); resolve();
})); })
}).then(() => { );
return game.promises.removeFile('noname.config.txt'); })
}).then(() => { .then(() => {
return game.promises.removeFile("noname.config.txt");
})
.then(() => {
const url = new URL(location.href); const url = new URL(location.href);
location.href = url.origin + url.pathname; location.href = url.origin + url.pathname;
}); });
@ -134,4 +169,3 @@ boot().then(() => {
} }
} }
}); });

View File

@ -1,35 +1,51 @@
"use strict"; "use strict";
new Promise(resolve => { new Promise((resolve) => {
// 客户端自带core.js的请注意跟进core.js版本 // 客户端自带core.js的请注意跟进core.js版本
if ('__core-js_shared__' in window) resolve(null); if ("__core-js_shared__" in window) resolve(null);
else { else {
const nonameInitialized = localStorage.getItem('noname_inited'); const nonameInitialized = localStorage.getItem("noname_inited");
const assetURL = location.protocol.startsWith('http') || typeof nonameInitialized != 'string' || nonameInitialized == 'nodejs' ? '' : nonameInitialized; const assetURL =
const coreJSBundle = document.createElement('script'); location.protocol.startsWith("http") ||
typeof nonameInitialized != "string" ||
nonameInitialized == "nodejs"
? ""
: nonameInitialized;
const coreJSBundle = document.createElement("script");
coreJSBundle.onerror = coreJSBundle.onload = resolve; coreJSBundle.onerror = coreJSBundle.onload = resolve;
coreJSBundle.src = `${assetURL}game/core-js-bundle.js`; coreJSBundle.src = `${assetURL}game/core-js-bundle.js`;
document.head.appendChild(coreJSBundle); document.head.appendChild(coreJSBundle);
} }
}).then(() => { }).then(() => {
const nonameInitialized = localStorage.getItem('noname_inited'); const nonameInitialized = localStorage.getItem("noname_inited");
const assetURL = location.protocol.startsWith('http') || typeof nonameInitialized != 'string' || nonameInitialized == 'nodejs' ? '' : nonameInitialized; const assetURL =
location.protocol.startsWith("http") ||
typeof nonameInitialized != "string" ||
nonameInitialized == "nodejs"
? ""
: nonameInitialized;
const userAgent = navigator.userAgent.toLowerCase(); const userAgent = navigator.userAgent.toLowerCase();
const exit = () => { const exit = () => {
const ios = userAgent.includes('iphone') || userAgent.includes('ipad') || userAgent.includes('macintosh'); const ios =
userAgent.includes("iphone") ||
userAgent.includes("ipad") ||
userAgent.includes("macintosh");
//electron //electron
if (typeof window.process == 'object' && typeof window.require == 'function') { if (
typeof window.process == "object" &&
typeof window.require == "function"
) {
const versions = window.process.versions; const versions = window.process.versions;
// @ts-ignore // @ts-ignore
const electronVersion = parseFloat(versions.electron); const electronVersion = parseFloat(versions.electron);
let remote; let remote;
if (electronVersion >= 14) { if (electronVersion >= 14) {
// @ts-ignore // @ts-ignore
remote = require('@electron/remote'); remote = require("@electron/remote");
} else { } else {
// @ts-ignore // @ts-ignore
remote = require('electron').remote; remote = require("electron").remote;
} }
const thisWindow = remote.getCurrentWindow(); const thisWindow = remote.getCurrentWindow();
thisWindow.destroy(); thisWindow.destroy();
@ -44,108 +60,128 @@ new Promise(resolve => {
}; };
// 这个弹窗在升级到http协议下的客户端不应该进行提示。 // 这个弹窗在升级到http协议下的客户端不应该进行提示。
if (!localStorage.getItem('gplv3_noname_alerted')) { if (!localStorage.getItem("gplv3_noname_alerted")) {
const nonameInitialized = localStorage.getItem('noname_inited'); const nonameInitialized = localStorage.getItem("noname_inited");
const callback = () => { const callback = () => {
if (confirm('①无名杀是一款基于GPLv3协议的开源软件\n你可以在遵守GPLv3协议的基础上任意使用修改并转发《无名杀》以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库\n其他所有的所谓“无名杀”社群包括但不限于绝大多数“官方”QQ群、QQ频道等均为玩家自发组织与无名杀官方无关')) { if (
confirm(
"①无名杀是一款基于GPLv3协议的开源软件\n你可以在遵守GPLv3协议的基础上任意使用修改并转发《无名杀》以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库\n其他所有的所谓“无名杀”社群包括但不限于绝大多数“官方”QQ群、QQ频道等均为玩家自发组织与无名杀官方无关"
)
) {
// @ts-ignore // @ts-ignore
localStorage.setItem('gplv3_noname_alerted', true); localStorage.setItem("gplv3_noname_alerted", true);
} } else {
else {
exit(); exit();
} }
}; };
if (location.protocol.startsWith('http')) { if (location.protocol.startsWith("http")) {
if (!nonameInitialized || nonameInitialized.length == 0) { if (!nonameInitialized || nonameInitialized.length == 0) {
callback(); callback();
} else { } else {
// @ts-ignore // @ts-ignore
localStorage.setItem('gplv3_noname_alerted', true); localStorage.setItem("gplv3_noname_alerted", true);
} }
} else callback(); } else callback();
} }
window['b' + 'ann' + 'e' + 'dE' + 'x' + 'ten' + 's' + 'i' + 'o' + 'ns'] = ['\u4fa0\u4e49', '\u5168\u6559\u7a0b']; window["b" + "ann" + "e" + "dE" + "x" + "ten" + "s" + "i" + "o" + "ns"] = [
"\u4fa0\u4e49",
"\u5168\u6559\u7a0b",
];
/** /**
* *
* @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} * @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]}
*/ */
function coreInfo() { function coreInfo() {
const regex = /(firefox|chrome|safari)\/(\d+(?:\.\d+)+)/ const regex = /(firefox|chrome|safari)\/(\d+(?:\.\d+)+)/;
let result let result;
if (!(result = userAgent.match(regex))) return ["other", NaN, NaN, NaN] if (!(result = userAgent.match(regex))) return ["other", NaN, NaN, NaN];
if (result[1] != "safari") { if (result[1] != "safari") {
const [major, minor, patch] = result[2].split(".") const [major, minor, patch] = result[2].split(".");
// @ts-ignore // @ts-ignore
return [result[1], parseInt(major), parseInt(minor), parseInt(patch)] return [
result[1],
parseInt(major),
parseInt(minor),
parseInt(patch),
];
} }
result = userAgent.match(/version\/(\d+(?:\.\d+)+).*safari/) result = userAgent.match(/version\/(\d+(?:\.\d+)+).*safari/);
// @ts-ignore // @ts-ignore
const [major, minor, patch] = result[1].split(".") const [major, minor, patch] = result[1].split(".");
return ["safari", parseInt(major), parseInt(minor), parseInt(patch)] return ["safari", parseInt(major), parseInt(minor), parseInt(patch)];
} }
const [core, major, minor, patch] = coreInfo(); const [core, major, minor, patch] = coreInfo();
const supportMap = { const supportMap = {
"firefox": [60, 0, 0], firefox: [60, 0, 0],
"chrome": [61, 0, 0], chrome: [61, 0, 0],
"safari": [14, 5, 0] safari: [14, 5, 0],
} };
const versions = [major, minor, patch] const versions = [major, minor, patch];
// require是需求的版本号current是浏览器环境本身的版本号 // require是需求的版本号current是浏览器环境本身的版本号
const check = (require, current) => { const check = (require, current) => {
// 防止不存在的意外,提前截断当前版本号的长度 // 防止不存在的意外,提前截断当前版本号的长度
if (current.length > require.length) current.length = require.length if (current.length > require.length) current.length = require.length;
// 考虑到玄学的NaN情况记录是否存在NaN // 考虑到玄学的NaN情况记录是否存在NaN
let flag = false let flag = false;
// 从主版本号遍历到修订版本号,只考虑当前版本号的长度 // 从主版本号遍历到修订版本号,只考虑当前版本号的长度
for (let i = 0; i < current.length; ++i) { for (let i = 0; i < current.length; ++i) {
// 当前环境版本号当前位若是NaN则记录后直接到下一位 // 当前环境版本号当前位若是NaN则记录后直接到下一位
if (isNaN(current[i])) { if (isNaN(current[i])) {
flag = true flag = true;
continue continue;
} }
// 如果此时flag为true且current[i]不为NaN版本号则不合法直接否 // 如果此时flag为true且current[i]不为NaN版本号则不合法直接否
if (flag) return false if (flag) return false;
// 上位版本号未达到要求,直接否决 // 上位版本号未达到要求,直接否决
if (require[i] > current[i]) return false if (require[i] > current[i]) return false;
// 上位版本号已超过要求,直接可行 // 上位版本号已超过要求,直接可行
if (current[i] > require[i]) return true if (current[i] > require[i]) return true;
}
return true
} }
return true;
};
if (core in supportMap && !check(supportMap[core], versions)) { if (core in supportMap && !check(supportMap[core], versions)) {
const tip = '检测到您的浏览器内核版本无法支持当前无名杀所需的功能请立即升级浏览器或手机webview内核'; const tip =
"检测到您的浏览器内核版本无法支持当前无名杀所需的功能请立即升级浏览器或手机webview内核";
console.error(tip); console.error(tip);
let redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,已经无法正常运行无名杀!\n目前使用的浏览器UA信息为\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端可能需要科学上网\n稍后您的无名杀将自动退出(可能的话)`; let redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,已经无法正常运行无名杀!\n目前使用的浏览器UA信息为\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端可能需要科学上网\n稍后您的无名杀将自动退出(可能的话)`;
if (core === 'safari') { if (core === "safari") {
alert(`您使用的safari浏览器无法支持当前无名杀所需的功能请至少升级至14.5.0\n稍后您的无名杀将自动退出(可能的话)`); alert(
`您使用的safari浏览器无法支持当前无名杀所需的功能请至少升级至14.5.0\n稍后您的无名杀将自动退出(可能的话)`
);
} else { } else {
if (confirm(redirect_tip)) { if (confirm(redirect_tip)) {
window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); window.open(
"https://github.com/libccy/noname/releases/tag/chromium77-client"
);
} }
} }
exit(); exit();
} } else {
else {
// node环境下 // node环境下
if (typeof window.require == 'function' && if (
typeof window.process == 'object' && typeof window.require == "function" &&
typeof window.__dirname == 'string') { typeof window.process == "object" &&
typeof window.__dirname == "string"
) {
// 在http环境下修改__dirname和require的逻辑 // 在http环境下修改__dirname和require的逻辑
if (location.protocol.startsWith('http') && if (
window.__dirname.endsWith('electron.asar\\renderer')) { location.protocol.startsWith("http") &&
const path = require('path'); window.__dirname.endsWith("electron.asar\\renderer")
window.__dirname = path.join(path.resolve(), 'resources/app'); ) {
const path = require("path");
window.__dirname = path.join(path.resolve(), "resources/app");
const oldData = Object.entries(window.require); const oldData = Object.entries(window.require);
// @ts-ignore // @ts-ignore
window.require = function (moduleId) { window.require = function (moduleId) {
try { try {
return module.require(moduleId); return module.require(moduleId);
} catch { } catch {
return module.require(path.join(window.__dirname, moduleId)); return module.require(
path.join(window.__dirname, moduleId)
);
} }
}; };
oldData.forEach(([key, value]) => { oldData.forEach(([key, value]) => {
@ -153,7 +189,7 @@ new Promise(resolve => {
}); });
} }
// 增加导入ts的逻辑 // 增加导入ts的逻辑
window.require.extensions['.ts'] = function (module, filename) { window.require.extensions[".ts"] = function (module, filename) {
// @ts-ignore // @ts-ignore
const _compile = module._compile; const _compile = module._compile;
// @ts-ignore // @ts-ignore
@ -162,69 +198,102 @@ new Promise(resolve => {
* @type { import('typescript') } * @type { import('typescript') }
*/ */
// @ts-ignore // @ts-ignore
const ts = require('./game/typescript.js'); const ts = require("./game/typescript.js");
// 使用ts compiler对ts文件进行编译 // 使用ts compiler对ts文件进行编译
const result = ts.transpile(code, { const result = ts.transpile(
code,
{
module: ts.ModuleKind.CommonJS, module: ts.ModuleKind.CommonJS,
//@todo: ES2019 -> ES2020 //@todo: ES2019 -> ES2020
target: ts.ScriptTarget.ES2019, target: ts.ScriptTarget.ES2019,
inlineSourceMap: true, inlineSourceMap: true,
resolveJsonModule: true, resolveJsonModule: true,
esModuleInterop: true, esModuleInterop: true,
}, fileName); },
fileName
);
// 使用默认的js编译函数获取返回值 // 使用默认的js编译函数获取返回值
return _compile.call(this, result, fileName); return _compile.call(this, result, fileName);
} };
// @ts-ignore // @ts-ignore
module._compile(require('fs').readFileSync(filename, 'utf8'), filename); module._compile(
require("fs").readFileSync(filename, "utf8"),
filename
);
}; };
} }
// 使serviceWorker加载完成后再加载entry.js // 使serviceWorker加载完成后再加载entry.js
const loadEntryJs = () => { const loadEntryJs = () => {
const script = document.createElement('script') const script = document.createElement("script");
script.type = "module"; script.type = "module";
script.src = `${assetURL}game/entry.js`; script.src = `${assetURL}game/entry.js`;
script.async = true; script.async = true;
script.onerror = event => { script.onerror = (event) => {
console.error(event); console.error(event);
const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n请检查是否缺少游戏文件!隔版本更新请下载完整包而不是离线包!\n目前使用的浏览器UA信息为\n${userAgent}\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》请尝试更新手机的WebView内核或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏请改为运行文件夹内的“noname-server.exe”或使用VSCode等工具启动Live Server以动态服务器的方式启动《无名杀》\n若您使用的是苹果端请至少将Safari升级至14.5.0`; const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n请检查是否缺少游戏文件!隔版本更新请下载完整包而不是离线包!\n目前使用的浏览器UA信息为\n${userAgent}\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》请尝试更新手机的WebView内核或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏请改为运行文件夹内的“noname-server.exe”或使用VSCode等工具启动Live Server以动态服务器的方式启动《无名杀》\n若您使用的是苹果端请至少将Safari升级至14.5.0`;
console.error(message); console.error(message);
alert(message); alert(message);
exit(); exit();
} };
document.head.appendChild(script); document.head.appendChild(script);
}; };
if (location.protocol.startsWith('http') && 'serviceWorker' in navigator) { if (
let scope = window.location.protocol + '//' + window.location.host + '/'; location.protocol.startsWith("http") &&
navigator.serviceWorker.getRegistrations() "serviceWorker" in navigator
.then(async registrations => { ) {
let findServiceWorker = registrations.find(registration => { let scope =
return registration && registration.active && registration.active.scriptURL == `${scope}service-worker.js`; window.location.protocol + "//" + window.location.host + "/";
}); navigator.serviceWorker
.getRegistrations()
.then(async (registrations) => {
let findServiceWorker = registrations.find(
(registration) => {
return (
registration &&
registration.active &&
registration.active.scriptURL ==
`${scope}service-worker.js`
);
}
);
try { try {
const registration_1 = await navigator.serviceWorker.register(`${scope}service-worker.js`, { const registration_1 =
type: 'module', await navigator.serviceWorker.register(
`${scope}service-worker.js`,
{
type: "module",
updateViaCache: "all", updateViaCache: "all",
scope, scope,
}); }
);
// 初次加载worker需要重新启动一次 // 初次加载worker需要重新启动一次
if (!findServiceWorker) location.reload(); if (!findServiceWorker) location.reload();
// 接收消息,暂时没用到 // 接收消息,暂时没用到
navigator.serviceWorker.addEventListener('message', e => { navigator.serviceWorker.addEventListener(
"message",
(e) => {
console.log(e); console.log(e);
}); }
registration_1.update().catch(e => console.error('worker update失败', e)); );
if (!sessionStorage.getItem('canUseTs')) { registration_1
await import('./canUse.ts').then(({ text }) => console.log(text)).catch(() => { .update()
sessionStorage.setItem('canUseTs', '1'); .catch((e) =>
console.error("worker update失败", e)
);
if (!sessionStorage.getItem("canUseTs")) {
await import("./canUse.ts")
.then(({ text }) => console.log(text))
.catch(() => {
sessionStorage.setItem("canUseTs", "1");
location.reload(); location.reload();
}); });
} }
} catch (e_1) { } catch (e_1) {
console.log('serviceWorker加载失败: ', e_1); console.log("serviceWorker加载失败: ", e_1);
} }
}).finally(loadEntryJs); })
.finally(loadEntryJs);
} else { } else {
loadEntryJs(); loadEntryJs();
} }

View File

@ -1,86 +1,110 @@
var http = require('http'); var http = require("http");
var fs = require('fs'); var fs = require("fs");
var server = new http.Server(); var server = new http.Server();
server.listen(80); server.listen(80);
server.on('request', function(request, response) { server.on("request", function (request, response) {
var url = require('url').parse(request.url); var url = require("url").parse(request.url);
switch (url.pathname) { switch (url.pathname) {
case ''||'/' : case "" || "/":
fs.readFile('./index.html', function(err, content){ fs.readFile("./index.html", function (err, content) {
if (err) { if (err) {
response.writeHead(404, { 'Content-Type':'text/plain; charset="UTF-8"' }); response.writeHead(404, {
"Content-Type": 'text/plain; charset="UTF-8"',
});
response.write(err.message); response.write(err.message);
response.end(); response.end();
} else { } else {
response.writeHead(200, { 'Content-Type' : 'text/html; charset=UTF-8' }); response.writeHead(200, {
"Content-Type": "text/html; charset=UTF-8",
});
response.write(content); response.write(content);
response.end(); response.end();
} }
}); });
break; break;
case '/test/delay': case "/test/delay":
var delay = parseInt(url.query) || 2000; var delay = parseInt(url.query) || 2000;
response.writeHead(200, {'Content-type':'text/plain; charset=UTF-8'}); response.writeHead(200, {
response.write('Sleeping for' + delay + ' milliseconds...'); "Content-type": "text/plain; charset=UTF-8",
});
response.write("Sleeping for" + delay + " milliseconds...");
setTimeout(function () { setTimeout(function () {
response.write('done.'); response.write("done.");
response.end(); response.end();
}, delay); }, delay);
break; break;
case '/test/mirror': case "/test/mirror":
response.writeHead(200, {'Content-type':'text/plain; charset=UTF-8'}); response.writeHead(200, {
response.write(request.mothod + ' ' + request.url + ' HTTP/' + request.httpVersion + '\r\n'); "Content-type": "text/plain; charset=UTF-8",
});
response.write(
request.mothod +
" " +
request.url +
" HTTP/" +
request.httpVersion +
"\r\n"
);
for (var h in request.headers) { for (var h in request.headers) {
response.write(h + ':' + request.headers[h] + '\r\n'); response.write(h + ":" + request.headers[h] + "\r\n");
} }
response.write('\r\n'); response.write("\r\n");
request.on('data', function(chunk) { response.write(chunk); }); request.on("data", function (chunk) {
request.on('end', function(chunk){ response.end(); }); response.write(chunk);
});
request.on("end", function (chunk) {
response.end();
});
break; break;
case '/json' : case "/json":
response.writeHead(200, {'Content-type':'application/json; charset=UTF-8'}); response.writeHead(200, {
response.write(JSON.stringify({test:'success'})); "Content-type": "application/json; charset=UTF-8",
});
response.write(JSON.stringify({ test: "success" }));
response.end(); response.end();
break; break;
default: default:
var filename = url.pathname.substring(1); var filename = url.pathname.substring(1);
var type = getType(filename.substring(filename.lastIndexOf('.')+1)); var type = getType(
filename.substring(filename.lastIndexOf(".") + 1)
);
fs.readFile(filename, function (err, content) { fs.readFile(filename, function (err, content) {
if (err) { if (err) {
response.writeHead(404, { 'Content-Type':'text/plain; charset="UTF-8"' }); response.writeHead(404, {
"Content-Type": 'text/plain; charset="UTF-8"',
});
response.write(err.message); response.write(err.message);
response.end(); response.end();
} else { } else {
response.writeHead(200, { 'Content-Type' : type }); response.writeHead(200, { "Content-Type": type });
response.write(content); response.write(content);
response.end(); response.end();
} }
}); });
break; break;
} }
}); });
function getType(endTag) { function getType(endTag) {
var type = null; var type = null;
switch (endTag) { switch (endTag) {
case 'html' : case "html":
case 'htm' : case "htm":
type = 'text/html; charset=UTF-8'; type = "text/html; charset=UTF-8";
break; break;
case 'js' : case "js":
type = 'application/javascript; charset="UTF-8"'; type = 'application/javascript; charset="UTF-8"';
break; break;
case 'css' : case "css":
type = 'text/css; charset="UTF-8"'; type = 'text/css; charset="UTF-8"';
break; break;
case 'txt' : case "txt":
type = 'text/plain; charset="UTF-8"'; type = 'text/plain; charset="UTF-8"';
break; break;
case 'manifest' : case "manifest":
type = 'text/cache-manifest; charset="UTF-8"'; type = 'text/cache-manifest; charset="UTF-8"';
break; break;
default: default:
type = 'application/octet-stream'; type = "application/octet-stream";
break; break;
} }
return type; return type;

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +1,144 @@
window.noname_package = { window.noname_package = {
character: { character: {
standard:'标准', standard: "标准",
refresh:'界限突破', refresh: "界限突破",
shenhua:'神话再临', shenhua: "神话再临",
yijiang:'一将成名', yijiang: "一将成名",
sp:'璀璨星河', sp: "璀璨星河",
onlyOL:'OL专属', onlyOL: "OL专属",
yingbian:'文德武备', yingbian: "文德武备",
clan:'门阀士族', clan: "门阀士族",
xinghuoliaoyuan:'星火燎原', xinghuoliaoyuan: "星火燎原",
huicui:'群英荟萃', huicui: "群英荟萃",
xianding:'限定专属', xianding: "限定专属",
sp2:'系列专属', sp2: "系列专属",
extra:'神将', extra: "神将",
mobile:'移动版', mobile: "移动版",
shiji:'始计篇', shiji: "始计篇",
sb:'谋攻篇', sb: "谋攻篇",
tw:'外服武将', tw: "外服武将",
collab:'联动卡', collab: "联动卡",
offline:'线下武将', offline: "线下武将",
jsrg:'江山如故', jsrg: "江山如故",
old:'怀旧', old: "怀旧",
diy:'DIY', diy: "DIY",
ddd:'3D精选', ddd: "3D精选",
yxs:'英雄杀', yxs: "英雄杀",
hearth:'炉石传说', hearth: "炉石传说",
gwent:'昆特牌', gwent: "昆特牌",
mtg:'万智牌', mtg: "万智牌",
ow:'守望先锋', ow: "守望先锋",
swd:'轩辕剑', swd: "轩辕剑",
gujian:'古剑奇谭', gujian: "古剑奇谭",
xianjian:'仙剑奇侠传', xianjian: "仙剑奇侠传",
}, },
card: { card: {
standard:'标准', standard: "标准",
extra:'军争', extra: "军争",
guozhan:'国战', guozhan: "国战",
yingbian:'应变篇', yingbian: "应变篇",
yongjian:'用间篇', yongjian: "用间篇",
sp:'忠胆英杰', sp: "忠胆英杰",
zhulu:'逐鹿天下', zhulu: "逐鹿天下",
yunchou:'运筹帷幄', yunchou: "运筹帷幄",
zhenfa:'阵法', zhenfa: "阵法",
swd:'轩辕剑', swd: "轩辕剑",
gujian:'古剑奇谭', gujian: "古剑奇谭",
hearth:'炉石传说', hearth: "炉石传说",
gwent:'昆特牌', gwent: "昆特牌",
mtg:'万智牌', mtg: "万智牌",
huanlekapai:'欢乐卡牌', huanlekapai: "欢乐卡牌",
}, },
play: { play: {
boss:'诸神降临', boss: "诸神降临",
cardpile:'牌堆补充', cardpile: "牌堆补充",
wuxing:'五行生克', wuxing: "五行生克",
coin:'富甲天下', coin: "富甲天下",
}, },
mode: { mode: {
identity:'身份', identity: "身份",
guozhan:'国战', guozhan: "国战",
versus:'对决', versus: "对决",
connect:'联机', connect: "联机",
boss:'挑战', boss: "挑战",
doudizhu:'斗地主', doudizhu: "斗地主",
single:'单挑', single: "单挑",
chess:'战棋', chess: "战棋",
tafang:'塔防', tafang: "塔防",
stone:'炉石', stone: "炉石",
brawl:'乱斗', brawl: "乱斗",
}, },
submode: { submode: {
identity: { identity: {
normal:'身份模式', normal: "身份模式",
zhong:'忠胆英杰', zhong: "忠胆英杰",
purple:'3v3v2', purple: "3v3v2",
}, },
guozhan: { guozhan: {
normal:'国战模式', normal: "国战模式",
mingjiang:'明将国战' mingjiang: "明将国战",
}, },
versus: { versus: {
four:'四人对抗', four: "四人对抗",
three:'统率三军', three: "统率三军",
two:'欢乐成双', two: "欢乐成双",
jiange:'守卫剑阁', jiange: "守卫剑阁",
siguo:'四国争霸', siguo: "四国争霸",
standard:'自由对决' standard: "自由对决",
}, },
chess: { chess: {
combat:'战棋模式', combat: "战棋模式",
three:'战棋统率', three: "战棋统率",
leader:'战棋君主' leader: "战棋君主",
}, },
single: { single: {
normal:'新1v1', normal: "新1v1",
}, },
}, },
background: { background: {
ol_bg:'龙纹', ol_bg: "龙纹",
planetarian_bg:'星梦', planetarian_bg: "星梦",
heaven_bg:'红烧', heaven_bg: "红烧",
kyoani_bg:'京都', kyoani_bg: "京都",
key_bg:'键社', key_bg: "键社",
xiaowu_bg:'小无', xiaowu_bg: "小无",
noname_bg:'璀璨', noname_bg: "璀璨",
wuming_bg:'无名', wuming_bg: "无名",
zhulin_bg:'竹林', zhulin_bg: "竹林",
shengshi_bg:'盛世', shengshi_bg: "盛世",
taoyuan_bg:'桃园', taoyuan_bg: "桃园",
zhanhuo_bg:'战火', zhanhuo_bg: "战火",
huangtian_bg:'黄天', huangtian_bg: "黄天",
september_bg:'九月', september_bg: "九月",
yinxiang_bg:'印象', yinxiang_bg: "印象",
zhanyun_bg:'战云', zhanyun_bg: "战云",
beipan_bg:'背叛', beipan_bg: "背叛",
lanting_bg:'兰亭', lanting_bg: "兰亭",
lingju_bg:'灵雎', lingju_bg: "灵雎",
sanying_bg:'三英', sanying_bg: "三英",
wangshi_bg:'往事', wangshi_bg: "往事",
xiongxin_bg:'雄心', xiongxin_bg: "雄心",
xinsha_bg:'新杀', xinsha_bg: "新杀",
}, },
music: { music: {
music_phliosophy:'Philosophy of ours', music_phliosophy: "Philosophy of ours",
music_diaochan:'貂蝉', music_diaochan: "貂蝉",
music_shezhan:'舌战群儒', music_shezhan: "舌战群儒",
music_danji:'千里走单骑', music_danji: "千里走单骑",
music_jifeng:'祭风', music_jifeng: "祭风",
music_jilve:'极略', music_jilve: "极略",
}, },
font: { font: {
xiaozhuan:'方正小篆体', xiaozhuan: "方正小篆体",
xinwei:'华文新魏_GBK', xinwei: "华文新魏_GBK",
huangcao:'方正黄草_GBK', huangcao: "方正黄草_GBK",
yuanli:'方正北魏楷书_GBK', yuanli: "方正北魏楷书_GBK",
xingkai:'方正行楷_GBK', xingkai: "方正行楷_GBK",
shousha:'方正隶变_GBK', shousha: "方正隶变_GBK",
}, },
theme: { theme: {
woodden:'木纹', woodden: "木纹",
music:'音乐', music: "音乐",
simple:'简约' simple: "简约",
} },
}; };

View File

@ -1,5 +1,5 @@
(function () { (function () {
var WebSocketServer=require('ws').Server; var WebSocketServer = require("ws").Server;
var wss = new WebSocketServer({ port: 8080 }); var wss = new WebSocketServer({ port: 8080 });
var bannedKeys = []; var bannedKeys = [];
var bannedIps = []; var bannedIps = [];
@ -19,7 +19,7 @@
delete this.status; delete this.status;
room.owner = this; room.owner = this;
room.key = key; room.key = key;
this.sendl('createroom',key); this.sendl("createroom", key);
}, },
enter: function (key, nickname, avatar) { enter: function (key, nickname, avatar) {
this.nickname = util.getNickname(nickname); this.nickname = util.getNickname(nickname);
@ -32,24 +32,31 @@
} }
} }
if (!room) { if (!room) {
this.sendl('enterroomfailed'); this.sendl("enterroomfailed");
return; return;
} }
this.room = room; this.room = room;
delete this.status; delete this.status;
if (room.owner) { if (room.owner) {
if(room.servermode&&!room.owner._onconfig&&config&&mode){ if (
room.owner.sendl('createroom',index,config,mode); room.servermode &&
!room.owner._onconfig &&
config &&
mode
) {
room.owner.sendl("createroom", index, config, mode);
room.owner._onconfig = this; room.owner._onconfig = this;
room.owner.nickname = util.getNickname(nickname); room.owner.nickname = util.getNickname(nickname);
room.owner.avatar = avatar; room.owner.avatar = avatar;
} } else if (
else if(!room.config||(room.config.gameStarted&&(!room.config.observe||!room.config.observeReady))){ !room.config ||
this.sendl('enterroomfailed'); (room.config.gameStarted &&
} (!room.config.observe || !room.config.observeReady))
else{ ) {
this.sendl("enterroomfailed");
} else {
this.owner = room.owner; this.owner = room.owner;
this.owner.sendl('onconnection',this.wsid); this.owner.sendl("onconnection", this.wsid);
} }
util.updaterooms(); util.updaterooms();
} }
@ -64,17 +71,15 @@
this.servermode = true; this.servermode = true;
var room = rooms[cfg[0]]; var room = rooms[cfg[0]];
if (!room || room.owner) { if (!room || room.owner) {
this.sendl('reloadroom',true); this.sendl("reloadroom", true);
} } else {
else{
room.owner = this; room.owner = this;
this.room = room; this.room = room;
this.nickname = util.getNickname(cfg[1]); this.nickname = util.getNickname(cfg[1]);
this.avatar = cfg[2]; this.avatar = cfg[2];
this.sendl('createroom',cfg[0],{},'auto') this.sendl("createroom", cfg[0], {}, "auto");
} }
} } else {
else{
for (var i = 0; i < rooms.length; i++) { for (var i = 0; i < rooms.length; i++) {
if (!rooms[i].owner) { if (!rooms[i].owner) {
rooms[i].owner = this; rooms[i].owner = this;
@ -88,14 +93,13 @@
} }
}, },
key: function (id) { key: function (id) {
if(!id||typeof id!='object'){ if (!id || typeof id != "object") {
this.sendl('denied','key'); this.sendl("denied", "key");
this.close(); this.close();
clearTimeout(this.keyCheck); clearTimeout(this.keyCheck);
delete this.keyCheck; delete this.keyCheck;
return; return;
} } else if (bannedKeys.indexOf(id[0]) != -1) {
else if(bannedKeys.indexOf(id[0])!=-1){
bannedIps.push(this._socket.remoteAddress); bannedIps.push(this._socket.remoteAddress);
this.close(); this.close();
} }
@ -104,25 +108,28 @@
delete this.keyCheck; delete this.keyCheck;
}, },
events: function (cfg, id, type) { events: function (cfg, id, type) {
if(bannedKeys.indexOf(id)!=-1||typeof id!='string'||this.onlineKey!=id){ if (
bannedKeys.indexOf(id) != -1 ||
typeof id != "string" ||
this.onlineKey != id
) {
bannedIps.push(this._socket.remoteAddress); bannedIps.push(this._socket.remoteAddress);
console.log(id, this._socket.remoteAddress); console.log(id, this._socket.remoteAddress);
this.close(); this.close();
return; return;
} }
var changed = false; var changed = false;
var time=(new Date()).getTime(); var time = new Date().getTime();
if (cfg && id) { if (cfg && id) {
if(typeof cfg=='string'){ if (typeof cfg == "string") {
for (var i = 0; i < events.length; i++) { for (var i = 0; i < events.length; i++) {
if (events[i].id == cfg) { if (events[i].id == cfg) {
if(type=='join'){ if (type == "join") {
if (events[i].members.indexOf(id) == -1) { if (events[i].members.indexOf(id) == -1) {
events[i].members.push(id); events[i].members.push(id);
} }
changed = true; changed = true;
} } else if (type == "leave") {
else if(type=='leave'){
var index = events[i].members.indexOf(id); var index = events[i].members.indexOf(id);
if (index != -1) { if (index != -1) {
events[i].members.splice(index, 1); events[i].members.splice(index, 1);
@ -134,23 +141,21 @@
} }
} }
} }
} } else if (
else if(cfg.hasOwnProperty('utc')&& cfg.hasOwnProperty("utc") &&
cfg.hasOwnProperty('day')&& cfg.hasOwnProperty("day") &&
cfg.hasOwnProperty('hour')&& cfg.hasOwnProperty("hour") &&
cfg.hasOwnProperty('content')){ cfg.hasOwnProperty("content")
) {
if (events.length >= 20) { if (events.length >= 20) {
this.sendl('eventsdenied','total'); this.sendl("eventsdenied", "total");
} } else if (cfg.utc <= time) {
else if(cfg.utc<=time){ this.sendl("eventsdenied", "time");
this.sendl('eventsdenied','time'); } else if (util.isBanned(cfg.content)) {
} this.sendl("eventsdenied", "ban");
else if(util.isBanned(cfg.content)){ } else {
this.sendl('eventsdenied','ban');
}
else{
cfg.nickname = util.getNickname(cfg.nickname); cfg.nickname = util.getNickname(cfg.nickname);
cfg.avatar=cfg.nickname||'caocao'; cfg.avatar = cfg.nickname || "caocao";
cfg.creator = id; cfg.creator = id;
cfg.id = util.getid(); cfg.id = util.getid();
cfg.members = [id]; cfg.members = [id];
@ -171,7 +176,7 @@
if (this._onconfig) { if (this._onconfig) {
if (clients[this._onconfig.wsid]) { if (clients[this._onconfig.wsid]) {
this._onconfig.owner = this; this._onconfig.owner = this;
this.sendl('onconnection',this._onconfig.wsid); this.sendl("onconnection", this._onconfig.wsid);
} }
delete this._onconfig; delete this._onconfig;
} }
@ -181,10 +186,9 @@
util.updaterooms(); util.updaterooms();
}, },
status: function (str) { status: function (str) {
if(typeof str=='string'){ if (typeof str == "string") {
this.status = str; this.status = str;
} } else {
else{
delete this.status; delete this.status;
} }
util.updateclients(); util.updateclients();
@ -193,8 +197,7 @@
if (clients[id] && clients[id].owner == this) { if (clients[id] && clients[id].owner == this) {
try { try {
clients[id].send(message); clients[id].send(message);
} } catch (e) {
catch(e){
clients[id].close(); clients[id].close();
} }
} }
@ -207,7 +210,7 @@
}; };
var util = { var util = {
getNickname: function (str) { getNickname: function (str) {
return typeof str=='string'?(str.slice(0,12)):'无名玩家'; return typeof str == "string" ? str.slice(0, 12) : "无名玩家";
}, },
isBanned: function (str) { isBanned: function (str) {
for (var i of bannedKeyWords) { for (var i of bannedKeyWords) {
@ -222,13 +225,14 @@
} }
try { try {
this.send(JSON.stringify(args)); this.send(JSON.stringify(args));
} } catch (e) {
catch(e){
this.close(); this.close();
} }
}, },
getid: function () { getid: function () {
return (Math.floor(1000000000+9000000000*Math.random())).toString(); return Math.floor(
1000000000 + 9000000000 * Math.random()
).toString();
}, },
getroomlist: function () { getroomlist: function () {
var roomlist = []; var roomlist = [];
@ -242,14 +246,18 @@
} }
for (var i = 0; i < rooms.length; i++) { for (var i = 0; i < rooms.length; i++) {
if (rooms[i].servermode) { if (rooms[i].servermode) {
roomlist[i]='server'; roomlist[i] = "server";
} } else if (rooms[i].owner && rooms[i].config) {
else if(rooms[i].owner&&rooms[i].config){
if (rooms[i]._num == 0) { if (rooms[i]._num == 0) {
rooms[i].owner.sendl('reloadroom'); rooms[i].owner.sendl("reloadroom");
} }
roomlist.push([rooms[i].owner.nickname,rooms[i].owner.avatar, roomlist.push([
rooms[i].config,rooms[i]._num,rooms[i].key]); rooms[i].owner.nickname,
rooms[i].owner.avatar,
rooms[i].config,
rooms[i]._num,
rooms[i].key,
]);
} }
delete rooms[i]._num; delete rooms[i]._num;
} }
@ -258,7 +266,14 @@
getclientlist: function () { getclientlist: function () {
var clientlist = []; var clientlist = [];
for (var i in clients) { for (var i in clients) {
clientlist.push([clients[i].nickname,clients[i].avatar,!clients[i].room,clients[i].status,clients[i].wsid,clients[i].onlineKey]); clientlist.push([
clients[i].nickname,
clients[i].avatar,
!clients[i].room,
clients[i].status,
clients[i].wsid,
clients[i].onlineKey,
]);
} }
return clientlist; return clientlist;
}, },
@ -267,7 +282,7 @@
var clientlist = util.getclientlist(); var clientlist = util.getclientlist();
for (var i in clients) { for (var i in clients) {
if (!clients[i].room) { if (!clients[i].room) {
clients[i].sendl('updaterooms',roomlist,clientlist); clients[i].sendl("updaterooms", roomlist, clientlist);
} }
} }
}, },
@ -275,13 +290,13 @@
var clientlist = util.getclientlist(); var clientlist = util.getclientlist();
for (var i in clients) { for (var i in clients) {
if (!clients[i].room) { if (!clients[i].room) {
clients[i].sendl('updateclients',clientlist); clients[i].sendl("updateclients", clientlist);
} }
} }
}, },
checkevents: function () { checkevents: function () {
if (events.length) { if (events.length) {
var time=(new Date()).getTime(); var time = new Date().getTime();
for (var i = 0; i < events.length; i++) { for (var i = 0; i < events.length; i++) {
if (events[i].utc <= time) { if (events[i].utc <= time) {
events.splice(i--, 1); events.splice(i--, 1);
@ -294,65 +309,66 @@
util.checkevents(); util.checkevents();
for (var i in clients) { for (var i in clients) {
if (!clients[i].room) { if (!clients[i].room) {
clients[i].sendl('updateevents',events); clients[i].sendl("updateevents", events);
}
} }
} }
},
}; };
wss.on('connection',function(ws){ wss.on("connection", function (ws) {
ws.sendl = util.sendl; ws.sendl = util.sendl;
if (bannedIps.indexOf(ws._socket.remoteAddress) != -1) { if (bannedIps.indexOf(ws._socket.remoteAddress) != -1) {
ws.sendl('denied','banned'); ws.sendl("denied", "banned");
setTimeout(function () { setTimeout(function () {
ws.close(); ws.close();
}, 500); }, 500);
return; return;
} }
ws.keyCheck = setTimeout(function () { ws.keyCheck = setTimeout(function () {
ws.sendl('denied','key'); ws.sendl("denied", "key");
setTimeout(function () { setTimeout(function () {
ws.close(); ws.close();
}, 500); }, 500);
}, 2000); }, 2000);
ws.wsid = util.getid(); ws.wsid = util.getid();
clients[ws.wsid] = ws; clients[ws.wsid] = ws;
ws.sendl('roomlist',util.getroomlist(),util.checkevents(),util.getclientlist(ws),ws.wsid); ws.sendl(
"roomlist",
util.getroomlist(),
util.checkevents(),
util.getclientlist(ws),
ws.wsid
);
ws.heartbeat = setInterval(function () { ws.heartbeat = setInterval(function () {
if (ws.beat) { if (ws.beat) {
ws.close(); ws.close();
clearInterval(ws.heartbeat); clearInterval(ws.heartbeat);
} } else {
else{
ws.beat = true; ws.beat = true;
try { try {
ws.send('heartbeat'); ws.send("heartbeat");
} } catch (e) {
catch(e){
ws.close(); ws.close();
} }
} }
}, 60000); }, 60000);
ws.on('message',function(message){ ws.on("message", function (message) {
if (!clients[this.wsid]) return; if (!clients[this.wsid]) return;
if(message=='heartbeat'){ if (message == "heartbeat") {
this.beat = false; this.beat = false;
} } else if (this.owner) {
else if(this.owner){ this.owner.sendl("onmessage", this.wsid, message);
this.owner.sendl('onmessage',this.wsid,message); } else {
}
else{
var arr; var arr;
try { try {
arr = JSON.parse(message); arr = JSON.parse(message);
if (!Array.isArray(arr)) { if (!Array.isArray(arr)) {
throw('err'); throw "err";
} }
} } catch (e) {
catch(e){ this.sendl("denied", "banned");
this.sendl('denied','banned');
return; return;
} }
if(arr.shift()=='server'){ if (arr.shift() == "server") {
var type = arr.shift(); var type = arr.shift();
if (messages[type]) { if (messages[type]) {
messages[type].apply(this, arr); messages[type].apply(this, arr);
@ -360,12 +376,12 @@
} }
} }
}); });
ws.on('close',function(){ ws.on("close", function () {
for (var i = 0; i < rooms.length; i++) { for (var i = 0; i < rooms.length; i++) {
if (rooms[i].owner == this) { if (rooms[i].owner == this) {
for (var j in clients) { for (var j in clients) {
if (clients[j].room == rooms[i] && clients[j] != this) { if (clients[j].room == rooms[i] && clients[j] != this) {
clients[j].sendl('selfclose'); clients[j].sendl("selfclose");
// clients[j].close(); // clients[j].close();
// delete clients[j]; // delete clients[j];
} }
@ -375,7 +391,7 @@
} }
if (clients[this.wsid]) { if (clients[this.wsid]) {
if (this.owner) { if (this.owner) {
this.owner.sendl('onclose',this.wsid); this.owner.sendl("onclose", this.wsid);
} }
delete clients[this.wsid]; delete clients[this.wsid];
} }
@ -383,4 +399,4 @@
else util.updateclients(); else util.updateclients();
}); });
}); });
}()); })();

View File

@ -1,305 +1,305 @@
window.noname_source_list = [ window.noname_source_list = [
'LICENSE', "LICENSE",
'noname.js', "noname.js",
'service-worker.js', "service-worker.js",
'noname/ai/basic.js', "noname/ai/basic.js",
'noname/ai/index.js', "noname/ai/index.js",
'noname/game/index.js', "noname/game/index.js",
'noname/game/promises.js', "noname/game/promises.js",
'noname/game/dynamic-style/index.js', "noname/game/dynamic-style/index.js",
'noname/get/index.js', "noname/get/index.js",
'noname/get/is.js', "noname/get/is.js",
'noname/gnc/index.js', "noname/gnc/index.js",
'noname/gnc/is.js', "noname/gnc/is.js",
'noname/init/cordova.js', "noname/init/cordova.js",
'noname/init/import.js', "noname/init/import.js",
'noname/init/index.js', "noname/init/index.js",
'noname/init/node.js', "noname/init/node.js",
'noname/init/onload.js', "noname/init/onload.js",
'noname/init/polyfill.js', "noname/init/polyfill.js",
'noname/library/index.js', "noname/library/index.js",
'noname/library/path.js', "noname/library/path.js",
'noname/library/update-urls.js', "noname/library/update-urls.js",
'noname/library/announce/index.d.ts', "noname/library/announce/index.d.ts",
'noname/library/announce/index.js', "noname/library/announce/index.js",
'noname/library/cache/cacheContext.js', "noname/library/cache/cacheContext.js",
'noname/library/cache/childNodesWatcher.js', "noname/library/cache/childNodesWatcher.js",
'noname/library/channel/index.js', "noname/library/channel/index.js",
'noname/library/crypt/md5.js', "noname/library/crypt/md5.js",
'noname/library/element/button.js', "noname/library/element/button.js",
'noname/library/element/card.js', "noname/library/element/card.js",
'noname/library/element/client.js', "noname/library/element/client.js",
'noname/library/element/content.js', "noname/library/element/content.js",
'noname/library/element/contents.js', "noname/library/element/contents.js",
'noname/library/element/control.js', "noname/library/element/control.js",
'noname/library/element/dialog.js', "noname/library/element/dialog.js",
'noname/library/element/gameEvent.js', "noname/library/element/gameEvent.js",
'noname/library/element/gameEventPromise.js', "noname/library/element/gameEventPromise.js",
'noname/library/element/index.js', "noname/library/element/index.js",
'noname/library/element/nodeWS.js', "noname/library/element/nodeWS.js",
'noname/library/element/player.js', "noname/library/element/player.js",
'noname/library/element/vcard.js', "noname/library/element/vcard.js",
'noname/library/experimental/index.js', "noname/library/experimental/index.js",
'noname/library/experimental/symbol.js', "noname/library/experimental/symbol.js",
'noname/library/init/index.js', "noname/library/init/index.js",
'noname/library/init/promises.js', "noname/library/init/promises.js",
'noname/status/index.js', "noname/status/index.js",
'noname/ui/index.js', "noname/ui/index.js",
'noname/ui/click/index.js', "noname/ui/click/index.js",
'noname/ui/create/index.js', "noname/ui/create/index.js",
'noname/ui/create/menu/index.js', "noname/ui/create/menu/index.js",
'noname/ui/create/menu/pages/cardPackMenu.js', "noname/ui/create/menu/pages/cardPackMenu.js",
'noname/ui/create/menu/pages/characterPackMenu.js', "noname/ui/create/menu/pages/characterPackMenu.js",
'noname/ui/create/menu/pages/exetensionMenu.js', "noname/ui/create/menu/pages/exetensionMenu.js",
'noname/ui/create/menu/pages/optionsMenu.js', "noname/ui/create/menu/pages/optionsMenu.js",
'noname/ui/create/menu/pages/otherMenu.js', "noname/ui/create/menu/pages/otherMenu.js",
'noname/ui/create/menu/pages/startMenu.js', "noname/ui/create/menu/pages/startMenu.js",
'noname/util/browser.js', "noname/util/browser.js",
'noname/util/config.js', "noname/util/config.js",
'noname/util/index.js', "noname/util/index.js",
'noname/util/mutex.js', "noname/util/mutex.js",
'noname/util/struct/index.js', "noname/util/struct/index.js",
'noname/util/struct/interface/index.d.ts', "noname/util/struct/interface/index.d.ts",
'noname/util/struct/interface/promise-error-handler.d.ts', "noname/util/struct/interface/promise-error-handler.d.ts",
'noname/util/struct/promise-error-handler/chrome.js', "noname/util/struct/promise-error-handler/chrome.js",
'noname/util/struct/promise-error-handler/firefox.js', "noname/util/struct/promise-error-handler/firefox.js",
'noname/util/struct/promise-error-handler/index.js', "noname/util/struct/promise-error-handler/index.js",
'noname/util/struct/promise-error-handler/unknown.js', "noname/util/struct/promise-error-handler/unknown.js",
'card/extra.js', "card/extra.js",
'card/gujian.js', "card/gujian.js",
'card/guozhan.js', "card/guozhan.js",
'card/gwent.js', "card/gwent.js",
'card/hearth.js', "card/hearth.js",
'card/huanlekapai.js', "card/huanlekapai.js",
'card/mtg.js', "card/mtg.js",
'card/sp.js', "card/sp.js",
'card/standard.js', "card/standard.js",
'card/swd.js', "card/swd.js",
'card/yingbian.js', "card/yingbian.js",
'card/yongjian.js', "card/yongjian.js",
'card/yunchou.js', "card/yunchou.js",
'card/zhenfa.js', "card/zhenfa.js",
'card/zhulu.js', "card/zhulu.js",
'character/clan.js', "character/clan.js",
'character/collab.js', "character/collab.js",
'character/ddd.js', "character/ddd.js",
'character/diy.js', "character/diy.js",
'character/extra.js', "character/extra.js",
'character/gujian.js', "character/gujian.js",
'character/gwent.js', "character/gwent.js",
'character/hearth.js', "character/hearth.js",
'character/huicui.js', "character/huicui.js",
'character/jiange.js', "character/jiange.js",
'character/jsrg.js', "character/jsrg.js",
'character/mobile.js', "character/mobile.js",
'character/mtg.js', "character/mtg.js",
'character/offline.js', "character/offline.js",
'character/old.js', "character/old.js",
'character/onlyOL.js', "character/onlyOL.js",
'character/ow.js', "character/ow.js",
'character/rank.js', "character/rank.js",
'character/refresh.js', "character/refresh.js",
'character/sb.js', "character/sb.js",
'character/shenhua.js', "character/shenhua.js",
'character/shiji.js', "character/shiji.js",
'character/sp.js', "character/sp.js",
'character/sp2.js', "character/sp2.js",
'character/standard.js', "character/standard.js",
'character/swd.js', "character/swd.js",
'character/tw.js', "character/tw.js",
'character/xiake.js', "character/xiake.js",
'character/xianding.js', "character/xianding.js",
'character/xianjian.js', "character/xianjian.js",
'character/xinghuoliaoyuan.js', "character/xinghuoliaoyuan.js",
'character/yijiang.js', "character/yijiang.js",
'character/yingbian.js', "character/yingbian.js",
'character/yxs.js', "character/yxs.js",
'character/zhuogui.js', "character/zhuogui.js",
'font/motoyamaru.woff2', "font/motoyamaru.woff2",
'font/suits.woff2', "font/suits.woff2",
'game/asset.js', "game/asset.js",
'game/codemirror.js', "game/codemirror.js",
'game/compiler-sfc.browser.js', "game/compiler-sfc.browser.js",
'game/config.js', "game/config.js",
'game/core-js-bundle.js', "game/core-js-bundle.js",
'game/directory.js', "game/directory.js",
'game/entry.js', "game/entry.js",
'game/game.js', "game/game.js",
'game/http.js', "game/http.js",
'game/jszip.js', "game/jszip.js",
'game/keyWords.js', "game/keyWords.js",
'game/NoSleep.js', "game/NoSleep.js",
'game/package.js', "game/package.js",
'game/phantom.js', "game/phantom.js",
'game/pinyinjs.js', "game/pinyinjs.js",
'game/pressure.js', "game/pressure.js",
'game/server.js', "game/server.js",
'game/source.js', "game/source.js",
'game/update.js', "game/update.js",
'game/vue.esm-browser.js', "game/vue.esm-browser.js",
'image/card/cardtempname_bg.png', "image/card/cardtempname_bg.png",
'image/flappybird/BG.png', "image/flappybird/BG.png",
'image/flappybird/botpipe.png', "image/flappybird/botpipe.png",
'image/flappybird/gameclear.png', "image/flappybird/gameclear.png",
'image/flappybird/gameover.png', "image/flappybird/gameover.png",
'image/flappybird/getready.png', "image/flappybird/getready.png",
'image/flappybird/ground.png', "image/flappybird/ground.png",
'image/flappybird/toppipe.png', "image/flappybird/toppipe.png",
'image/flappybird/bird/b0.png', "image/flappybird/bird/b0.png",
'image/flappybird/bird/b1.png', "image/flappybird/bird/b1.png",
'image/flappybird/bird/b2.png', "image/flappybird/bird/b2.png",
'image/flappybird/ground/g0.png', "image/flappybird/ground/g0.png",
'image/flappybird/ground/g1.png', "image/flappybird/ground/g1.png",
'image/flappybird/tap/t0.png', "image/flappybird/tap/t0.png",
'image/flappybird/tap/t1.png', "image/flappybird/tap/t1.png",
'layout/default/codemirror.css', "layout/default/codemirror.css",
'layout/default/layout.css', "layout/default/layout.css",
'layout/default/menu.css', "layout/default/menu.css",
'layout/default/phone.css', "layout/default/phone.css",
'layout/long/layout.css', "layout/long/layout.css",
'layout/long2/layout.css', "layout/long2/layout.css",
'layout/mobile/equip.css', "layout/mobile/equip.css",
'layout/mobile/layout.css', "layout/mobile/layout.css",
'layout/mode/boss.css', "layout/mode/boss.css",
'layout/mode/chess.css', "layout/mode/chess.css",
'layout/mode/stone.css', "layout/mode/stone.css",
'layout/mode/tafang.css', "layout/mode/tafang.css",
'layout/newlayout/equip.css', "layout/newlayout/equip.css",
'layout/newlayout/global.css', "layout/newlayout/global.css",
'layout/newlayout/layout.css', "layout/newlayout/layout.css",
'layout/nova/layout.css', "layout/nova/layout.css",
'mode/boss.js', "mode/boss.js",
'mode/chess.js', "mode/chess.js",
'mode/doudizhu.js', "mode/doudizhu.js",
'mode/guozhan.js', "mode/guozhan.js",
'mode/identity.js', "mode/identity.js",
'mode/tafang.js', "mode/tafang.js",
'mode/single.js', "mode/single.js",
'mode/stone.js', "mode/stone.js",
'mode/brawl.js', "mode/brawl.js",
'mode/versus.js', "mode/versus.js",
'mode/connect.js', "mode/connect.js",
'extension/boss/extension.js', "extension/boss/extension.js",
'extension/cardpile/extension.js', "extension/cardpile/extension.js",
'extension/coin/extension.js', "extension/coin/extension.js",
'extension/wuxing/extension.js', "extension/wuxing/extension.js",
'theme/music/grid.png', "theme/music/grid.png",
'theme/music/style.css', "theme/music/style.css",
'theme/music/wood.png', "theme/music/wood.png",
'theme/music/wood3.png', "theme/music/wood3.png",
'theme/simple/card.png', "theme/simple/card.png",
'theme/simple/grid.png', "theme/simple/grid.png",
'theme/simple/style.css', "theme/simple/style.css",
'theme/simple/unknown.png', "theme/simple/unknown.png",
'theme/simple/wood.png', "theme/simple/wood.png",
'theme/simple/wood3.png', "theme/simple/wood3.png",
'theme/woodden/grid.png', "theme/woodden/grid.png",
'theme/woodden/style.css', "theme/woodden/style.css",
'theme/woodden/wood.jpg', "theme/woodden/wood.jpg",
'theme/woodden/wood.png', "theme/woodden/wood.png",
'theme/woodden/wood2.jpg', "theme/woodden/wood2.jpg",
'theme/woodden/wood2.png', "theme/woodden/wood2.png",
'theme/style/card/custom.css', "theme/style/card/custom.css",
'theme/style/card/default.css', "theme/style/card/default.css",
'theme/style/card/music.css', "theme/style/card/music.css",
'theme/style/card/simple.css', "theme/style/card/simple.css",
'theme/style/card/wood.css', "theme/style/card/wood.css",
'theme/style/card/new.css', "theme/style/card/new.css",
'theme/style/card/ol.css', "theme/style/card/ol.css",
'theme/style/card/image/new.png', "theme/style/card/image/new.png",
'theme/style/card/image/ol.png', "theme/style/card/image/ol.png",
'theme/style/cardback/custom.css', "theme/style/cardback/custom.css",
'theme/style/cardback/default.css', "theme/style/cardback/default.css",
'theme/style/cardback/feicheng.css', "theme/style/cardback/feicheng.css",
'theme/style/cardback/liusha.css', "theme/style/cardback/liusha.css",
'theme/style/cardback/music.css', "theme/style/cardback/music.css",
'theme/style/cardback/new.css', "theme/style/cardback/new.css",
'theme/style/cardback/ol.css', "theme/style/cardback/ol.css",
'theme/style/cardback/official.css', "theme/style/cardback/official.css",
'theme/style/cardback/wood.css', "theme/style/cardback/wood.css",
'theme/style/cardback/image/feicheng.png', "theme/style/cardback/image/feicheng.png",
'theme/style/cardback/image/feicheng2.png', "theme/style/cardback/image/feicheng2.png",
'theme/style/cardback/image/liusha.png', "theme/style/cardback/image/liusha.png",
'theme/style/cardback/image/liusha2.png', "theme/style/cardback/image/liusha2.png",
'theme/style/cardback/image/new.png', "theme/style/cardback/image/new.png",
'theme/style/cardback/image/new2.png', "theme/style/cardback/image/new2.png",
'theme/style/cardback/image/official.png', "theme/style/cardback/image/official.png",
'theme/style/cardback/image/official2.png', "theme/style/cardback/image/official2.png",
'theme/style/cardback/image/ol.png', "theme/style/cardback/image/ol.png",
'theme/style/cardback/image/ol2.png', "theme/style/cardback/image/ol2.png",
'theme/style/hp/custom.css', "theme/style/hp/custom.css",
'theme/style/hp/default.css', "theme/style/hp/default.css",
'theme/style/hp/emotion.css', "theme/style/hp/emotion.css",
'theme/style/hp/glass.css', "theme/style/hp/glass.css",
'theme/style/hp/official.css', "theme/style/hp/official.css",
'theme/style/hp/ol.css', "theme/style/hp/ol.css",
'theme/style/hp/round.css', "theme/style/hp/round.css",
'theme/style/hp/xinglass.css', "theme/style/hp/xinglass.css",
'theme/style/hp/xinround.css', "theme/style/hp/xinround.css",
'theme/style/hp/image/emotion1.png', "theme/style/hp/image/emotion1.png",
'theme/style/hp/image/emotion2.png', "theme/style/hp/image/emotion2.png",
'theme/style/hp/image/emotion3.png', "theme/style/hp/image/emotion3.png",
'theme/style/hp/image/emotion4.png', "theme/style/hp/image/emotion4.png",
'theme/style/hp/image/glass1.png', "theme/style/hp/image/glass1.png",
'theme/style/hp/image/glass2.png', "theme/style/hp/image/glass2.png",
'theme/style/hp/image/glass3.png', "theme/style/hp/image/glass3.png",
'theme/style/hp/image/glass4.png', "theme/style/hp/image/glass4.png",
'theme/style/hp/image/official1.png', "theme/style/hp/image/official1.png",
'theme/style/hp/image/official2.png', "theme/style/hp/image/official2.png",
'theme/style/hp/image/official3.png', "theme/style/hp/image/official3.png",
'theme/style/hp/image/official4.png', "theme/style/hp/image/official4.png",
'theme/style/hp/image/ol1.png', "theme/style/hp/image/ol1.png",
'theme/style/hp/image/ol2.png', "theme/style/hp/image/ol2.png",
'theme/style/hp/image/ol3.png', "theme/style/hp/image/ol3.png",
'theme/style/hp/image/ol4.png', "theme/style/hp/image/ol4.png",
'theme/style/hp/image/round1.png', "theme/style/hp/image/round1.png",
'theme/style/hp/image/round2.png', "theme/style/hp/image/round2.png",
'theme/style/hp/image/round3.png', "theme/style/hp/image/round3.png",
'theme/style/hp/image/round4.png', "theme/style/hp/image/round4.png",
'theme/style/hp/image/shield.png', "theme/style/hp/image/shield.png",
'theme/style/hp/image/xinglass1.png', "theme/style/hp/image/xinglass1.png",
'theme/style/hp/image/xinglass2.png', "theme/style/hp/image/xinglass2.png",
'theme/style/hp/image/xinglass3.png', "theme/style/hp/image/xinglass3.png",
'theme/style/hp/image/xinglass4.png', "theme/style/hp/image/xinglass4.png",
'theme/style/hp/image/xinround1.png', "theme/style/hp/image/xinround1.png",
'theme/style/hp/image/xinround2.png', "theme/style/hp/image/xinround2.png",
'theme/style/hp/image/xinround3.png', "theme/style/hp/image/xinround3.png",
'theme/style/hp/image/xinround4.png', "theme/style/hp/image/xinround4.png",
'node_modules/options/.npmignore', "node_modules/options/.npmignore",
'node_modules/options/lib/options.js', "node_modules/options/lib/options.js",
'node_modules/options/package.json', "node_modules/options/package.json",
'node_modules/ultron/.npmignore', "node_modules/ultron/.npmignore",
'node_modules/ultron/.travis.yml', "node_modules/ultron/.travis.yml",
'node_modules/ultron/index.js', "node_modules/ultron/index.js",
'node_modules/ultron/package.json', "node_modules/ultron/package.json",
'node_modules/ultron/test.js', "node_modules/ultron/test.js",
'node_modules/ws/.npmignore', "node_modules/ws/.npmignore",
'node_modules/ws/.travis.yml', "node_modules/ws/.travis.yml",
'node_modules/ws/index.js', "node_modules/ws/index.js",
'node_modules/ws/lib/BufferPool.js', "node_modules/ws/lib/BufferPool.js",
'node_modules/ws/lib/BufferUtil.fallback.js', "node_modules/ws/lib/BufferUtil.fallback.js",
'node_modules/ws/lib/BufferUtil.js', "node_modules/ws/lib/BufferUtil.js",
'node_modules/ws/lib/ErrorCodes.js', "node_modules/ws/lib/ErrorCodes.js",
'node_modules/ws/lib/Extensions.js', "node_modules/ws/lib/Extensions.js",
'node_modules/ws/lib/PerMessageDeflate.js', "node_modules/ws/lib/PerMessageDeflate.js",
'node_modules/ws/lib/Receiver.hixie.js', "node_modules/ws/lib/Receiver.hixie.js",
'node_modules/ws/lib/Receiver.js', "node_modules/ws/lib/Receiver.js",
'node_modules/ws/lib/Sender.hixie.js', "node_modules/ws/lib/Sender.hixie.js",
'node_modules/ws/lib/Sender.js', "node_modules/ws/lib/Sender.js",
'node_modules/ws/lib/Validation.fallback.js', "node_modules/ws/lib/Validation.fallback.js",
'node_modules/ws/lib/Validation.js', "node_modules/ws/lib/Validation.js",
'node_modules/ws/lib/WebSocket.js', "node_modules/ws/lib/WebSocket.js",
'node_modules/ws/lib/WebSocketServer.js', "node_modules/ws/lib/WebSocketServer.js",
'node_modules/ws/package.json' "node_modules/ws/package.json",
]; ];

View File

@ -1,63 +1,63 @@
window.noname_update = { window.noname_update = {
version:'1.10.10', version: "1.10.10",
update:'1.10.9', update: "1.10.9",
changeLog: [ changeLog: [
'整合@kuangshen04 @mengxinzxz @lieren2023 @nonameShijian @PZ157 @XboxSoldier @universe-st @copcap 的Pull Request', "整合@kuangshen04 @mengxinzxz @lieren2023 @nonameShijian @PZ157 @XboxSoldier @universe-st @copcap 的Pull Request",
'OL界程普、界虞翻', "OL界程普、界虞翻",
'手杀杨奉、谋夏侯惇、谋高顺', "手杀杨奉、谋夏侯惇、谋高顺",
'引入Vue框架和新的换肤机制', "引入Vue框架和新的换肤机制",
'其他AI优化与bug修复', "其他AI优化与bug修复",
], ],
files: [ files: [
'service-worker.js', "service-worker.js",
'card/mtg.js', "card/mtg.js",
'card/standard.js', "card/standard.js",
'character/diy.js', "character/diy.js",
'character/extra.js', "character/extra.js",
'character/gwent.js', "character/gwent.js",
'character/huicui.js', "character/huicui.js",
'character/mobile.js', "character/mobile.js",
'character/offline.js', "character/offline.js",
'character/onlyOL.js', "character/onlyOL.js",
'character/ow.js', "character/ow.js",
'character/rank.js', "character/rank.js",
'character/refresh.js', "character/refresh.js",
'character/sb.js', "character/sb.js",
'character/shenhua.js', "character/shenhua.js",
'character/shiji.js', "character/shiji.js",
'character/sp.js', "character/sp.js",
'character/sp2.js', "character/sp2.js",
'character/standard.js', "character/standard.js",
'character/swd.js', "character/swd.js",
'character/tw.js', "character/tw.js",
'character/xianding.js', "character/xianding.js",
'character/xinghuoliaoyuan.js', "character/xinghuoliaoyuan.js",
'character/yijiang.js', "character/yijiang.js",
'character/yingbian.js', "character/yingbian.js",
'character/yxs.js', "character/yxs.js",
'game/compiler-sfc.browser.js', "game/compiler-sfc.browser.js",
'game/game.js', "game/game.js",
'game/pinyinjs.js', "game/pinyinjs.js",
'game/vue.esm-browser.js', "game/vue.esm-browser.js",
'layout/default/layout.css', "layout/default/layout.css",
'mode/boss.js', "mode/boss.js",
'mode/versus.js', "mode/versus.js",
'noname/game/index.js', "noname/game/index.js",
'noname/get/index.js', "noname/get/index.js",
'noname/get/is.js', "noname/get/is.js",
'noname/library/index.js', "noname/library/index.js",
'noname/library/element/content.js', "noname/library/element/content.js",
'noname/library/element/player.js', "noname/library/element/player.js",
'noname/library/init/index.js', "noname/library/init/index.js",
] ],
}; };