feat(api): add public RESTful API with API key auth and documentation page
This commit is contained in:
43
app/i18n.py
43
app/i18n.py
@@ -6,6 +6,7 @@ _translations: dict[str, dict[str, str]] = {
|
||||
"nav.settings": {"zh": "设置", "en": "Settings"},
|
||||
"nav.invites": {"zh": "邀请码管理", "en": "Invites"},
|
||||
"nav.logout": {"zh": "退出", "en": "Logout"},
|
||||
"nav.api_docs": {"zh": "API 文档", "en": "API Docs"},
|
||||
|
||||
# ── Auth ──
|
||||
"login.title": {"zh": "登录", "en": "Login"},
|
||||
@@ -59,6 +60,7 @@ _translations: dict[str, dict[str, str]] = {
|
||||
# ── Postcards list ──
|
||||
"pc_list.title": {"zh": " 的明信片", "en": "'s postcards"},
|
||||
"pc_list.new": {"zh": "+ 新明信片", "en": "+ New postcard"},
|
||||
"pc_list.duplicate": {"zh": "编号已存在", "en": "Card number already exists"},
|
||||
"pc_list.all_countries": {"zh": "全部国家", "en": "All countries"},
|
||||
"pc_list.filter": {"zh": "筛选", "en": "Filter"},
|
||||
"pc_list.tab_sent": {"zh": "寄出", "en": "Sent"},
|
||||
@@ -208,6 +210,47 @@ _translations: dict[str, dict[str, str]] = {
|
||||
"flash.password_short": {"zh": "新密码长度至少6位", "en": "Password must be at least 6 characters"},
|
||||
"flash.password_ok": {"zh": "密码修改成功", "en": "Password changed"},
|
||||
|
||||
# ── API Keys ──
|
||||
"settings.tab_apikeys": {"zh": "API Keys", "en": "API Keys"},
|
||||
"apikey.title": {"zh": "API Key 管理", "en": "API Key Management"},
|
||||
"apikey.hint": {"zh": "使用 API Key 通过 HTTP 请求访问星笺的公共 API。请妥善保管你的 Key,它仅在创建时显示一次。", "en": "Use API Keys to access Mailova's public API via HTTP requests. Keep your key safe — it is only shown once upon creation."},
|
||||
"apikey.created": {"zh": "✅ 新 Key 已创建:", "en": "✅ New key created:"},
|
||||
"apikey.copy_now": {"zh": "⚠️ 请立即复制保存,关闭后将无法再次查看完整 Key。", "en": "⚠️ Copy it now. You won't be able to see the full key again after leaving this page."},
|
||||
"apikey.name_ph": {"zh": "Key 名称(可选)", "en": "Key name (optional)"},
|
||||
"apikey.create": {"zh": "创建 Key", "en": "Create Key"},
|
||||
"apikey.name": {"zh": "名称", "en": "Name"},
|
||||
"apikey.key": {"zh": "Key", "en": "Key"},
|
||||
"apikey.created_at": {"zh": "创建时间", "en": "Created"},
|
||||
"apikey.last_used": {"zh": "最后使用", "en": "Last used"},
|
||||
"apikey.delete": {"zh": "删除", "en": "Delete"},
|
||||
"apikey.confirm_delete": {"zh": "确定删除此 API Key?", "en": "Delete this API key?"},
|
||||
"apikey.empty": {"zh": "暂无 API Key", "en": "No API keys yet"},
|
||||
|
||||
# ── API Docs ──
|
||||
"api_docs.title": {"zh": "API 文档", "en": "API Documentation"},
|
||||
"api_docs.intro": {"zh": "星笺提供 RESTful API,供第三方应用集成使用。所有需要鉴权的请求需在 Header 中携带 X-API-Key。", "en": "Mailova provides a RESTful API for third-party integrations. All authenticated requests must include the X-API-Key header."},
|
||||
"api_docs.base_url": {"zh": "基础 URL", "en": "Base URL"},
|
||||
"api_docs.auth": {"zh": "鉴权方式", "en": "Authentication"},
|
||||
"api_docs.auth_desc": {"zh": "在请求头中携带你的 API Key:", "en": "Include your API Key in the request header:"},
|
||||
"api_docs.profile_ops": {"zh": "Profile 操作", "en": "Profile Operations"},
|
||||
"api_docs.postcard_ops": {"zh": "明信片操作", "en": "Postcard Operations"},
|
||||
"api_docs.upload_op": {"zh": "图片上传", "en": "Image Upload"},
|
||||
"api_docs.key_ops": {"zh": "API Key 管理", "en": "API Key Management"},
|
||||
"api_docs.showcase_ops": {"zh": "公开展示(无需鉴权)", "en": "Public Showcase (no auth)"},
|
||||
"api_docs.method": {"zh": "方法", "en": "Method"},
|
||||
"api_docs.path": {"zh": "路径", "en": "Path"},
|
||||
"api_docs.desc": {"zh": "说明", "en": "Description"},
|
||||
"api_docs.params": {"zh": "参数", "en": "Parameters"},
|
||||
"api_docs.body": {"zh": "请求体 (JSON)", "en": "Request Body (JSON)"},
|
||||
"api_docs.response": {"zh": "响应", "en": "Response"},
|
||||
"api_docs.status": {"zh": "状态码", "en": "Status"},
|
||||
"api_docs.go_settings": {"zh": "去设置页创建 API Key →", "en": "Go to Settings to create an API Key →"},
|
||||
"api_docs.try_it": {"zh": "试试看", "en": "Try it"},
|
||||
"api_docs.api_key_ph": {"zh": "输入你的 API Key", "en": "Enter your API Key"},
|
||||
"api_docs.send": {"zh": "发送", "en": "Send"},
|
||||
"api_docs.response_label": {"zh": "响应结果", "en": "Response"},
|
||||
"api_docs.no_auth": {"zh": "此接口无需鉴权", "en": "No authentication required"},
|
||||
|
||||
# ── Misc ──
|
||||
"misc.required": {"zh": " *", "en": " *"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user