nonebot-plugin-aawfcore 0.23.1__py3-none-any.whl

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 (151) hide show
  1. nonebot_plugin_aawfcore/__init__.py +24 -0
  2. nonebot_plugin_aawfcore/admin/__init__.py +3 -0
  3. nonebot_plugin_aawfcore/admin/control.py +206 -0
  4. nonebot_plugin_aawfcore/admin/server.py +284 -0
  5. nonebot_plugin_aawfcore/admin/static/app.js +56 -0
  6. nonebot_plugin_aawfcore/admin/static/index.html +14 -0
  7. nonebot_plugin_aawfcore/admin/static/style.css +2 -0
  8. nonebot_plugin_aawfcore/api.py +151 -0
  9. nonebot_plugin_aawfcore/assets/offline.tar.gz +0 -0
  10. nonebot_plugin_aawfcore/bootstrap.py +164 -0
  11. nonebot_plugin_aawfcore/client.py +79 -0
  12. nonebot_plugin_aawfcore/commands/__init__.py +3 -0
  13. nonebot_plugin_aawfcore/commands/parsing.py +176 -0
  14. nonebot_plugin_aawfcore/commands/router.py +119 -0
  15. nonebot_plugin_aawfcore/config.py +28 -0
  16. nonebot_plugin_aawfcore/grq/__init__.py +8 -0
  17. nonebot_plugin_aawfcore/grq/catalog.py +86 -0
  18. nonebot_plugin_aawfcore/grq/index.py +95 -0
  19. nonebot_plugin_aawfcore/grq/json_store.py +83 -0
  20. nonebot_plugin_aawfcore/grq/links.py +146 -0
  21. nonebot_plugin_aawfcore/grq/manager.py +472 -0
  22. nonebot_plugin_aawfcore/grq/models.py +56 -0
  23. nonebot_plugin_aawfcore/grq/normalizer.py +39 -0
  24. nonebot_plugin_aawfcore/grq/patches.py +17 -0
  25. nonebot_plugin_aawfcore/grq/registry.py +89 -0
  26. nonebot_plugin_aawfcore/grq/rewards.py +72 -0
  27. nonebot_plugin_aawfcore/grq/search.py +56 -0
  28. nonebot_plugin_aawfcore/grq/sources.py +294 -0
  29. nonebot_plugin_aawfcore/grq/storage.py +24 -0
  30. nonebot_plugin_aawfcore/infrastructure/__init__.py +3 -0
  31. nonebot_plugin_aawfcore/infrastructure/cache.py +68 -0
  32. nonebot_plugin_aawfcore/infrastructure/http.py +103 -0
  33. nonebot_plugin_aawfcore/infrastructure/images.py +55 -0
  34. nonebot_plugin_aawfcore/infrastructure/ocr_worker.py +112 -0
  35. nonebot_plugin_aawfcore/infrastructure/riven_ocr.py +128 -0
  36. nonebot_plugin_aawfcore/infrastructure/storage.py +34 -0
  37. nonebot_plugin_aawfcore/infrastructure/wiki_http.py +142 -0
  38. nonebot_plugin_aawfcore/infrastructure/wiki_transport.py +47 -0
  39. nonebot_plugin_aawfcore/initialization/__init__.py +3 -0
  40. nonebot_plugin_aawfcore/initialization/market.py +59 -0
  41. nonebot_plugin_aawfcore/initialization/nodes.py +55 -0
  42. nonebot_plugin_aawfcore/initialization/pipeline.py +285 -0
  43. nonebot_plugin_aawfcore/initialization/rules.py +247 -0
  44. nonebot_plugin_aawfcore/initialization/wfcd.py +129 -0
  45. nonebot_plugin_aawfcore/localization/__init__.py +3 -0
  46. nonebot_plugin_aawfcore/localization/relics.py +115 -0
  47. nonebot_plugin_aawfcore/localization/resolver.py +57 -0
  48. nonebot_plugin_aawfcore/localization/resources.py +68 -0
  49. nonebot_plugin_aawfcore/localization/riven_attributes.py +62 -0
  50. nonebot_plugin_aawfcore/localization/rivens.py +53 -0
  51. nonebot_plugin_aawfcore/models/__init__.py +3 -0
  52. nonebot_plugin_aawfcore/models/arbitration.py +25 -0
  53. nonebot_plugin_aawfcore/models/bounties.py +43 -0
  54. nonebot_plugin_aawfcore/models/common.py +251 -0
  55. nonebot_plugin_aawfcore/models/errors.py +11 -0
  56. nonebot_plugin_aawfcore/models/market.py +86 -0
  57. nonebot_plugin_aawfcore/models/operations.py +40 -0
  58. nonebot_plugin_aawfcore/models/relics.py +37 -0
  59. nonebot_plugin_aawfcore/models/riven_market.py +34 -0
  60. nonebot_plugin_aawfcore/models/riven_values.py +20 -0
  61. nonebot_plugin_aawfcore/models/rivens.py +51 -0
  62. nonebot_plugin_aawfcore/models/trend.py +48 -0
  63. nonebot_plugin_aawfcore/models/void_trader.py +42 -0
  64. nonebot_plugin_aawfcore/models/wiki.py +41 -0
  65. nonebot_plugin_aawfcore/models/worldstate.py +176 -0
  66. nonebot_plugin_aawfcore/protocols/__init__.py +1 -0
  67. nonebot_plugin_aawfcore/protocols/message.py +71 -0
  68. nonebot_plugin_aawfcore/protocols/qq.py +181 -0
  69. nonebot_plugin_aawfcore/providers/__init__.py +3 -0
  70. nonebot_plugin_aawfcore/providers/market.py +150 -0
  71. nonebot_plugin_aawfcore/providers/riven_market.py +39 -0
  72. nonebot_plugin_aawfcore/providers/rivens.py +99 -0
  73. nonebot_plugin_aawfcore/providers/wiki.py +44 -0
  74. nonebot_plugin_aawfcore/providers/worldstate.py +35 -0
  75. nonebot_plugin_aawfcore/rendering/__init__.py +3 -0
  76. nonebot_plugin_aawfcore/rendering/assets/css/base.css +274 -0
  77. nonebot_plugin_aawfcore/rendering/assets/css/relics.css +15 -0
  78. nonebot_plugin_aawfcore/rendering/assets/css/riven_analysis.css +14 -0
  79. nonebot_plugin_aawfcore/rendering/assets/css/riven_market.css +10 -0
  80. nonebot_plugin_aawfcore/rendering/assets/css/riven_values.css +13 -0
  81. nonebot_plugin_aawfcore/rendering/assets/css/themes/default.css +10 -0
  82. nonebot_plugin_aawfcore/rendering/assets/css/trader.css +12 -0
  83. nonebot_plugin_aawfcore/rendering/assets/css/trend.css +15 -0
  84. nonebot_plugin_aawfcore/rendering/charts.py +47 -0
  85. nonebot_plugin_aawfcore/rendering/renderer.py +396 -0
  86. nonebot_plugin_aawfcore/rendering/templates/arbitration.html +12 -0
  87. nonebot_plugin_aawfcore/rendering/templates/archimedea.html +25 -0
  88. nonebot_plugin_aawfcore/rendering/templates/attributes.html +12 -0
  89. nonebot_plugin_aawfcore/rendering/templates/base.html +26 -0
  90. nonebot_plugin_aawfcore/rendering/templates/bounties.html +33 -0
  91. nonebot_plugin_aawfcore/rendering/templates/bounty_rewards.html +7 -0
  92. nonebot_plugin_aawfcore/rendering/templates/card.html +29 -0
  93. nonebot_plugin_aawfcore/rendering/templates/challenge_bounties.html +16 -0
  94. nonebot_plugin_aawfcore/rendering/templates/commands.html +8 -0
  95. nonebot_plugin_aawfcore/rendering/templates/fissures.html +42 -0
  96. nonebot_plugin_aawfcore/rendering/templates/market.html +26 -0
  97. nonebot_plugin_aawfcore/rendering/templates/nightwave.html +18 -0
  98. nonebot_plugin_aawfcore/rendering/templates/operations.html +38 -0
  99. nonebot_plugin_aawfcore/rendering/templates/relics.html +28 -0
  100. nonebot_plugin_aawfcore/rendering/templates/riven_analysis.html +10 -0
  101. nonebot_plugin_aawfcore/rendering/templates/riven_market.html +18 -0
  102. nonebot_plugin_aawfcore/rendering/templates/riven_values.html +29 -0
  103. nonebot_plugin_aawfcore/rendering/templates/trend.html +30 -0
  104. nonebot_plugin_aawfcore/rendering/templates/void_trader.html +21 -0
  105. nonebot_plugin_aawfcore/rendering/templates/weekly.html +16 -0
  106. nonebot_plugin_aawfcore/rendering/viewmodels.py +106 -0
  107. nonebot_plugin_aawfcore/services/__init__.py +3 -0
  108. nonebot_plugin_aawfcore/services/arbitration.py +170 -0
  109. nonebot_plugin_aawfcore/services/archimedea.py +117 -0
  110. nonebot_plugin_aawfcore/services/bounties.py +217 -0
  111. nonebot_plugin_aawfcore/services/calendar.py +60 -0
  112. nonebot_plugin_aawfcore/services/cetus.py +12 -0
  113. nonebot_plugin_aawfcore/services/challenge_bounties.py +116 -0
  114. nonebot_plugin_aawfcore/services/circuit.py +93 -0
  115. nonebot_plugin_aawfcore/services/clan.py +47 -0
  116. nonebot_plugin_aawfcore/services/common.py +18 -0
  117. nonebot_plugin_aawfcore/services/cycles.py +125 -0
  118. nonebot_plugin_aawfcore/services/fissures.py +80 -0
  119. nonebot_plugin_aawfcore/services/market.py +100 -0
  120. nonebot_plugin_aawfcore/services/nightwave.py +103 -0
  121. nonebot_plugin_aawfcore/services/operations.py +136 -0
  122. nonebot_plugin_aawfcore/services/relics.py +98 -0
  123. nonebot_plugin_aawfcore/services/riven_analysis.py +176 -0
  124. nonebot_plugin_aawfcore/services/riven_market.py +84 -0
  125. nonebot_plugin_aawfcore/services/riven_values.py +146 -0
  126. nonebot_plugin_aawfcore/services/rivens.py +164 -0
  127. nonebot_plugin_aawfcore/services/steel_path.py +27 -0
  128. nonebot_plugin_aawfcore/services/trend.py +65 -0
  129. nonebot_plugin_aawfcore/services/void_trader.py +81 -0
  130. nonebot_plugin_aawfcore/services/weekly.py +55 -0
  131. nonebot_plugin_aawfcore/services/wiki.py +26 -0
  132. nonebot_plugin_aawfcore/services/wiki_store.py +92 -0
  133. nonebot_plugin_aawfcore/services/worldstate.py +78 -0
  134. nonebot_plugin_aawfcore/subscriptions/__init__.py +5 -0
  135. nonebot_plugin_aawfcore/subscriptions/rules.py +143 -0
  136. nonebot_plugin_aawfcore/subscriptions/service.py +437 -0
  137. nonebot_plugin_aawfcore/subscriptions/sources.py +186 -0
  138. nonebot_plugin_aawfcore/subscriptions/store.py +528 -0
  139. nonebot_plugin_aawfcore/subscriptions/targets.py +192 -0
  140. nonebot_plugin_aawfcore/worldstate/__init__.py +3 -0
  141. nonebot_plugin_aawfcore/worldstate/parsers/__init__.py +3 -0
  142. nonebot_plugin_aawfcore/worldstate/parsers/bounties.py +39 -0
  143. nonebot_plugin_aawfcore/worldstate/parsers/challenge_bounties.py +72 -0
  144. nonebot_plugin_aawfcore/worldstate/parsers/common.py +31 -0
  145. nonebot_plugin_aawfcore/worldstate/parsers/cycles.py +88 -0
  146. nonebot_plugin_aawfcore/worldstate/parsers/location_bounties.py +19 -0
  147. nonebot_plugin_aawfcore/worldstate/seeded_random.py +24 -0
  148. nonebot_plugin_aawfcore-0.23.1.dist-info/METADATA +38 -0
  149. nonebot_plugin_aawfcore-0.23.1.dist-info/RECORD +151 -0
  150. nonebot_plugin_aawfcore-0.23.1.dist-info/WHEEL +5 -0
  151. nonebot_plugin_aawfcore-0.23.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,24 @@
1
+ # Desc: 声明插件信息并注册查询功能。
2
+ # Date: 2026-11-14
3
+ # Author: Aameow
4
+
5
+ from nonebot import require
6
+ from nonebot.plugin import PluginMetadata
7
+
8
+ from .config import Config
9
+
10
+ require("nonebot_plugin_htmlrender")
11
+
12
+ __plugin_meta__ = PluginMetadata(
13
+ name="nonebot-plugin-aawfcore",
14
+ description="国际服 Warframe 世界状态与交易市场查询",
15
+ usage="命令与配置见 README。",
16
+ type="application",
17
+ homepage="https://github.com/nekox41/nonebot-plugin-aawarframe",
18
+ config=Config,
19
+ supported_adapters=None,
20
+ )
21
+
22
+ from .bootstrap import setup as setup_runtime # noqa: E402
23
+
24
+ setup_runtime()
@@ -0,0 +1,3 @@
1
+ # 作用:提供插件网页管理入口。
2
+ # 编写日期:2026-11-13
3
+ # 作者:Aameow
@@ -0,0 +1,206 @@
1
+ # Desc: 保存管理配置并执行即时生效的命令路由和黑白名单规则。
2
+ # Date: 2026-11-15
3
+ # Author: Aameow
4
+
5
+ import asyncio
6
+ import re
7
+ from typing import Literal
8
+
9
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
10
+
11
+ from ..grq import GameResourceQuery
12
+
13
+
14
+ class ACL(BaseModel):
15
+ model_config = ConfigDict(extra="forbid")
16
+ allow_users: list[str] = Field(default_factory=list, max_length=10000)
17
+ allow_groups: list[str] = Field(default_factory=list, max_length=10000)
18
+ deny_users: list[str] = Field(default_factory=list, max_length=10000)
19
+ deny_groups: list[str] = Field(default_factory=list, max_length=10000)
20
+
21
+ @model_validator(mode="after")
22
+ def validate_ids(self):
23
+ for values in (self.allow_users, self.allow_groups, self.deny_users, self.deny_groups):
24
+ if any(not re.fullmatch(r"(?:qq-(?:group|channel):)?[A-Za-z0-9_-]{1,160}", v) for v in values):
25
+ raise ValueError("用户和群组标识必须是数字或 QQ 官方 OpenID")
26
+ return self
27
+
28
+ def permits(self, user: str, group: str | None):
29
+ if user in self.deny_users or (group and group in self.deny_groups):
30
+ return False
31
+ return not (self.allow_users or self.allow_groups) or (
32
+ user in self.allow_users or bool(group and group in self.allow_groups)
33
+ )
34
+
35
+
36
+ class Command(BaseModel):
37
+ model_config = ConfigDict(extra="forbid")
38
+ feature: str
39
+ name: str = Field(min_length=1, max_length=40)
40
+ aliases: list[str] = Field(default_factory=list, max_length=20)
41
+ enabled: bool = True
42
+ prefix: Literal["nonebot", "none", "optional"] = "nonebot"
43
+ acl: ACL = Field(default_factory=ACL)
44
+
45
+ @model_validator(mode="after")
46
+ def validate_names(self):
47
+ for name in [self.name, *self.aliases]:
48
+ if not name or len(name) > 40 or any(c.isspace() or ord(c) < 32 for c in name):
49
+ raise ValueError("命令不能包含空白,最长 40 字")
50
+ return self
51
+
52
+
53
+ class Options(BaseModel):
54
+ model_config = ConfigDict(extra="forbid")
55
+ http_timeout: float = Field(default=12, gt=0, le=60)
56
+ worldstate_ttl: float = Field(default=45, gt=0, le=180)
57
+ market_ttl: float = Field(default=30, gt=0, le=90)
58
+ wiki_ttl: float = Field(default=300, ge=0, le=3600)
59
+ wiki_interval: float = Field(default=1, ge=1, le=60)
60
+
61
+
62
+ class Settings(BaseModel):
63
+ model_config = ConfigDict(extra="forbid")
64
+ acl: ACL = Field(default_factory=ACL)
65
+ options: Options = Field(default_factory=Options)
66
+ commands: list[Command]
67
+
68
+ @model_validator(mode="after")
69
+ def unique_names(self):
70
+ features, names = set(), {}
71
+ for cmd in self.commands:
72
+ if cmd.feature in features:
73
+ raise ValueError("功能不能重复")
74
+ features.add(cmd.feature)
75
+ for name in [cmd.name, *cmd.aliases]:
76
+ if name in names and names[name] != cmd.feature:
77
+ raise ValueError("命令冲突:" + name)
78
+ names[name] = cmd.feature
79
+ if features != {f for _, _, f in DEFAULT_COMMANDS}:
80
+ raise ValueError("不能添加或删除功能,请使用启用开关")
81
+ return self
82
+
83
+
84
+ DEFAULT_COMMANDS = [
85
+ ("帮助", set(), "help"),
86
+ ("平原", set(), "plains"),
87
+ ("突击", set(), "sortie"),
88
+ ("奸商", set(), "void_trader"),
89
+ ("入侵", set(), "invasions"),
90
+ ("执刑官", set(), "archon"),
91
+ ("时光", set(), "temporal"),
92
+ ("深层", set(), "deep"),
93
+ ("裂缝", set(), "fissures"),
94
+ ("钢铁裂缝", set(), "steel_fissures"),
95
+ ("九重天", set(), "railjack_fissures"),
96
+ ("氏族", set(), "clan"),
97
+ ("电波", set(), "nightwave"),
98
+ ("日历", set(), "calendar"),
99
+ ("钢精", set(), "steel_path"),
100
+ ("回廊", set(), "circuit"),
101
+ ("灵化", set(), "incarnons"),
102
+ ("赏金", set(), "bounty_summary"),
103
+ ("地球", set(), "bounties"),
104
+ ("金星", set(), "venus_bounties"),
105
+ ("火卫二", set(), "deimos_bounties"),
106
+ ("圣所", set(), "sanctum_bounties"),
107
+ ("扎里曼", set(), "zariman_bounties"),
108
+ ("1999", set(), "hex_bounties"),
109
+ ("仲裁", set(), "arbitration"),
110
+ ("今日仲裁", set(), "today_arbitration"),
111
+ ("高效仲裁", set(), "efficient_arbitration"),
112
+ ("wm", set(), "market"),
113
+ ("趋势", set(), "trend"),
114
+ ("部件", set(), "parts"),
115
+ ("遗物", set(), "relic"),
116
+ ("wmr", set(), "riven_market"),
117
+ ("词条", set(), "riven_attributes"),
118
+ ("wk", set(), "wiki"),
119
+ ("zk", set(), "riven_ranking"),
120
+ ("zk已洗", set(), "rolled_riven_ranking"),
121
+ ("数值", set(), "riven_values"),
122
+ ("分析", set(), "riven_analysis"),
123
+ ("订阅", set(), "subscribe"),
124
+ ("我的订阅", set(), "list_subscriptions"),
125
+ ("取消订阅", set(), "unsubscribe"),
126
+ ]
127
+
128
+
129
+ class Control:
130
+ def __init__(self, registry: GameResourceQuery, options=None):
131
+ self.registry = registry
132
+ default = Settings(
133
+ commands=[Command(feature=f, name=n, aliases=sorted(a)) for n, a, f in DEFAULT_COMMANDS]
134
+ )
135
+ if options:
136
+ default.options = Options(**options)
137
+ raw, self.revision = registry.read_setting("control", default.model_dump())
138
+ features = {cmd.feature for cmd in default.commands}
139
+ raw["commands"] = [item for item in raw["commands"] if item["feature"] in features]
140
+ known = {item["feature"] for item in raw["commands"]}
141
+ raw["commands"].extend(cmd.model_dump() for cmd in default.commands if cmd.feature not in known)
142
+ scheme, revision = registry.read_setting("command_scheme", 0)
143
+ if scheme != 2:
144
+ names = {cmd.feature: cmd.name for cmd in default.commands}
145
+ for item in raw["commands"]:
146
+ item.update(name=names[item["feature"]], aliases=[])
147
+ self.settings = Settings.model_validate(raw)
148
+ if scheme != 2:
149
+ self.revision = registry.write_setting("control", self.settings.model_dump(), self.revision)
150
+ registry.write_setting("command_scheme", 2, revision)
151
+ self.apply = None
152
+ self._compile()
153
+
154
+ def _compile(self):
155
+ self.routes = tuple(
156
+ sorted(
157
+ (
158
+ (name, cmd)
159
+ for cmd in self.settings.commands
160
+ for name in {cmd.name, *cmd.aliases}
161
+ ),
162
+ key=lambda pair: (-len(pair[0]), pair[0]),
163
+ )
164
+ )
165
+
166
+ def update(self, raw, revision):
167
+ settings = Settings.model_validate(raw)
168
+ self.revision = self.registry.write_setting("control", settings.model_dump(), revision)
169
+ self.settings = settings
170
+ self._compile()
171
+ if self.apply:
172
+ self.apply(settings.options)
173
+ return self.revision
174
+
175
+ async def update_async(self, raw, revision):
176
+ settings = Settings.model_validate(raw)
177
+ self.revision = await asyncio.to_thread(
178
+ self.registry.write_setting, "control", settings.model_dump(), revision
179
+ )
180
+ self.settings = settings
181
+ self._compile()
182
+ if self.apply:
183
+ self.apply(settings.options)
184
+ return self.revision
185
+
186
+ def route(self, text, starts, user, group=None):
187
+ # 先识别最长命令,再判断开关和名单;被停用的长命令不会误触发短命令。
188
+ matches = []
189
+ for name, command in self.routes:
190
+ prefixes = starts if command.prefix == "nonebot" else {""}
191
+ if command.prefix == "optional":
192
+ prefixes = {*starts, ""}
193
+ for prefix in prefixes:
194
+ token = prefix + name
195
+ if text.startswith(token):
196
+ matches.append((len(token), command, text[len(token) :].strip()))
197
+ if not matches:
198
+ return None
199
+ _, command, args = max(matches, key=lambda m: m[0])
200
+ if (
201
+ not command.enabled
202
+ or not self.settings.acl.permits(user, group)
203
+ or not command.acl.permits(user, group)
204
+ ):
205
+ return None
206
+ return command.feature, args
@@ -0,0 +1,284 @@
1
+ # 作用:提供带口令认证的 HTTPS 管理 API 和网页管理台。
2
+ # 编写日期:2026-11-13
3
+ # 作者:Aameow
4
+
5
+ import asyncio
6
+ import hashlib
7
+ import hmac
8
+ import logging
9
+ import os
10
+ import secrets
11
+ import ssl
12
+ import subprocess
13
+ from collections import OrderedDict, deque
14
+ from contextlib import contextmanager
15
+ from ipaddress import ip_address
16
+ from pathlib import Path
17
+ from time import monotonic
18
+ from typing import Literal
19
+
20
+ import uvicorn
21
+ from fastapi import Depends, FastAPI, HTTPException, Request
22
+ from fastapi.responses import FileResponse, JSONResponse
23
+ from pydantic import BaseModel, Field
24
+
25
+ logger = logging.getLogger(__name__)
26
+ STATIC = Path(__file__).parent / "static"
27
+
28
+
29
+ class AliasInput(BaseModel):
30
+ item_id: str
31
+ alias: str = Field(min_length=1, max_length=120)
32
+
33
+
34
+ class ArbitrationInput(BaseModel):
35
+ node_id: str
36
+ grade: Literal["S", "A", "B", "C", "D", "F"]
37
+ vitus_per_minute: float = Field(ge=0, allow_inf_nan=False)
38
+
39
+
40
+ def create_app(runtime, token: str):
41
+ grq = runtime.grq
42
+ digest = hashlib.sha256(token.encode()).digest()
43
+ failures = OrderedDict()
44
+
45
+ async def authenticate(request: Request):
46
+ address = request.client.host if request.client else "unknown"
47
+ now = monotonic()
48
+ attempts = failures.setdefault(address, deque())
49
+ failures.move_to_end(address)
50
+ while len(failures) > 2048:
51
+ failures.popitem(last=False)
52
+ while attempts and now - attempts[0] > 60:
53
+ attempts.popleft()
54
+ if len(attempts) >= 10:
55
+ raise HTTPException(429, "登录尝试过多,请一分钟后重试")
56
+ value = request.headers.get("authorization", "")
57
+ supplied = value[7:] if value.startswith("Bearer ") else ""
58
+ if not hmac.compare_digest(hashlib.sha256(supplied.encode()).digest(), digest):
59
+ attempts.append(now)
60
+ raise HTTPException(401, "登录口令不正确")
61
+ failures.pop(address, None)
62
+ # Bearer 认证不使用 Cookie;同时拒绝跨站浏览器提交。
63
+ origin = request.headers.get("origin")
64
+ if origin and origin != str(request.base_url).rstrip("/"):
65
+ raise HTTPException(403, "不允许跨站请求")
66
+
67
+ app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
68
+
69
+ @app.middleware("http")
70
+ async def protect(request, call_next):
71
+ limit = 2_000_000
72
+ length = request.headers.get("content-length")
73
+ if length and (not length.isdigit() or int(length) > limit):
74
+ return JSONResponse({"detail": "请求内容过大"}, 413)
75
+ # 同时限制没有 Content-Length 的分块上传。
76
+ if request.method in {"POST", "PUT", "PATCH"}:
77
+ chunks, size = [], 0
78
+ async for chunk in request.stream():
79
+ size += len(chunk)
80
+ if size > limit:
81
+ return JSONResponse({"detail": "请求内容过大"}, 413)
82
+ chunks.append(chunk)
83
+ request._body = b"".join(chunks)
84
+ response = await call_next(request)
85
+ response.headers.update(
86
+ {
87
+ "Cache-Control": "no-store",
88
+ "X-Content-Type-Options": "nosniff",
89
+ "Referrer-Policy": "no-referrer",
90
+ "X-Frame-Options": "DENY",
91
+ "Content-Security-Policy": "default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'",
92
+ }
93
+ )
94
+ return response
95
+
96
+ @app.exception_handler(ValueError)
97
+ async def invalid(request, exc):
98
+ return JSONResponse({"detail": str(exc)}, status_code=409)
99
+
100
+ @app.get("/")
101
+ async def home():
102
+ return FileResponse(STATIC / "index.html")
103
+
104
+ @app.get("/app.js")
105
+ async def javascript():
106
+ return FileResponse(STATIC / "app.js", media_type="text/javascript")
107
+
108
+ @app.get("/style.css")
109
+ async def stylesheet():
110
+ return FileResponse(STATIC / "style.css", media_type="text/css")
111
+
112
+ auth = [Depends(authenticate)]
113
+
114
+ @app.get("/api/session", dependencies=auth)
115
+ async def session():
116
+ return {"ok": True}
117
+
118
+ @app.get("/api/items", dependencies=auth)
119
+ async def items(q: str = ""):
120
+ if len(q) > 200:
121
+ raise HTTPException(400, "查询内容过长")
122
+ if not q.strip():
123
+ return {"items": []}
124
+ index = grq.domains["Items"]
125
+ result = grq.search("Items", q)
126
+ selected = {r.id: r for r in result.candidates}
127
+ key = q.casefold()
128
+ for resource in index.resources.values():
129
+ if len(selected) >= 30:
130
+ break
131
+ if (
132
+ resource.enabled
133
+ and key
134
+ in " ".join([resource.id, *resource.names.values(), *resource.aliases]).casefold()
135
+ ):
136
+ selected.setdefault(resource.id, resource)
137
+ return {
138
+ "items": [
139
+ {
140
+ "id": r.id,
141
+ "name": r.name(),
142
+ "name_en": r.names.get("en", ""),
143
+ "tradable": r.metadata.get("market_tradable", False),
144
+ "market_slug": r.identifiers.get("market.slug"),
145
+ }
146
+ for r in selected.values()
147
+ if r.enabled
148
+ ]
149
+ }
150
+
151
+ @app.get("/api/aliases", dependencies=auth)
152
+ async def aliases():
153
+ return {"items": await asyncio.to_thread(grq.list_aliases)}
154
+
155
+ @app.post("/api/aliases", dependencies=auth)
156
+ async def add_alias(payload: AliasInput):
157
+ await asyncio.to_thread(grq.add_alias, payload.item_id, payload.alias)
158
+ return {"ok": True}
159
+
160
+ @app.delete("/api/aliases", dependencies=auth)
161
+ async def delete_alias(payload: AliasInput):
162
+ await asyncio.to_thread(grq.delete_alias, payload.item_id, payload.alias)
163
+ return {"ok": True}
164
+
165
+ @app.get("/api/arbitration/nodes", dependencies=auth)
166
+ async def arbitration_nodes():
167
+ return {"items": runtime.arbitration.list_nodes()}
168
+
169
+ @app.put("/api/arbitration/nodes", dependencies=auth)
170
+ async def save_arbitration(payload: ArbitrationInput):
171
+ await asyncio.to_thread(runtime.arbitration.save_node, **payload.model_dump())
172
+ runtime.renderer.cache.entries.clear()
173
+ return {"ok": True}
174
+
175
+ return app
176
+
177
+
178
+ class EmbeddedServer(uvicorn.Server):
179
+ @contextmanager
180
+ def capture_signals(self):
181
+ # 进程信号由 NoneBot 主服务器处理。
182
+ yield
183
+
184
+
185
+ class AdminServer:
186
+ def __init__(self, runtime, config):
187
+ self.runtime, self.config = runtime, config
188
+ self.server = None
189
+ self.task = None
190
+
191
+ def start(self):
192
+ config = self.config
193
+ directory = config.aawarframe_cache_dir / "admin"
194
+ directory.mkdir(parents=True, exist_ok=True, mode=0o700)
195
+ token_file = directory / "password"
196
+ if config.aawarframe_admin_password:
197
+ token = config.aawarframe_admin_password.get_secret_value()
198
+ else:
199
+ if not token_file.exists():
200
+ fd = os.open(token_file, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
201
+ with os.fdopen(fd, "w") as stream:
202
+ stream.write(secrets.token_urlsafe(32) + "\n")
203
+ token_file.chmod(0o600)
204
+ token = token_file.read_text().strip()
205
+ if len(token) < 16:
206
+ raise ValueError("管理口令至少需要 16 个字符")
207
+ cert = config.aawarframe_admin_cert or directory / "cert.pem"
208
+ key = config.aawarframe_admin_key or directory / "key.pem"
209
+ if bool(config.aawarframe_admin_cert) != bool(config.aawarframe_admin_key):
210
+ raise ValueError("必须同时配置管理台证书和私钥")
211
+ if not config.aawarframe_admin_cert and not (cert.exists() and key.exists()):
212
+ host = config.aawarframe_admin_public_host or "localhost"
213
+ try:
214
+ ip_address(host)
215
+ san = "IP:" + host
216
+ except ValueError:
217
+ if not all(c.isalnum() or c in "-." for c in host):
218
+ raise ValueError("管理台域名无效") from None
219
+ san = "DNS:" + host
220
+ subprocess.run(
221
+ [
222
+ "openssl",
223
+ "req",
224
+ "-x509",
225
+ "-newkey",
226
+ "rsa:2048",
227
+ "-nodes",
228
+ "-keyout",
229
+ str(key),
230
+ "-out",
231
+ str(cert),
232
+ "-days",
233
+ "365",
234
+ "-subj",
235
+ "/CN=" + host,
236
+ "-addext",
237
+ "subjectAltName=" + san,
238
+ ],
239
+ check=True,
240
+ capture_output=True,
241
+ timeout=20,
242
+ )
243
+ key.chmod(0o600)
244
+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
245
+ context.load_cert_chain(cert, key)
246
+ app = create_app(self.runtime, token)
247
+ self.server = EmbeddedServer(
248
+ uvicorn.Config(
249
+ app,
250
+ host=config.aawarframe_admin_host,
251
+ port=config.aawarframe_admin_port,
252
+ ssl_certfile=str(cert),
253
+ ssl_keyfile=str(key),
254
+ access_log=True,
255
+ proxy_headers=False,
256
+ log_config=None,
257
+ log_level=None,
258
+ timeout_graceful_shutdown=5,
259
+ )
260
+ )
261
+ self.task = asyncio.create_task(self._serve(), name="aawarframe-admin")
262
+ self.task.add_done_callback(self._done)
263
+ logger.info("管理台 HTTPS 端口 %s;口令文件:%s", config.aawarframe_admin_port, token_file)
264
+
265
+ async def _serve(self):
266
+ try:
267
+ await self.server.serve()
268
+ except SystemExit as exc:
269
+ # 管理端口冲突不应终止机器人主进程。
270
+ raise RuntimeError("管理台未能启动,请检查端口和证书") from exc
271
+
272
+ def _done(self, task):
273
+ if not task.cancelled() and task.exception():
274
+ logger.error("管理台运行失败", exc_info=task.exception())
275
+
276
+ async def close(self):
277
+ if self.server:
278
+ self.server.should_exit = True
279
+ if self.task:
280
+ try:
281
+ await asyncio.wait_for(asyncio.shield(self.task), 8)
282
+ except TimeoutError:
283
+ self.task.cancel()
284
+ await asyncio.gather(self.task, return_exceptions=True)
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+ const $=id=>document.getElementById(id);
3
+ let token=sessionStorage.getItem('aawarframe-token')||'', selected=null, aliases=[], searchTimer, searchVersion=0, pendingDelete=null;
4
+ function node(tag,text,className){const el=document.createElement(tag);if(text!==undefined)el.textContent=text;if(className)el.className=className;return el;}
5
+ async function api(path,method='GET',body){
6
+ const response=await fetch('/api/'+path,{method,headers:{Authorization:'Bearer '+token,...(body?{'Content-Type':'application/json'}:{})},body:body?JSON.stringify(body):undefined});
7
+ if(response.status===401){sessionStorage.removeItem('aawarframe-token');$('console').hidden=true;$('login').hidden=false;throw Error('登录口令不正确或登录已失效。');}
8
+ const data=await response.json();if(!response.ok)throw Error(typeof data.detail==='string'?data.detail:'操作未成功,请重试。');return data;
9
+ }
10
+ function describe(item){const box=node('div');box.append(node('strong',item.name),node('p',item.name_en||item.id,'muted'));return box;}
11
+ function tradeBadge(item){return node('span',item.tradable?'可交易':'游戏物品',item.tradable?'badge trade':'badge');}
12
+ function choose(item){selected=item;$('item-results').replaceChildren();$('selected-item').replaceChildren(describe(item),tradeBadge(item));$('selected-item').hidden=false;$('add-alias').disabled=false;$('form-message').textContent='已选定物品,保存后立即生效。';}
13
+ async function findItems(){const version=++searchVersion;const query=$('item-query').value.trim();selected=null;$('selected-item').hidden=true;$('add-alias').disabled=true;$('item-results').replaceChildren();$('form-error').textContent='';if(!query)return;
14
+ try{const data=await api('items?'+new URLSearchParams({q:query}));if(version!==searchVersion)return;
15
+ for(const item of data.items){const button=node('button',undefined,'item-option');button.type='button';button.append(describe(item),tradeBadge(item));button.onclick=()=>choose(item);$('item-results').append(button);}
16
+ if(!data.items.length)$('item-results').append(node('p','未找到物品,请换一个名称搜索。','empty'));
17
+ }catch(e){if(version===searchVersion)$('form-error').textContent=e.message;}}
18
+ $('item-query').oninput=()=>{searchVersion++;selected=null;$('selected-item').hidden=true;$('add-alias').disabled=true;$('item-results').replaceChildren();clearTimeout(searchTimer);searchTimer=setTimeout(findItems,250);};
19
+ function drawAliases(){const key=$('alias-filter').value.toLocaleLowerCase();$('alias-list').replaceChildren();const rows=aliases.filter(a=>[a.alias,a.name,a.name_en].join(' ').toLocaleLowerCase().includes(key));$('alias-count').textContent=aliases.length+' 个别名';
20
+ for(const entry of rows){const row=node('div',undefined,'alias-row');const text=node('div');text.append(node('strong',entry.alias),node('p',entry.name+(entry.name_en?' · '+entry.name_en:''),'muted'));const remove=node('button','删除','text-button');remove.type='button';remove.onclick=()=>{pendingDelete=entry;$('delete-message').textContent='确定删除“'+entry.alias+'”与“'+entry.name+'”的对应关系?';$('delete-dialog').showModal();};row.append(text,remove);$('alias-list').append(row);}
21
+ if(!rows.length)$('alias-list').append(node('p',aliases.length?'没有符合筛选条件的别名。':'还没有别名,从上方添加第一个吧。','empty'));}
22
+ async function loadAliases(){aliases=(await api('aliases')).items;drawAliases();}
23
+ async function enter(){await api('session');await loadAliases();$('login').hidden=true;$('console').hidden=false;sessionStorage.setItem('aawarframe-token',token);}
24
+ $('login-form').onsubmit=async e=>{e.preventDefault();token=$('password').value;$('login-error').textContent='';try{await enter();$('password').value='';}catch(error){$('login-error').textContent=error.message;}};
25
+ $('logout').onclick=()=>{token='';sessionStorage.removeItem('aawarframe-token');$('console').hidden=true;$('login').hidden=false;};
26
+ $('alias-filter').oninput=drawAliases;
27
+ $('alias-form').onsubmit=async e=>{e.preventDefault();if(!selected)return;$('add-alias').disabled=true;$('form-error').textContent='';try{await api('aliases','POST',{item_id:selected.id,alias:$('alias-name').value.trim()});$('alias-name').value='';$('form-message').textContent='别名已添加。';await loadAliases();}catch(error){$('form-error').textContent=error.message;}finally{$('add-alias').disabled=!selected;}};
28
+ $('delete-cancel').onclick=()=>$('delete-dialog').close();
29
+ $('delete-confirm').onclick=async()=>{if(!pendingDelete)return;$('delete-confirm').disabled=true;try{await api('aliases','DELETE',{item_id:pendingDelete.item_id,alias:pendingDelete.alias});$('delete-dialog').close();await loadAliases();}catch(error){$('list-error').textContent=error.message;$('delete-dialog').close();}finally{$('delete-confirm').disabled=false;pendingDelete=null;}};
30
+ if(token)enter().catch(error=>{$('login-error').textContent=error.message;});
31
+
32
+ let arbitrationNodes=[];
33
+ async function openView(view){
34
+ for(const button of document.querySelectorAll('[data-view]'))button.classList.toggle('active',button.dataset.view===view);
35
+ $('aliases-view').hidden=view!=='aliases';$('arbitration-view').hidden=view!=='arbitration';$('alias-count').hidden=view!=='aliases';
36
+ $('page-title').textContent=view==='aliases'?'别名管理':'仲裁管理';
37
+ $('page-description').textContent=view==='aliases'?'给物品添加常用称呼,查询时便可使用这个名字。':'维护仲裁节点的评级和每分钟生息精华掉落记录。';
38
+ if(view==='arbitration'){
39
+ try{arbitrationNodes=(await api('arbitration/nodes')).items;drawArbitration();}catch(error){$('arbitration-error').textContent=error.message;}
40
+ }
41
+ }
42
+ function drawArbitration(){
43
+ $('arbitration-list').replaceChildren();const key=$('arbitration-filter').value.trim().toLowerCase();
44
+ for(const item of arbitrationNodes.filter(n=>[n.id,n.name,n.systemName,n.missionName,n.factionName,n.arbitration.grade].join(' ').toLowerCase().includes(key))){
45
+ const row=node('form',undefined,'arbitration-edit');row.dataset.node=item.id;
46
+ const info=node('div');info.append(node('strong',item.name+' / '+item.systemName),node('p',item.missionName+' · '+item.factionName,'muted'));row.append(info);
47
+ const grade=node('select');grade.setAttribute('aria-label',item.name+'评级');
48
+ for(const value of ['S','A','B','C','D','F']){const option=node('option',value);option.value=value;grade.append(option);}grade.value=item.arbitration.grade;
49
+ const vitus=node('input');vitus.type='number';vitus.min='0';vitus.step='any';vitus.required=true;vitus.value=item.arbitration.vitus_per_minute;vitus.setAttribute('aria-label',item.name+'每分钟生息精华');
50
+ const save=node('button','保存','primary');row.append(grade,vitus,save);
51
+ row.onsubmit=async e=>{e.preventDefault();save.disabled=true;$('arbitration-error').textContent='';try{const value=Number(vitus.value);if(!Number.isFinite(value)||value<0)throw Error('掉落数量应为大于等于 0 的数值');await api('arbitration/nodes','PUT',{node_id:item.id,grade:grade.value,vitus_per_minute:value});item.arbitration={grade:grade.value,vitus_per_minute:value};save.textContent='已保存';}catch(error){$('arbitration-error').textContent=error.message;}finally{save.disabled=false;}};
52
+ $('arbitration-list').append(row);
53
+ }
54
+ }
55
+ for(const button of document.querySelectorAll('[data-view]'))button.onclick=()=>openView(button.dataset.view);
56
+ $('arbitration-filter').oninput=drawArbitration;
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Warframe · 别名管理</title><link rel="stylesheet" href="/style.css"><script src="/app.js" defer></script></head>
4
+ <body>
5
+ <section id="login" class="login-card"><div class="brand">Aa <span>Warframe 助手</span></div><h1>别名管理</h1><p class="muted">使用管理口令登录。</p><form id="login-form"><label for="password">登录口令</label><input id="password" type="password" autocomplete="current-password" required><button class="primary full">登录</button><p id="login-error" class="error" role="alert"></p></form></section>
6
+ <div id="console" hidden>
7
+ <header><a class="brand" href="/">Aa <span>Warframe 助手</span></a><button id="logout" class="secondary">退出登录</button></header>
8
+ <aside id="sidebar"><p class="nav-label">功能管理</p><button class="active" data-view="aliases">别名管理</button><button data-view="arbitration">仲裁管理</button></aside>
9
+ <main><div class="heading"><div><p class="eyebrow">WARFRAME</p><h1 id="page-title">别名管理</h1><p id="page-description" class="muted">给物品添加常用称呼,查询时便可使用这个名字。</p></div><span id="alias-count" class="count"></span></div>
10
+ <div id="aliases-view"><section class="panel"><h2>添加别名</h2><form id="alias-form"><div class="form-grid"><div><label for="alias-name">别名</label><input id="alias-name" placeholder="例如:毒妈" maxlength="120" required autocomplete="off"></div><div><label for="item-query">对应物品</label><input id="item-query" placeholder="输入中文或英文名称搜索" autocomplete="off" aria-controls="item-results"></div></div><div id="item-results" class="results" aria-live="polite"></div><div id="selected-item" class="selection" hidden></div><div class="form-footer"><p id="form-message" class="muted" role="status">搜索后,选择一个物品。</p><button id="add-alias" class="primary" disabled>添加别名</button></div><p id="form-error" class="error" role="alert"></p></form></section>
11
+ <section class="panel"><div class="list-heading"><h2>已有别名</h2><input id="alias-filter" type="search" placeholder="筛选别名或物品" aria-label="筛选已有别名"></div><div id="alias-list"></div><p id="list-error" class="error" role="alert"></p></section>
12
+ </div><div id="arbitration-view" hidden><section class="panel"><div class="list-heading"><h2>仲裁节点</h2><input id="arbitration-filter" type="search" placeholder="搜索地点、任务类型或派系" aria-label="筛选仲裁节点"></div><p class="muted">掉落记录单位:生息精华 / 分钟</p><div id="arbitration-list"></div><p id="arbitration-error" class="error" role="alert"></p></section></div><footer>By. Aameow</footer></main></div>
13
+ <dialog id="delete-dialog"><h2>删除别名</h2><p id="delete-message"></p><div class="dialog-actions"><button id="delete-cancel" class="secondary">取消</button><button id="delete-confirm" class="danger">删除</button></div></dialog>
14
+ </body></html>
@@ -0,0 +1,2 @@
1
+ :root{font-family:system-ui,-apple-system,"Noto Sans CJK SC","Microsoft YaHei",sans-serif;color:#24334a;background:#f5f7fb;line-height:1.55;color-scheme:light}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button{cursor:pointer;border:0;border-radius:8px;padding:10px 18px;background:none;color:inherit;white-space:nowrap}button:disabled{cursor:default;opacity:.5}button:focus-visible,input:focus-visible{outline:3px solid #c6d1ff;outline-offset:2px}input{width:100%;padding:11px 13px;border:1px solid #dce2eb;border-radius:8px;background:#fff;color:#24334a;min-width:0}label{display:block;margin-bottom:7px;font-size:14px;font-weight:550}h1,h2,p{margin:0}h1{font-size:29px;margin-bottom:8px}h2{font-size:18px}.muted{color:#738096;font-size:14px;overflow-wrap:anywhere}.primary{background:#5269d7;color:white}.primary:hover{background:#435bc6}.secondary{border:1px solid #dce2eb;background:white}.text-button{color:#b15a62;padding:7px 12px}.danger{background:#b85560;color:white}.full{width:100%;margin-top:22px}.brand{display:flex;align-items:center;gap:12px;font-size:23px;font-weight:750;text-decoration:none;color:#5269d7}.brand span{font-size:15px;color:#34435a;font-weight:600}header{height:76px;background:white;border-bottom:1px solid #e7ebf2;padding:0 max(24px,calc((100% - 1040px)/2));display:flex;align-items:center;justify-content:space-between;gap:20px}main{max-width:1040px;margin:0 auto;padding:36px 24px}.heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:28px}.eyebrow{font-size:10px;letter-spacing:2px;color:#8d99ac;margin-bottom:8px}.count{font-size:13px;color:#738096;white-space:nowrap}.panel{padding:28px;background:white;border:1px solid #e5eaf2;border-radius:12px;margin-bottom:22px}.panel>h2{margin-bottom:22px}.form-grid{display:grid;grid-template-columns:1fr 1.5fr;gap:24px}.form-footer{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-top:22px}.form-footer p{font-size:13px}.results:empty{display:none}.results{margin-top:15px;border:1px solid #e7ebf2;border-radius:8px;max-height:290px;overflow:auto}.item-option{display:flex;width:100%;justify-content:space-between;align-items:center;gap:16px;text-align:left;padding:13px 16px;border-radius:0;white-space:normal}.item-option+.item-option{border-top:1px solid #edf0f5}.item-option:hover{background:#f5f7fd}.item-option strong,.selection strong{font-size:14px}.item-option p{font-size:12px;margin-top:3px}.badge{border-radius:5px;padding:3px 8px;font-size:11px;white-space:nowrap;background:#f0f3f8;color:#718098}.badge.trade{color:#468069;background:#ecf6f0}.selection{display:flex;align-items:center;justify-content:space-between;gap:16px;background:#f1f4ff;border:1px solid #dce3fd;border-radius:8px;padding:14px 16px;margin-top:16px}.list-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:12px}.list-heading input{max-width:300px}.alias-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:17px 0;border-bottom:1px solid #edf0f5}.alias-row:last-child{border-bottom:0}.alias-row strong{font-size:15px}.alias-row p{font-size:13px;margin-top:4px}.empty{color:#8a96a9;text-align:center;padding:30px 16px;font-size:14px}.error{font-size:13px;color:#b14d59;margin-top:12px;overflow-wrap:anywhere}.error:empty{display:none}footer{text-align:right;font-size:12px;color:#9ba5b5;margin-top:24px}.login-card{max-width:410px;margin:12vh auto;padding:32px;background:white;border:1px solid #e5eaf2;border-radius:13px;width:calc(100% - 32px)}.login-card .brand{margin-bottom:28px}.login-card h1{font-size:25px}.login-card label{margin-top:24px}dialog{width:420px;max-width:calc(100% - 32px);border:1px solid #e1e6ef;border-radius:12px;padding:26px;box-shadow:0 18px 70px #24334a26}dialog::backdrop{background:#23304955}dialog p{font-size:14px;margin:16px 0 24px;overflow-wrap:anywhere}.dialog-actions{display:flex;gap:12px;justify-content:flex-end}[hidden]{display:none!important}@media(max-width:600px){header{height:64px;padding:0 18px}main{padding:25px 16px}.panel{padding:20px}.heading{align-items:flex-start}h1{font-size:25px}.form-grid{grid-template-columns:1fr;gap:18px}.form-footer{align-items:flex-start}.list-heading{align-items:flex-start;flex-direction:column;gap:14px}.list-heading input{max-width:none}.alias-row>div,.item-option>div,.selection>div{min-width:0}.alias-row strong,.item-option strong,.selection strong{overflow-wrap:anywhere}.brand{font-size:21px}.brand span{font-size:13px}}
2
+ #sidebar{position:fixed;left:0;top:76px;bottom:0;width:200px;background:white;border-right:1px solid #e5eaf2;padding:26px 16px}#sidebar button{display:block;width:100%;text-align:left;margin-top:6px}#sidebar button.active{color:#5269d7;background:#eef1ff}.nav-label{font-size:12px;color:#8d99ac;padding:0 16px;margin-bottom:14px}#console main{margin-left:max(200px,calc((100% - 1040px)/2));margin-right:0}.arbitration-edit{display:grid;grid-template-columns:minmax(180px,1fr) 70px 110px auto;gap:14px;align-items:center;padding:18px 0;border-bottom:1px solid #edf0f5}.arbitration-edit p{font-size:13px}.arbitration-edit select{font:inherit;padding:10px;border:1px solid #dce2eb;border-radius:8px;background:white;min-width:0}.arbitration-edit strong{font-size:15px;overflow-wrap:anywhere}@media(max-width:760px){#sidebar{position:static;width:auto;display:flex;gap:10px;border-bottom:1px solid #e5eaf2;padding:8px 16px}.nav-label{display:none}#sidebar button{width:auto;margin:0}#console main{margin:0 auto}.arbitration-edit{grid-template-columns:70px 1fr auto;gap:10px}.arbitration-edit>div{grid-column:1/-1}}