nonebot-plugin-mccheck 0.2.3__tar.gz → 0.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/PKG-INFO +24 -50
  2. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/README.md +22 -48
  3. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/__init__.py +19 -30
  4. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/config.py → nonebot_plugin_mccheck-0.2.5/nonebot_plugin_mccheck/configs.py +14 -0
  5. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/language.json +0 -18
  6. nonebot_plugin_mccheck-0.2.5/nonebot_plugin_mccheck/templates/default.html +168 -0
  7. nonebot_plugin_mccheck-0.2.5/nonebot_plugin_mccheck/templates/main.css +79 -0
  8. nonebot_plugin_mccheck-0.2.5/nonebot_plugin_mccheck/utils.py +511 -0
  9. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/pyproject.toml +2 -2
  10. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/configs.py +0 -18
  11. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/data_source.py +0 -1113
  12. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/templates/default.html +0 -48
  13. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/templates/main.css +0 -69
  14. nonebot_plugin_mccheck-0.2.3/nonebot_plugin_mccheck/utils.py +0 -633
  15. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/LICENSE +0 -0
  16. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/templates/Minecraft_AE.ttf +0 -0
  17. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/templates/README.md +0 -0
  18. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/templates/background.png +0 -0
  19. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/templates/imagelesshoverbg.png +0 -0
  20. {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.5}/nonebot_plugin_mccheck/templates/no_favicon.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-mccheck
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Minecraft服务器状态查询的nonebot插件,支持IPv6/Minecraft server status query plugin for nonebot, IPv6 supported
5
5
  License: GPL-3.0
6
6
  License-File: LICENSE
@@ -23,11 +23,11 @@ Classifier: Programming Language :: Python :: 3.12
23
23
  Classifier: Programming Language :: Python :: 3.13
24
24
  Classifier: Programming Language :: Python :: 3.14
25
25
  Requires-Dist: dnspython (>=2.5.0)
26
+ Requires-Dist: mcstatus (>=12.0.0)
26
27
  Requires-Dist: nonebot-plugin-alconna (>=0.48.0)
27
28
  Requires-Dist: nonebot-plugin-htmlrender (>=0.3.5)
28
29
  Requires-Dist: nonebot-plugin-uninfo (>=0.7.0)
29
30
  Requires-Dist: nonebot2 (>=2.2.0)
30
- Requires-Dist: ujson (>=5.0.0)
31
31
  Project-URL: Homepage, https://github.com/molanp/nonebot_plugin_mccheck
32
32
  Project-URL: Repository, https://github.com/molanp/nonebot_plugin_mccheck
33
33
  Description-Content-Type: text/markdown
@@ -40,10 +40,8 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  # nonebot-plugin-mccheck
42
42
 
43
-
44
43
  _✨ Minecraft 服务器查询插件 ✨_
45
44
 
46
-
47
45
  <a href="./LICENSE">
48
46
  <img src="https://img.shields.io/github/license/molanp/nonebot_plugin_mccheck.svg" alt="license">
49
47
  </a>
@@ -78,48 +76,29 @@ nb plugin install nonebot-plugin-mccheck
78
76
 
79
77
  <details>
80
78
  <summary>使用包管理器安装</summary>
81
- 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
79
+ 在 nonebot2 项目的插件目录下, 输入安装命令
82
80
 
83
81
  ```shell
84
82
  pip install nonebot-plugin-mccheck
85
- # or
86
- pdm add nonebot-plugin-mccheck
87
- # or
88
- poetry add nonebot-plugin-mccheck
89
- # or
90
- conda install nonebot-plugin-mccheck
91
83
  ```
92
84
 
93
85
  打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
86
+
94
87
  ```toml
95
88
  plugin["nonebot_plugin_mccheck"]
96
89
  ```
90
+
97
91
  </details>
98
92
 
99
93
  ## 📈 已实现的功能
100
94
 
101
95
  - [x] IPv6支持
102
96
  - [x] 支持全平台适配器
103
- - [x] 适配Unicode全字体与字形
104
- - [x] 渲染Motd样式
105
- - [x] 查询服务器昵称
106
- - [x] 查询服务器最大人数,当前人数和玩家列表
107
- - [x] 查询服务器motd
108
- - [x] 返回服务器地址及端口
109
- - [x] 返回服务器在线状态
110
- - [x] 查询服务器延迟
111
- - [x] 更精确的延迟
97
+ - [x] 支持Unicode全字体与字形
98
+ - [x] Motd样式渲染
112
99
  - [x] 支持互通服务器双次查询
113
- - [x] 错误信息反馈
114
- - [x] 端口自动补全
115
- - [x] 智能判断IP地址是否正确
116
- - [x] 不依赖任何外部api
117
- - [x] 支持特殊端口查询(如`2`,`80`,`443`等)
118
- - [x] 查询服务器favicon
119
100
  - [x] 多语言
120
101
  - [x] SRV支持
121
- - [x] 完全彩色下划线/删除线
122
- - [x] 获取服务器协议号
123
102
 
124
103
  ## 📑 未来的功能
125
104
 
@@ -132,19 +111,15 @@ v0.1.45
132
111
  ![image](https://github.com/user-attachments/assets/d0830fe9-c690-4017-b601-f46a1d7e1894)
133
112
 
134
113
  ### 🎈 特别说明
114
+
135
115
  查询IPv6服务器
116
+
136
117
  ```
137
118
  查服 [2001:db8:85a3::8a2e:370:7334]:25565 <-IPv6服务器地址及端口,端口和冒号可以不带
138
119
  ```
120
+
139
121
  或
140
- ```
141
- 查服 2001:db8:85a3::8a2e:370:7334 <-IPv6服务器地址,插件会自动补全端口号
142
- ```
143
- 或
144
- ```
145
- 查服 2001:db8:85a3::8a2e:370:7334:25565 <-IPv6服务器地址及端口
146
- ```
147
- 或
122
+
148
123
  ```
149
124
  查服 [2001:db8:85a3::8a2e:370:7334] <-IPv6服务器地址
150
125
  ```
@@ -153,25 +128,24 @@ v0.1.45
153
128
 
154
129
  在 nonebot2 项目的`.env`文件中添加下表中的必填配置
155
130
 
156
- | 配置项 | 必填 | 默认值 | 说明 |
157
- |:-----:|:----:|:----:|:----:|
158
- | `MCC__LANGUAGE` | 否 | `zh-cn` | 插件渲染图片所使用的语言<br>可用语言:[`zh-cn`,`zh-tw`,`en`] |
159
- | `MCC__TYPE` | 否 | `0` | 插件发送的消息类型(`0`为HTML渲染图片, `1`为文本) |
131
+ | 配置项 | 必填 | 默认值 | 说明 |
132
+ | :-------------: | :--: | :-----: | :---------------------------------------------------------: |
133
+ | `MCC__LANGUAGE` | 否 | `zh-cn` | 插件渲染图片所使用的语言<br>可用语言:[`zh-cn`,`zh-tw`,`en`] |
134
+ | `MCC__TYPE` | 否 | `0` | 插件发送的消息类型(`0`为HTML渲染图片, `1`为文本) |
160
135
 
161
136
  ## 🎲 消息类型对比
162
137
 
163
138
  | 类型 | 特殊样式 | Favicon | 完全彩色下划线/删除线 | 全Unicode字体支持 |
164
- |:-----:|:-----:|:-----:|:-----:|:-----:|
165
- | 文本 | ❌ | ⭕ | ❌ | ⭕ |
166
- | HTML | ⭕ | ⭕ | ⭕ | ⭕ |
139
+ | :--: | :------: | :-----: | :-------------------: | :---------------: |
140
+ | 文本 | ❌ | ⭕ | ❌ | ⭕ |
141
+ | HTML | ⭕ | ⭕ | ⭕ | ⭕ |
167
142
 
168
143
  ## 🎉 使用
169
144
 
170
- |命令|参数|范围|说明|
171
- |:---:|:---:|:---:|:---:|
172
- |`查服/mcheck`|`ip:端口` 或 `ip`|私聊/群聊|查询服务器状态|
173
- |`设置语言/set_lang`|语言名称|私聊/群聊|设置插件渲染图片所使用的语言|
174
- |`当前语言/lang_now`|无|私聊/群聊|查看当前插件渲染图片所使用的语言|
175
- |`语言列表/lang_list`|无|私聊/群聊|查看插件支持的语言列表|
176
-
145
+ | 命令 | 参数 | 范围 | 说明 |
146
+ | :------------------: | :---------------: | :-------: | :------------------------------: |
147
+ | `查服/mcheck` | `ip:端口` 或 `ip` | 私聊/群聊 | 查询服务器状态 |
148
+ | `设置语言/set_lang` | 语言名称 | 私聊/群聊 | 设置插件渲染图片所使用的语言 |
149
+ | `当前语言/lang_now` | 无 | 私聊/群聊 | 查看当前插件渲染图片所使用的语言 |
150
+ | `语言列表/lang_list` | 无 | 私聊/群聊 | 查看插件支持的语言列表 |
177
151
 
@@ -6,10 +6,8 @@
6
6
 
7
7
  # nonebot-plugin-mccheck
8
8
 
9
-
10
9
  _✨ Minecraft 服务器查询插件 ✨_
11
10
 
12
-
13
11
  <a href="./LICENSE">
14
12
  <img src="https://img.shields.io/github/license/molanp/nonebot_plugin_mccheck.svg" alt="license">
15
13
  </a>
@@ -44,48 +42,29 @@ nb plugin install nonebot-plugin-mccheck
44
42
 
45
43
  <details>
46
44
  <summary>使用包管理器安装</summary>
47
- 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
45
+ 在 nonebot2 项目的插件目录下, 输入安装命令
48
46
 
49
47
  ```shell
50
48
  pip install nonebot-plugin-mccheck
51
- # or
52
- pdm add nonebot-plugin-mccheck
53
- # or
54
- poetry add nonebot-plugin-mccheck
55
- # or
56
- conda install nonebot-plugin-mccheck
57
49
  ```
58
50
 
59
51
  打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
52
+
60
53
  ```toml
61
54
  plugin["nonebot_plugin_mccheck"]
62
55
  ```
56
+
63
57
  </details>
64
58
 
65
59
  ## 📈 已实现的功能
66
60
 
67
61
  - [x] IPv6支持
68
62
  - [x] 支持全平台适配器
69
- - [x] 适配Unicode全字体与字形
70
- - [x] 渲染Motd样式
71
- - [x] 查询服务器昵称
72
- - [x] 查询服务器最大人数,当前人数和玩家列表
73
- - [x] 查询服务器motd
74
- - [x] 返回服务器地址及端口
75
- - [x] 返回服务器在线状态
76
- - [x] 查询服务器延迟
77
- - [x] 更精确的延迟
63
+ - [x] 支持Unicode全字体与字形
64
+ - [x] Motd样式渲染
78
65
  - [x] 支持互通服务器双次查询
79
- - [x] 错误信息反馈
80
- - [x] 端口自动补全
81
- - [x] 智能判断IP地址是否正确
82
- - [x] 不依赖任何外部api
83
- - [x] 支持特殊端口查询(如`2`,`80`,`443`等)
84
- - [x] 查询服务器favicon
85
66
  - [x] 多语言
86
67
  - [x] SRV支持
87
- - [x] 完全彩色下划线/删除线
88
- - [x] 获取服务器协议号
89
68
 
90
69
  ## 📑 未来的功能
91
70
 
@@ -98,19 +77,15 @@ v0.1.45
98
77
  ![image](https://github.com/user-attachments/assets/d0830fe9-c690-4017-b601-f46a1d7e1894)
99
78
 
100
79
  ### 🎈 特别说明
80
+
101
81
  查询IPv6服务器
82
+
102
83
  ```
103
84
  查服 [2001:db8:85a3::8a2e:370:7334]:25565 <-IPv6服务器地址及端口,端口和冒号可以不带
104
85
  ```
86
+
105
87
  或
106
- ```
107
- 查服 2001:db8:85a3::8a2e:370:7334 <-IPv6服务器地址,插件会自动补全端口号
108
- ```
109
- 或
110
- ```
111
- 查服 2001:db8:85a3::8a2e:370:7334:25565 <-IPv6服务器地址及端口
112
- ```
113
- 或
88
+
114
89
  ```
115
90
  查服 [2001:db8:85a3::8a2e:370:7334] <-IPv6服务器地址
116
91
  ```
@@ -119,24 +94,23 @@ v0.1.45
119
94
 
120
95
  在 nonebot2 项目的`.env`文件中添加下表中的必填配置
121
96
 
122
- | 配置项 | 必填 | 默认值 | 说明 |
123
- |:-----:|:----:|:----:|:----:|
124
- | `MCC__LANGUAGE` | 否 | `zh-cn` | 插件渲染图片所使用的语言<br>可用语言:[`zh-cn`,`zh-tw`,`en`] |
125
- | `MCC__TYPE` | 否 | `0` | 插件发送的消息类型(`0`为HTML渲染图片, `1`为文本) |
97
+ | 配置项 | 必填 | 默认值 | 说明 |
98
+ | :-------------: | :--: | :-----: | :---------------------------------------------------------: |
99
+ | `MCC__LANGUAGE` | 否 | `zh-cn` | 插件渲染图片所使用的语言<br>可用语言:[`zh-cn`,`zh-tw`,`en`] |
100
+ | `MCC__TYPE` | 否 | `0` | 插件发送的消息类型(`0`为HTML渲染图片, `1`为文本) |
126
101
 
127
102
  ## 🎲 消息类型对比
128
103
 
129
104
  | 类型 | 特殊样式 | Favicon | 完全彩色下划线/删除线 | 全Unicode字体支持 |
130
- |:-----:|:-----:|:-----:|:-----:|:-----:|
131
- | 文本 | ❌ | ⭕ | ❌ | ⭕ |
132
- | HTML | ⭕ | ⭕ | ⭕ | ⭕ |
105
+ | :--: | :------: | :-----: | :-------------------: | :---------------: |
106
+ | 文本 | ❌ | ⭕ | ❌ | ⭕ |
107
+ | HTML | ⭕ | ⭕ | ⭕ | ⭕ |
133
108
 
134
109
  ## 🎉 使用
135
110
 
136
- |命令|参数|范围|说明|
137
- |:---:|:---:|:---:|:---:|
138
- |`查服/mcheck`|`ip:端口` 或 `ip`|私聊/群聊|查询服务器状态|
139
- |`设置语言/set_lang`|语言名称|私聊/群聊|设置插件渲染图片所使用的语言|
140
- |`当前语言/lang_now`|无|私聊/群聊|查看当前插件渲染图片所使用的语言|
141
- |`语言列表/lang_list`|无|私聊/群聊|查看插件支持的语言列表|
142
-
111
+ | 命令 | 参数 | 范围 | 说明 |
112
+ | :------------------: | :---------------: | :-------: | :------------------------------: |
113
+ | `查服/mcheck` | `ip:端口` 或 `ip` | 私聊/群聊 | 查询服务器状态 |
114
+ | `设置语言/set_lang` | 语言名称 | 私聊/群聊 | 设置插件渲染图片所使用的语言 |
115
+ | `当前语言/lang_now` | 无 | 私聊/群聊 | 查看当前插件渲染图片所使用的语言 |
116
+ | `语言列表/lang_list` | 无 | 私聊/群聊 | 查看插件支持的语言列表 |
@@ -1,33 +1,29 @@
1
1
  import itertools
2
2
 
3
- from nonebot import require
4
- from nonebot.plugin import PluginMetadata, inherit_supported_adapters
5
- from .config import Config
3
+ from nonebot.plugin import PluginMetadata
4
+ from nonebot_plugin_alconna import (
5
+ Alconna,
6
+ Args,
7
+ CommandMeta,
8
+ Match,
9
+ Text,
10
+ UniMessage,
11
+ on_alconna,
12
+ )
13
+ from nonebot_plugin_uninfo import Uninfo
14
+
6
15
  from .configs import lang, lang_data
7
16
  from .utils import (
8
17
  change_language_to,
9
18
  get_message_list,
10
19
  handle_exception,
11
20
  is_qbot,
12
- is_validity_address,
13
- parse_host,
21
+ valid_urlparse,
14
22
  )
15
23
 
16
- require("nonebot_plugin_alconna")
17
- require("nonebot_plugin_uninfo")
18
- from arclet.alconna import Alconna, Args, CommandMeta
19
- from nonebot_plugin_alconna import Match, Text, UniMessage, on_alconna
20
- from nonebot_plugin_uninfo import Uninfo
21
-
22
24
  __plugin_meta__ = PluginMetadata(
23
25
  name="Minecraft查服",
24
26
  description="Minecraft服务器状态查询,支持IPv6",
25
- type="application",
26
- homepage="https://github.com/molanp/nonebot_plugin_mccheck",
27
- supported_adapters=inherit_supported_adapters(
28
- "nonebot_plugin_alconna", "nonebot_plugin_uninfo"
29
- ),
30
- config=Config,
31
27
  usage="""
32
28
  Minecraft服务器状态查询,支持IPv6
33
29
  用法:
@@ -41,7 +37,6 @@ __plugin_meta__ = PluginMetadata(
41
37
  lang_now
42
38
  lang_list
43
39
  """.strip(),
44
- extra={"author": "molanp <luotian233@foxmail.com>"},
45
40
  )
46
41
 
47
42
  check = on_alconna(
@@ -78,21 +73,15 @@ lang_list = on_alconna(
78
73
  async def _(host: Match[str], session: Uninfo):
79
74
  if not host.available:
80
75
  await check.finish(Text(f"{lang_data[lang]['where_ip']}"), reply_to=True)
81
- address, port = await parse_host(host.result)
76
+ try:
77
+ address, port = valid_urlparse(host.result)
78
+ except ValueError:
79
+ await check.finish(Text(f"{lang_data[lang]['where_ip']}"), reply_to=True)
82
80
 
83
- if not str(port).isdigit() or not (0 <= int(port) <= 65535):
81
+ if port and not (0 < port <= 65535):
84
82
  await check.finish(Text(f"{lang_data[lang]['where_port']}"), reply_to=True)
85
-
86
- if is_validity_address(address):
87
- await get_info(address, port, session)
88
- return
89
-
90
-
91
- async def get_info(ip, port, session):
92
- global ms
93
-
94
83
  try:
95
- message_list = await get_message_list(ip, port, 3)
84
+ message_list = await get_message_list(address, port)
96
85
  if is_qbot(session):
97
86
  for m in message_list:
98
87
  await check.send(UniMessage(m), reply_to=True)
@@ -1,3 +1,6 @@
1
+ import os
2
+
3
+ import json
1
4
  from nonebot.plugin import get_plugin_config
2
5
  from pydantic import BaseModel, Field
3
6
 
@@ -15,3 +18,14 @@ class Config(BaseModel):
15
18
 
16
19
 
17
20
  config: ScopedConfig = get_plugin_config(Config).mcc
21
+
22
+
23
+ def readInfo(file: str) -> dict:
24
+ with open(os.path.join(os.path.dirname(__file__), file), encoding="utf-8") as f:
25
+ return json.loads((f.read()).strip())
26
+
27
+
28
+ message_type = config.type
29
+ lang = config.language
30
+ lang_data = readInfo("language.json")
31
+ VERSION = "0.2.5"
@@ -2,16 +2,10 @@
2
2
  "zh-cn": {
3
3
  "where_ip": "不知道你服务器的IP在哪里,在你心里吗?",
4
4
  "where_port": "你看看这是正经端口吗?",
5
- "SUCCESS": "(请求和响应解析成功)",
6
5
  "CONNFAIL": "无法建立服务器连接(服务器脱机,主机名或端口错误?)",
7
- "TIMEOUT": "连接超时(服务器负载过大?防火墙规则是否放行?)",
8
- "UNKNOWN": "连接已建立,但服务器使用未知/不受支持的 SLP 协议。",
9
6
  "version": "版本:",
10
- "slp_protocol": "连接协议:",
11
7
  "protocol_version": "协议版本:",
12
8
  "address": "地址:",
13
- "ip": "IP:",
14
- "port": "端口:",
15
9
  "gamemode": "游戏模式:",
16
10
  "delay": "延迟:",
17
11
  "motd": "Motd:",
@@ -21,16 +15,10 @@
21
15
  "zh-tw": {
22
16
  "where_ip": "不知道你伺服器的IP在哪裡,在你心裡嗎?",
23
17
  "where_port": "你看看這是正經端口嗎?",
24
- "SUCCESS": "(請求和響應解析成功)",
25
18
  "CONNFAIL": "無法建立伺服器連接(伺服器脫機,主機名或端口錯誤?)",
26
- "TIMEOUT": "連接超時(伺服器負載過大?防火牆規則是否放行?)",
27
- "UNKNOWN": "連接已建立,但伺服器使用未知/不受支持的 SLP 協議。",
28
19
  "version": "版本:",
29
- "slp_protocol": "連接協議:",
30
20
  "protocol_version": "協議版本:",
31
21
  "address": "地址:",
32
- "ip": "IP:",
33
- "port": "端口:",
34
22
  "gamemode": "遊戲模式:",
35
23
  "delay": "延遲:",
36
24
  "motd": "Motd:",
@@ -40,16 +28,10 @@
40
28
  "en": {
41
29
  "where_ip": "Where is the IP of your server?",
42
30
  "where_port": "Wrong port!",
43
- "SUCCESS": "(Request & response parsing OK)",
44
31
  "CONNFAIL": "The socket to the server could not be established. (Server offline, wrong hostname or port?)",
45
- "TIMEOUT": "The connection timed out. (Server under too much load? Firewall rules OK?)",
46
- "UNKNOWN": "The connection was established, but the server spoke an unknown/unsupported SLP protocol.",
47
32
  "version": "Version: ",
48
- "slp_protocol": "Connection protocol: ",
49
33
  "protocol_version": "Protocol version: ",
50
34
  "address": "Address: ",
51
- "ip": "IP: ",
52
- "port": "Port: ",
53
35
  "gamemode": "Gamemode: ",
54
36
  "delay": "Delay: ",
55
37
  "motd": "Motd: ",
@@ -0,0 +1,168 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="stylesheet" href="main.css" />
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <title>Template</title>
9
+ </head>
10
+
11
+ <body>
12
+ <div class="server-form">
13
+ <img
14
+ class="favicon"
15
+ src="{{ data['favicon'] }}"
16
+ alt="Fail to load the favicon."
17
+ />
18
+ <span class="server-type"> {{ data["type"] }} </span>
19
+ <div class="content">
20
+ <label> {{ data["lang"]["version"] }}{{ data["version"] }} </label>
21
+ <label> {{ data["lang"]["motd"] }}{{ data["motd"]|safe }} </label>
22
+ {% if data["protocol_version"] is not none%}
23
+ <label>
24
+ {{ data["lang"]["protocol_version"] }}{{ data["protocol_version"]}}
25
+ </label>
26
+ {% endif %}
27
+ <label> {{ data["lang"]["address"] }}{{ data["address"] }} </label>
28
+ <label> {{ data["lang"]["delay"] }}{{ data["delay"]}} </label>
29
+ {% if data["lang"]["gamemode"] %}
30
+ <label> {{ data["lang"]["gamemode"] }}{{ data["gamemode"] }} </label>
31
+ {% endif %}
32
+ <label> {{ data["lang"]["players"] }}{{ data["players"] }} </label>
33
+ {% if data["player_list"] %}
34
+ <label>
35
+ {{ data["lang"]["player_list"] }}{{ data["player_list"] }}
36
+ </label>
37
+ {% endif %}
38
+ </div>
39
+ <div class="watermark">
40
+ zhenxun_plugin_mccheck v{{ data["VERSION"] }} by molanp.
41
+ </div>
42
+ </div>
43
+ <script>
44
+ var obfuscators = {};
45
+
46
+ function obfuscate(elem) {
47
+ // 获取元素的HTML内容
48
+ var originalHTML = elem.innerHTML;
49
+
50
+ // 查找reset标签的位置
51
+ var resetStartIndex = originalHTML.indexOf("<reset");
52
+ if (resetStartIndex !== -1) {
53
+ // 找到reset标签的结束位置
54
+ var resetEndIndex = -1;
55
+
56
+ // 检查是否是自闭合标签 <reset/>
57
+ var selfClosingCheck = originalHTML.indexOf("/>", resetStartIndex);
58
+ var closingTagCheck = originalHTML.indexOf(
59
+ "</reset>",
60
+ resetStartIndex,
61
+ );
62
+
63
+ if (
64
+ selfClosingCheck !== -1 &&
65
+ (closingTagCheck === -1 || selfClosingCheck < closingTagCheck)
66
+ ) {
67
+ // 自闭合标签
68
+ resetEndIndex = originalHTML.indexOf("/>", resetStartIndex) + 2;
69
+ } else if (closingTagCheck !== -1) {
70
+ // 有结束标签
71
+ resetEndIndex =
72
+ originalHTML.indexOf("</reset>", resetStartIndex) + 9; // +9 for '</reset>'
73
+ }
74
+
75
+ if (resetEndIndex !== -1) {
76
+ // 分离要混淆的部分和不混淆的部分
77
+ var beforeReset = originalHTML.substring(0, resetStartIndex);
78
+ var resetAndAfter = originalHTML.substring(resetStartIndex);
79
+
80
+ // 为混淆部分创建一个状态数组,记录每个位置的当前字符
81
+ var obfuscationState = [];
82
+ for (var j = 0; j < beforeReset.length; j++) {
83
+ obfuscationState.push(
84
+ String.fromCharCode(
85
+ Math.floor(Math.random() * (95 - 64 + 1)) + 64,
86
+ ),
87
+ );
88
+ }
89
+
90
+ // 设置初始混淆状态
91
+ elem.innerHTML = obfuscationState.join("") + resetAndAfter;
92
+
93
+ // 为混淆部分设置定时器
94
+ var elementKey = elem;
95
+ obfuscators[elementKey] = obfuscators[elementKey] || [];
96
+
97
+ var i = 0;
98
+ var strLen = beforeReset.length;
99
+
100
+ if (strLen > 0) {
101
+ obfuscators[elementKey].push(
102
+ window.setInterval(function () {
103
+ if (i >= strLen) i = 0;
104
+
105
+ // 随机更改一个位置的字符
106
+ obfuscationState[i] = String.fromCharCode(
107
+ Math.floor(Math.random() * (95 - 64 + 1)) + 64,
108
+ );
109
+
110
+ // 重新构建HTML
111
+ elem.innerHTML = obfuscationState.join("") + resetAndAfter;
112
+ i++;
113
+ }, 5),
114
+ );
115
+ }
116
+ }
117
+ } else {
118
+ // 没有reset标签,混淆全部内容
119
+ var fullText = elem.innerHTML;
120
+
121
+ // 为整个文本创建一个状态数组
122
+ var obfuscationState = [];
123
+ for (var j = 0; j < fullText.length; j++) {
124
+ obfuscationState.push(
125
+ String.fromCharCode(
126
+ Math.floor(Math.random() * (95 - 64 + 1)) + 64,
127
+ ),
128
+ );
129
+ }
130
+
131
+ // 设置初始混淆状态
132
+ elem.innerHTML = obfuscationState.join("");
133
+
134
+ var elementKey = elem;
135
+ obfuscators[elementKey] = obfuscators[elementKey] || [];
136
+
137
+ var i = 0;
138
+ var strLen = fullText.length;
139
+
140
+ if (strLen > 0) {
141
+ obfuscators[elementKey].push(
142
+ window.setInterval(function () {
143
+ if (i >= strLen) i = 0;
144
+
145
+ // 随机更改一个位置的字符
146
+ obfuscationState[i] = String.fromCharCode(
147
+ Math.floor(Math.random() * (95 - 64 + 1)) + 64,
148
+ );
149
+
150
+ // 重新设置HTML
151
+ elem.innerHTML = obfuscationState.join("");
152
+ i++;
153
+ }, 5),
154
+ );
155
+ }
156
+ }
157
+ }
158
+
159
+ // 处理页面上的obfuscated类元素
160
+ document.addEventListener("DOMContentLoaded", function () {
161
+ var obfuscatedElements = document.querySelectorAll(".obfuscated");
162
+ obfuscatedElements.forEach(function (element) {
163
+ obfuscate(element);
164
+ });
165
+ });
166
+ </script>
167
+ </body>
168
+ </html>
@@ -0,0 +1,79 @@
1
+ @font-face {
2
+ src: url(Minecraft_AE.ttf);
3
+ font-family: "Minecraft_AE";
4
+ }
5
+
6
+ * {
7
+ font-family: "Minecraft_AE";
8
+ }
9
+
10
+ body {
11
+ background-color: #bbbbbb;
12
+ margin: 0;
13
+ }
14
+
15
+ .content {
16
+ margin-left: 10px;
17
+ padding-top: 5px;
18
+ overflow-x: hidden;
19
+ overflow-wrap: break-word;
20
+ word-wrap: break-word;
21
+ }
22
+
23
+ .content label {
24
+ display: block;
25
+ margin-bottom: 10px;
26
+ }
27
+
28
+ ::-webkit-scrollbar {
29
+ width: 8px;
30
+ }
31
+
32
+ ::-webkit-scrollbar-track {
33
+ background-color: #434343;
34
+ }
35
+
36
+ ::-webkit-scrollbar-thumb {
37
+ background-color: #c6c6c6;
38
+ }
39
+
40
+ .favicon {
41
+ height: 150px;
42
+ width: 150px;
43
+ border: 4px solid;
44
+ border-image: url(imagelesshoverbg.png) 1;
45
+ }
46
+
47
+ .server-form {
48
+ display: flex;
49
+ position: relative;
50
+ width: 500px;
51
+ padding: 15px;
52
+ color: #fff;
53
+ border: 8px solid;
54
+ box-sizing: border-box;
55
+ background: rgba(0, 0, 0, 0.589);
56
+ border-image: url(background.png) 8;
57
+ }
58
+ .watermark {
59
+ position: absolute;
60
+ font-weight: bold;
61
+ font-size: 1px;
62
+ bottom: 0.5px;
63
+ right: 0;
64
+ color: #888888;
65
+ font-size: 8px;
66
+ opacity: 0.1;
67
+ z-index: 1000;
68
+ pointer-events: none;
69
+ }
70
+ .server-type {
71
+ position: absolute;
72
+ right: 0.1rem;
73
+ top: 0.3rem;
74
+ transform: skew(-20deg);
75
+ }
76
+ .obfuscated {
77
+ width: 1ch;
78
+ letter-spacing: normal;
79
+ }