chore: remove scripts and export_i18n.py from git, add to .gitignore

This commit is contained in:
2026-07-07 11:35:00 +08:00
parent ce377157a0
commit 8a4500f723
7 changed files with 20 additions and 52 deletions

View File

@@ -17,6 +17,11 @@
"admin.copyright_label": "Copyright Text",
"admin.copyright_hint": "Displayed at the bottom of all pages. Leave empty to hide.",
"admin.save_config": "Save",
"admin.invite_length_error": "Invite code must be 8 characters",
"admin.invite_exists_error": "Invite code already exists",
"admin.invite_created": "Invite code {code} created",
"admin.invite_updated": "Invite code {code} updated",
"admin.config_saved": "Settings saved",
"login.title": "Login",
"login.username": "Username",
"login.password": "Password",

View File

@@ -17,6 +17,11 @@
"admin.copyright_label": "Copyright 文本",
"admin.copyright_hint": "将显示在所有页面底部,留空则不显示。",
"admin.save_config": "保存设置",
"admin.invite_length_error": "邀请码必须为8个字符",
"admin.invite_exists_error": "邀请码已存在",
"admin.invite_created": "邀请码 {code} 已创建",
"admin.invite_updated": "邀请码 {code} 已更新",
"admin.config_saved": "设置已保存",
"login.title": "登录",
"login.username": "用户名",
"login.password": "密码",

View File

@@ -102,7 +102,7 @@ def _get_copyright() -> str:
return ""
templates.env.globals["copyright_text"] = _get_copyright()
templates.env.globals["get_copyright"] = _get_copyright
def _redirect(url: str) -> RedirectResponse:
@@ -270,7 +270,7 @@ def admin_save_config(
cfg = SystemConfig(key="copyright_text", value=copyright_text.strip())
db.add(cfg)
db.commit()
return _admin_render(request, user, db, "config", success="Saved")
return _admin_render(request, user, db, "config", success=_t("admin.config_saved", user.language))
@router.post("/admin/invites/add")
@@ -291,9 +291,9 @@ def admin_add_invite(
else:
code = code.strip()
if len(code) != 8:
return _admin_render(request, user, db, "invites", error="邀请码必须为8个字符")
return _admin_render(request, user, db, "invites", error=_t("admin.invite_length_error", user.language))
if db.query(InviteCode).filter(InviteCode.code == code).first():
return _admin_render(request, user, db, "invites", error="邀请码已存在")
return _admin_render(request, user, db, "invites", error=_t("admin.invite_exists_error", user.language))
# Parse limits
m_uses = None
exp_at = None
@@ -307,7 +307,7 @@ def admin_add_invite(
)
db.add(new_code)
db.commit()
return _admin_render(request, user, db, "invites", success=f"邀请码 {code} 已创建")
return _admin_render(request, user, db, "invites", success=_t("admin.invite_created", user.language).format(code=code))
@router.post("/admin/invites/{code_id}/edit")
@@ -335,7 +335,7 @@ def admin_edit_invite(
code_obj.max_uses = None
code_obj.expires_at = None
db.commit()
return _admin_render(request, user, db, "invites", success=f"邀请码 {code_obj.code} 已更新")
return _admin_render(request, user, db, "invites", success=_t("admin.invite_updated", user.language).format(code=code_obj.code))
@router.post("/admin/invites/{code_id}/delete")

View File

@@ -39,9 +39,10 @@
<main class="container">
{% block content %}{% endblock %}
</main>
{% if copyright_text %}
{% set _c = get_copyright() %}
{% if _c %}
<footer style="text-align:center;padding:2rem 1rem;color:var(--text-muted);font-size:.8rem;border-top:1px solid var(--border);margin-top:2rem">
{{ copyright_text }}
{{ _c }}
</footer>
{% endif %}
</body>