Added default gifts from tg
This commit is contained in:
parent
ef73dfcd17
commit
31b323e36a
25092 changed files with 757287 additions and 31 deletions
|
|
@ -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/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-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/set-gift-enabled", s.requireAuthAPI(http.HandlerFunc(s.handleSetStarGiftEnabledAPI)))
|
||||
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)
|
||||
}
|
||||
|
||||
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 {
|
||||
CommandID string `json:"command_id"`
|
||||
Reason string `json:"reason"`
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
24
cmd/telesrv-admin/web/dist/index.html
vendored
24
cmd/telesrv-admin/web/dist/index.html
vendored
|
|
@ -1,13 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="en" translate="no">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>telesrv admin</title>
|
||||
<script type="module" crossorigin src="/assets/index-D9dH2J7N.js"></script>
|
||||
<!doctype html>
|
||||
<html lang="en" translate="no">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>telesrv admin</title>
|
||||
<script type="module" crossorigin src="/assets/index-DzNuxLKt.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DHdrFM5j.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ const translations: Record<Language, Record<string, string>> = {
|
|||
"gifts.received": "Received gifts",
|
||||
"gifts.formats": "Accepted formats",
|
||||
"gifts.add": "Add gift",
|
||||
"gifts.importAll": "Import all official gifts",
|
||||
"gifts.searchPlaceholder": "Search gift ID, title or format",
|
||||
"gifts.listSummary": "Showing {shown} of {total}",
|
||||
"gifts.idRevision": "ID / Revision",
|
||||
|
|
@ -622,6 +623,7 @@ const translations: Record<Language, Record<string, string>> = {
|
|||
"gifts.received": "已领取礼物",
|
||||
"gifts.formats": "支持格式",
|
||||
"gifts.add": "添加礼物",
|
||||
"gifts.importAll": "导入全部官方礼物",
|
||||
"gifts.searchPlaceholder": "搜索礼物 ID、标题或格式",
|
||||
"gifts.listSummary": "显示 {shown} / {total} 项",
|
||||
"gifts.idRevision": "ID / 版本",
|
||||
|
|
@ -992,6 +994,7 @@ const translations: Record<Language, Record<string, string>> = {
|
|||
"gifts.received": "Полученные подарки",
|
||||
"gifts.formats": "Поддерживаемые форматы",
|
||||
"gifts.add": "Добавить подарок",
|
||||
"gifts.importAll": "Импортировать все официальные подарки",
|
||||
"gifts.searchPlaceholder": "Поиск по ID подарка, названию или формату",
|
||||
"gifts.listSummary": "Показано {shown} из {total}",
|
||||
"gifts.idRevision": "ID / Версия",
|
||||
|
|
|
|||
|
|
@ -290,6 +290,16 @@ export function GiftsPage() {
|
|||
</div>
|
||||
{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="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">
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue