diff --git a/docs/v3/ver.json b/docs/v3/ver.json index 4c0fd628..5c0b1e6e 100644 --- a/docs/v3/ver.json +++ b/docs/v3/ver.json @@ -1,6 +1,6 @@ { "stable": { - "version": 3495, - "url": "http://img.yobot.xyz/yobot/yobot3495.zip" + "version": 3497, + "url": "http://yopan.loli.show/yobot/yobot3497.zip" } } \ No newline at end of file diff --git a/documents/README.md b/documents/README.md index 66481f58..c6f5c8cc 100644 --- a/documents/README.md +++ b/documents/README.md @@ -13,7 +13,7 @@ yobot 提供了群聊、web 页面两套用户交互方式,具有操作便捷 自建方法请参考[安装教程](./install/README.md) -或者加入交流群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }},租用或出租机器人 +或者加入交流群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }},租用或出租机器人 ## 功能介绍 diff --git a/documents/about.md b/documents/about.md index 8da4a525..13739e91 100644 --- a/documents/about.md +++ b/documents/about.md @@ -7,7 +7,7 @@ yobot 的编写出于学习目的,很高兴此工具能为大家提供帮助 邮件: -QQ群:{{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }} +QQ群:{{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }} [项目贡献者](./project/contributors.md) [更新日志](./project/changelog.md) diff --git a/documents/install/Linux-cqhttp-mirai.md b/documents/install/Linux-cqhttp-mirai.md index d7971b38..8bef9af5 100644 --- a/documents/install/Linux-cqhttp-mirai.md +++ b/documents/install/Linux-cqhttp-mirai.md @@ -51,34 +51,26 @@ sh yobotg.sh 按下 `ctrl-a , c` 连续组合键,新建一个 screen shell -启动 mirai-console +下载 mirai-console 和 cqhttp-mirai ```shell -mkdir -p ~/qqbot/mirai +mkdir -p ~/qqbot/mirai/plugins/CQHTTPMirai cd ~/qqbot/mirai # 你可以在这里找到最新版本:https://github.com/mamoe/mirai-console-wrapper/releases wget https://github.com/mamoe/mirai-console-wrapper/releases/download/1.3.0/mirai-console-wrapper-1.3.0-all.jar -java -jar mirai-console-wrapper-1.3.0-all.jar -``` - -在 mirai-console 里登录 QQ 并下载 CQHTTPMirai 插件 +# 国内可改用 http://yopan.loli.show/mirai-console-wrapper-1.3.0-all.jar -```shell -# (mirai-console内) -# 登录 QQ -login 123456789 ppaasswwdd # 注意改成你的QQ小号的账号密码 +cd plugins -# 安装 cqhttp-mirai -install CQHTTPMirai +# 你可以在这里找到最新版本:https://github.com/yyuueexxiinngg/cqhttp-mirai/releases +wget https://github.com/yyuueexxiinngg/cqhttp-mirai/releases/download/0.1.4/cqhttp-mirai-0.1.4-all.jar +# 国内可改用 http://yopan.loli.show/mirai-plugins/CQHTTPMirai/CQHTTPMirai-0.1.4.jar ``` -按下 `ctrl-a , c` 连续组合键,新建一个 screen shell - 修改 CQHTTPMirai 配置文件 ```shell -mkdir -p ~/qqbot/mirai/plugins/CQHTTPMirai cd ~/qqbot/mirai/plugins/CQHTTPMirai vi setting.yml ``` @@ -99,18 +91,15 @@ vi setting.yml # 详细说明请参考 https://github.com/yyuueexxiinngg/cqhttp-mirai ``` -保存后按下 `ctrl-a , 1` 连续组合键,回到 1 号 shell (即 mirai-console 所在的 shell) - -按下 `ctrl-c` 退出 mirai 然后重新启动 mirai 并登录 QQ - - 部署完成,现在可以按下 `ctrl-a , d` 连续组合键挂起这两个 shell diff --git a/documents/install/cq.md b/documents/install/cq.md index 0e0b0099..21e15d6c 100644 --- a/documents/install/cq.md +++ b/documents/install/cq.md @@ -10,7 +10,7 @@ yobot搭建难度约等于搭建网站的难度,请量力而行 ::: -如果想租用或出租机器人,可以加群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }} +如果想租用或出租机器人,可以加群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }} 选择一个安装教程: diff --git a/documents/project/changelog.md b/documents/project/changelog.md index b7a1fd28..4109d04f 100644 --- a/documents/project/changelog.md +++ b/documents/project/changelog.md @@ -5,6 +5,7 @@ - 用户首页显示所有已加入的公会 - 兼容 `utf-8 with BOM` 格式的配置文件 - 修改角色昵称表刷新规则 +- 消息过滤支持白名单模式 ## 3.6.2 diff --git a/documents/usage/faq.md b/documents/usage/faq.md index c549a29c..82095757 100644 --- a/documents/usage/faq.md +++ b/documents/usage/faq.md @@ -92,4 +92,4 @@ chown -R 1000:1000 . ### 这里没有我的问题 -可以在QQ群({{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }})或[github issue](https://github.com/yuudi/yobot/issues)提问,提问前可以阅读[正确的提问姿势](https://github.com/tangx/Stop-Ask-Questions-The-Stupid-Ways/blob/master/README.md) +可以在QQ群({{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }})或[github issue](https://github.com/yuudi/yobot/issues)提问,提问前可以阅读[正确的提问姿势](https://github.com/tangx/Stop-Ask-Questions-The-Stupid-Ways/blob/master/README.md) diff --git a/src/client/packedfiles/default_config.json b/src/client/packedfiles/default_config.json index 0dffba75..e276f4a1 100644 --- a/src/client/packedfiles/default_config.json +++ b/src/client/packedfiles/default_config.json @@ -8,7 +8,9 @@ "web_mode_hint": true, "super-admin": [], "black-list": [], + "white_list_mode": false, "black-list-group": [], + "white-list-group": [], "setting-restrict": 2, "allow_bulk_private": false, "auto_update": true, diff --git a/src/client/public/static/admin/users.js b/src/client/public/static/admin/users.js index cc70af1b..3ab769c6 100644 --- a/src/client/public/static/admin/users.js +++ b/src/client/public/static/admin/users.js @@ -24,7 +24,7 @@ var vm = new Vue({ } var nd = new Date(); nd.setTime(ts * 1000); - return nd.toLocaleString('chinese', { hour12: false }); + return nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' }); }, refresh: function (event) { var thisvue = this; diff --git a/src/client/public/static/clan/progress.js b/src/client/public/static/clan/progress.js index 11c0ede2..c9b641ea 100644 --- a/src/client/public/static/clan/progress.js +++ b/src/client/public/static/clan/progress.js @@ -69,9 +69,9 @@ var vm = new Vue({ } var nd = new Date(); nd.setTime(cha.challenge_time * 1000); - var detailstr = nd.toLocaleString('chinese', { hour12: false }) + '\n'; + var detailstr = nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' }) + '\n'; detailstr += cha.cycle + '周目' + cha.boss_num + '号boss\n'; - detailstr += (cha.health_ramain + cha.damage).toLocaleString() + '→' + cha.health_ramain.toLocaleString(); + detailstr += (cha.health_ramain + cha.damage).toLocaleString(options = { timeZone: 'asia/shanghai' }) + '→' + cha.health_ramain.toLocaleString(options = { timeZone: 'asia/shanghai' }); if (cha.message) { detailstr += '\n留言:' + cha.message; } diff --git a/src/client/public/static/clan/statistics/statistics2.js b/src/client/public/static/clan/statistics/statistics2.js index e41f82af..5f3052b4 100644 --- a/src/client/public/static/clan/statistics/statistics2.js +++ b/src/client/public/static/clan/statistics/statistics2.js @@ -363,7 +363,7 @@ var vm = new Vue({ label: { formatter: params => { if (params.axisDimension === "x") { - return (new Date(params.value)).toLocaleString(); + return (new Date(params.value)).toLocaleString(options = { timeZone: 'asia/shanghai' }); } if (params.axisDimension === "y") { return params.value.toLocaleString(); @@ -376,7 +376,7 @@ var vm = new Vue({ const series = params[0]; const [ts, value] = series.data; const matched = temp6[1].find(f => (!f.gte || f.gte <= ts) && (!f.lt || f.lt > ts)); - return `${(new Date(ts)).toLocaleString()}
${series.marker}${(matched && matched.label) + "
" || ""}血量:${value.toLocaleString()}` + return `${(new Date(ts)).toLocaleString(options = { timeZone: 'asia/shanghai' })}
${series.marker}${(matched && matched.label) + "
" || ""}血量:${value.toLocaleString()}` } }, toolbox: { diff --git a/src/client/public/static/clan/user.js b/src/client/public/static/clan/user.js index 96997715..04b90c6c 100644 --- a/src/client/public/static/clan/user.js +++ b/src/client/public/static/clan/user.js @@ -49,9 +49,9 @@ var vm = new Vue({ } var nd = new Date(); nd.setTime(cha.challenge_time * 1000); - var detailstr = nd.toLocaleString('chinese', { hour12: false }) + '\n'; + var detailstr = nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' }) + '\n'; detailstr += cha.cycle + '周目' + cha.boss_num + '号boss\n'; - detailstr += (cha.health_ramain + cha.damage).toLocaleString() + '→' + cha.health_ramain.toLocaleString(); + detailstr += (cha.health_ramain + cha.damage).toLocaleString(options = { timeZone: 'asia/shanghai' }) + '→' + cha.health_ramain.toLocaleString(options = { timeZone: 'asia/shanghai' }); if (cha.message) { detailstr += '\n留言:' + cha.message; } diff --git a/src/client/public/template/admin/setting.html b/src/client/public/template/admin/setting.html index 6e1a1ddc..4b3b553a 100644 --- a/src/client/public/template/admin/setting.html +++ b/src/client/public/template/admin/setting.html @@ -1,285 +1,238 @@ - yobot设置 - - - - + yobot设置 + + + + + + -

yobot设置

- {% if user.authority_group < 10 -%} -
-

- -

- 此站点的公开地址: - yobot 域名 - - - - - - - - - - - - -{% if user.authority_group < 10 -%} -{%- endif %} \ No newline at end of file diff --git a/src/client/ybplugins/calender.py b/src/client/ybplugins/calender.py index 08b37212..2ed0d152 100644 --- a/src/client/ybplugins/calender.py +++ b/src/client/ybplugins/calender.py @@ -120,7 +120,7 @@ def load_time_jp(self, timestr) -> Arrow: return a_time async def load_timeline_jp_async(self): - event_source = "http://tools.yobot.win/calender/jp.json" + event_source = "http://toolscdn.yobot.win/calender/jp.json" async with aiohttp.request("GET", url=event_source) as response: if response.status != 200: raise ServerError(f"服务器状态错误:{response.status}") @@ -166,7 +166,7 @@ def load_time_cn(self, timestr) -> Arrow: return a_time async def load_timeline_cn_async(self): - event_source = "http://tools.yobot.win/calender/cn.json" + event_source = "http://toolscdn.yobot.win/calender/cn.json" async with aiohttp.request("GET", url=event_source) as response: if response.status != 200: raise ServerError(f"服务器状态错误:{response.status}") diff --git a/src/client/ybplugins/clan_battle/battle.py b/src/client/ybplugins/clan_battle/battle.py index f0c2acef..07c8cc9b 100644 --- a/src/client/ybplugins/clan_battle/battle.py +++ b/src/client/ybplugins/clan_battle/battle.py @@ -1555,9 +1555,10 @@ def execute(self, match_num, ctx): return '锁定时请留言' else: match = re.match(r'^锁定(?:boss)? *(?:[\::](.*))?$', cmd) - if match: - appli_type = 2 - extra_msg = match.group(1) + if not match: + return + appli_type = 2 + extra_msg = match.group(1) if isinstance(extra_msg, str): extra_msg = extra_msg.strip() if not extra_msg: diff --git a/src/client/ybplugins/settings.py b/src/client/ybplugins/settings.py index 5abb244d..c5dc01cd 100644 --- a/src/client/ybplugins/settings.py +++ b/src/client/ybplugins/settings.py @@ -27,9 +27,15 @@ def register_routes(self, app: Quart): async def yobot_setting(): if 'yobot_user' not in session: return redirect(url_for('yobot_login', callback=request.path)) + user=User.get_by_id(session['yobot_user']) + if user.authority_group >= 10: + return await render_template( + 'unauthorized.html', + limit='主人', + uath=user.authority_group, + ) return await render_template( 'admin/setting.html', - user=User.get_by_id(session['yobot_user']), ) @app.route( diff --git a/src/client/ybplugins/web_util.py b/src/client/ybplugins/web_util.py index 703f7402..990f4e13 100644 --- a/src/client/ybplugins/web_util.py +++ b/src/client/ybplugins/web_util.py @@ -95,10 +95,10 @@ async def yobot_api_getdomain(): if name is None: return jsonify(code=400, message='No name specified') try: - async with aiohttp.request('GET', url='https://api.v3.yobot.xyz/getdomain/?name='+name) as response: + async with aiohttp.request('GET', url='http://api2.yobot.win/getdomain/?name='+name) as response: if response.status != 200: raise ServerError( - f'http code {response.status} from api.v3.yobot.xyz') + f'http code {response.status} from api2.yobot.win') res = await response.json() except: return jsonify(code=401, message='Fail: Connect to Server') diff --git a/src/client/yobot.py b/src/client/yobot.py index 0a354c03..036c675e 100644 --- a/src/client/yobot.py +++ b/src/client/yobot.py @@ -33,8 +33,8 @@ class Yobot: - Version = "[v3.6.3-beta.4]" - Version_id = 195 + Version = "[v3.6.3]" + Version_id = 197 # "git rev-list --count HEAD" def __init__(self, *, @@ -173,6 +173,11 @@ async def yobot_output(filename): self.ccs2t = OpenCC(self.glo_setting.get("zht_out_style", "s2t")) self.cct2s = OpenCC("t2s") + # filter + self.black_list = set(self.glo_setting["black-list"]) + self.black_list_group = set(self.glo_setting["black-list-group"]) + self.white_list_group = set(self.glo_setting["white-list-group"]) + # update runtime variables self.glo_setting.update({ "dirname": dirname, @@ -234,10 +239,15 @@ async def proc_async(self, msg: dict, *args, **kwargs) -> str: msg["raw_message"][len(preffix):]) # black-list - if msg["sender"]["user_id"] in self.glo_setting["black-list"]: - return None - if msg["message_type"] == "group" and (msg["group_id"] in self.glo_setting["black-list-group"]): + if msg["sender"]["user_id"] in self.black_list: return None + if msg["message_type"] == "group": + if self.glo_setting["white_list_mode"]: + if msg["group_id"] not in self.white_list_group: + return None + else: + if msg["group_id"] in self.black_list_group: + return None # zht-zhs convertion if self.glo_setting.get("zht_in", False):