Added default gifts from tg

This commit is contained in:
onysd 2026-07-22 00:33:37 +03:00
parent ef73dfcd17
commit 31b323e36a
25092 changed files with 757287 additions and 31 deletions

View file

@ -73,6 +73,7 @@ func (s *server) routes() http.Handler {
mux.Handle("POST /api/actions/delete-history", s.requireAuthAPI(http.HandlerFunc(s.handleDeleteHistoryAPI))) mux.Handle("POST /api/actions/delete-history", s.requireAuthAPI(http.HandlerFunc(s.handleDeleteHistoryAPI)))
mux.Handle("POST /api/actions/import-gift", s.requireAuthAPI(http.HandlerFunc(s.handleImportStarGiftAPI))) mux.Handle("POST /api/actions/import-gift", s.requireAuthAPI(http.HandlerFunc(s.handleImportStarGiftAPI)))
mux.Handle("POST /api/actions/import-official-gift", s.requireAuthAPI(http.HandlerFunc(s.handleImportOfficialStarGiftAPI))) mux.Handle("POST /api/actions/import-official-gift", s.requireAuthAPI(http.HandlerFunc(s.handleImportOfficialStarGiftAPI)))
mux.Handle("POST /api/actions/import-all-official-gifts", s.requireAuthAPI(http.HandlerFunc(s.handleImportAllOfficialStarGiftsAPI)))
mux.Handle("POST /api/actions/publish-gift-collectibles", s.requireAuthAPI(http.HandlerFunc(s.handlePublishStarGiftCollectiblesAPI))) mux.Handle("POST /api/actions/publish-gift-collectibles", s.requireAuthAPI(http.HandlerFunc(s.handlePublishStarGiftCollectiblesAPI)))
mux.Handle("POST /api/actions/set-gift-enabled", s.requireAuthAPI(http.HandlerFunc(s.handleSetStarGiftEnabledAPI))) mux.Handle("POST /api/actions/set-gift-enabled", s.requireAuthAPI(http.HandlerFunc(s.handleSetStarGiftEnabledAPI)))
mux.Handle("POST /api/actions/set-gift-sort-order", s.requireAuthAPI(http.HandlerFunc(s.handleSetStarGiftSortOrderAPI))) mux.Handle("POST /api/actions/set-gift-sort-order", s.requireAuthAPI(http.HandlerFunc(s.handleSetStarGiftSortOrderAPI)))
@ -799,6 +800,24 @@ func (s *server) handleImportOfficialStarGiftAPI(w http.ResponseWriter, r *http.
writeCommandResultAPI(w, result, err) writeCommandResultAPI(w, result, err)
} }
type importAllOfficialStarGiftsAPIRequest struct {
CommandID string `json:"command_id"`
Reason string `json:"reason"`
Confirm bool `json:"confirm"`
}
func (s *server) handleImportAllOfficialStarGiftsAPI(w http.ResponseWriter, r *http.Request) {
var body importAllOfficialStarGiftsAPIRequest
if !decodeAction(w, r, &body) {
return
}
req := admin.ImportAllOfficialStarGiftsRequest{
CommandMeta: s.commandMetaFromAPI(r, body.CommandID, body.Reason, body.Confirm, "import-all-official-gifts"),
}
result, err := s.callAdminAPI(r.Context(), "/v1/official-gifts/import-all", req)
writeCommandResultAPI(w, result, err)
}
type publishStarGiftCollectiblesAPIRequest struct { type publishStarGiftCollectiblesAPIRequest struct {
CommandID string `json:"command_id"` CommandID string `json:"command_id"`
Reason string `json:"reason"` Reason string `json:"reason"`

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>telesrv admin</title> <title>telesrv admin</title>
<script type="module" crossorigin src="/assets/index-D9dH2J7N.js"></script> <script type="module" crossorigin src="/assets/index-DzNuxLKt.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DHdrFM5j.css"> <link rel="stylesheet" crossorigin href="/assets/index-DHdrFM5j.css">
</head> </head>
<body> <body>

View file

@ -252,6 +252,7 @@ const translations: Record<Language, Record<string, string>> = {
"gifts.received": "Received gifts", "gifts.received": "Received gifts",
"gifts.formats": "Accepted formats", "gifts.formats": "Accepted formats",
"gifts.add": "Add gift", "gifts.add": "Add gift",
"gifts.importAll": "Import all official gifts",
"gifts.searchPlaceholder": "Search gift ID, title or format", "gifts.searchPlaceholder": "Search gift ID, title or format",
"gifts.listSummary": "Showing {shown} of {total}", "gifts.listSummary": "Showing {shown} of {total}",
"gifts.idRevision": "ID / Revision", "gifts.idRevision": "ID / Revision",
@ -622,6 +623,7 @@ const translations: Record<Language, Record<string, string>> = {
"gifts.received": "已领取礼物", "gifts.received": "已领取礼物",
"gifts.formats": "支持格式", "gifts.formats": "支持格式",
"gifts.add": "添加礼物", "gifts.add": "添加礼物",
"gifts.importAll": "导入全部官方礼物",
"gifts.searchPlaceholder": "搜索礼物 ID、标题或格式", "gifts.searchPlaceholder": "搜索礼物 ID、标题或格式",
"gifts.listSummary": "显示 {shown} / {total} 项", "gifts.listSummary": "显示 {shown} / {total} 项",
"gifts.idRevision": "ID / 版本", "gifts.idRevision": "ID / 版本",
@ -992,6 +994,7 @@ const translations: Record<Language, Record<string, string>> = {
"gifts.received": "Полученные подарки", "gifts.received": "Полученные подарки",
"gifts.formats": "Поддерживаемые форматы", "gifts.formats": "Поддерживаемые форматы",
"gifts.add": "Добавить подарок", "gifts.add": "Добавить подарок",
"gifts.importAll": "Импортировать все официальные подарки",
"gifts.searchPlaceholder": "Поиск по ID подарка, названию или формату", "gifts.searchPlaceholder": "Поиск по ID подарка, названию или формату",
"gifts.listSummary": "Показано {shown} из {total}", "gifts.listSummary": "Показано {shown} из {total}",
"gifts.idRevision": "ID / Версия", "gifts.idRevision": "ID / Версия",

View file

@ -290,6 +290,16 @@ export function GiftsPage() {
</div> </div>
{importSource === "official" ? <section className="official-gift-picker"> {importSource === "official" ? <section className="official-gift-picker">
<div className="gift-import-note"><span>{t("gifts.officialHint")}</span><div className="gift-format-chips"><span>{officialGifts.length}</span><span>SHA-256</span></div></div> <div className="gift-import-note"><span>{t("gifts.officialHint")}</span><div className="gift-format-chips"><span>{officialGifts.length}</span><span>SHA-256</span></div></div>
<div className="official-gift-bulk-import">
<ActionButton
label={t("gifts.importAll")}
path="/api/actions/import-all-official-gifts"
payload={() => ({})}
tone="neutral"
icon={<Upload size={14} />}
onDone={() => void load()}
/>
</div>
<div className="official-gift-tools"> <div className="official-gift-tools">
<label className="searchbox"><Search size={15} /><input value={officialQuery} onChange={(e) => setOfficialQuery(e.target.value)} placeholder={t("gifts.officialSearch")} /></label> <label className="searchbox"><Search size={15} /><input value={officialQuery} onChange={(e) => setOfficialQuery(e.target.value)} placeholder={t("gifts.officialSearch")} /></label>
<span>{t("gifts.officialResults", { shown: visibleOfficial.length, total: officialGifts.length })}</span> <span>{t("gifts.officialResults", { shown: visibleOfficial.length, total: officialGifts.length })}</span>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more