Files
2026-11-22 01:04:28 +08:00

26 lines
750 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from . import config
# 特殊序號:UID 用背景色標示,不帶任何權限。8 碼 UID 只要包含這些號碼就算(例如 00114514、51919810)
TIER_PATTERNS = ("1919810", "114514")
# 底色、文字色(網頁的 web/style.css 用同樣的顏色)
TIER_COLORS = {
"admin": ((245, 197, 24), (30, 26, 36)), # 黃 #F5C518
"1919810": ((240, 124, 42), (30, 26, 36)), # 橘 #F07C2A
"114514": ((47, 123, 235), (255, 255, 255)), # 藍 #2F7BEB
}
def fmt_uid(uid: int) -> str:
return f"{uid:08d}"
def uid_tier(uid: int) -> str | None:
if uid == config.ADMIN_UID:
return "admin"
s = fmt_uid(uid)
for pattern in TIER_PATTERNS:
if pattern in s:
return pattern
return None