mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Design store: reserved author names, screenshots, ratings, descriptions
Möpchi/Moepchi can only be used as an author name with a matching STORE_ADMIN_TOKEN bearer token. Submissions can now include an optional description and a manually uploaded screenshot (data URL, capped size), shown on browse cards, plus a simple 1-5 star rating (one vote per IP per theme). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
dd8528d3cb
commit
eb7cb78042
7 files changed
+363
-7
No files matched your search
+166
-6
@@ -336,18 +336,46 @@ const STORE_ALLOWED_ORIGIN = process.env.STORE_ALLOWED_ORIGIN ?? "*";
|
||||
const STORE_DATA_FILE = process.env.STORE_DATA_FILE ?? path.resolve(process.cwd(), "store-themes.json");
|
||||
const STORE_NAME_MAX_LENGTH = 60;
|
||||
const STORE_AUTHOR_MAX_LENGTH = 40;
|
||||
const STORE_DESCRIPTION_MAX_LENGTH = 300;
|
||||
const STORE_CSS_MAX_LENGTH = 50_000;
|
||||
// ~300KB image after base64 overhead - screenshots live inline in the same
|
||||
// flat JSON file as everything else, so this also bounds that file's growth.
|
||||
const STORE_SCREENSHOT_MAX_DATA_URL_LENGTH = 400_000;
|
||||
const STORE_SCREENSHOT_RE = /^data:image\/(png|jpe?g|webp);base64,[A-Za-z0-9+/]+=*$/;
|
||||
// Hard cap so the flat file can't grow unbounded from spam that slips past
|
||||
// rate limiting (a fresh IP per submission, say).
|
||||
const STORE_MAX_THEMES = 2000;
|
||||
const STORE_BASE_THEMES = new Set(["standard", "nova", "greenteaspeak", "pulse"]);
|
||||
|
||||
// A handful of names (the operator's own) that only whoever holds
|
||||
// STORE_ADMIN_TOKEN may publish under - stops anyone else from impersonating
|
||||
// the maintainer in the author field. Everyone else's name is first-come,
|
||||
// unenforced, same as any other free-text field here.
|
||||
const STORE_RESERVED_AUTHORS = new Set(
|
||||
(process.env.STORE_RESERVED_AUTHORS ?? "Möpchi,Moepchi")
|
||||
.split(",")
|
||||
.map((s) => s.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
);
|
||||
const STORE_ADMIN_TOKEN = process.env.STORE_ADMIN_TOKEN;
|
||||
|
||||
function isValidStoreAdminToken(provided: string): boolean {
|
||||
if (!STORE_ADMIN_TOKEN) return false;
|
||||
const a = Buffer.from(provided);
|
||||
const b = Buffer.from(STORE_ADMIN_TOKEN);
|
||||
return a.length === b.length && timingSafeEqual(a, b);
|
||||
}
|
||||
|
||||
interface StoreTheme {
|
||||
id: string;
|
||||
name: string;
|
||||
baseTheme: string;
|
||||
css: string;
|
||||
author: string;
|
||||
description: string;
|
||||
screenshot: string | null;
|
||||
ratingSum: number;
|
||||
ratingCount: number;
|
||||
createdAt: string;
|
||||
// ponytail: no moderation queue/admin UI yet - everything publishes as
|
||||
// "approved" immediately. The field exists so a bad submission can be
|
||||
@@ -398,10 +426,20 @@ function isStoreRateLimited(ip: string): boolean {
|
||||
return recent.length > STORE_RATE_LIMIT;
|
||||
}
|
||||
|
||||
// One rating per IP per theme - not robust against a determined multi-IP
|
||||
// spammer, but it stops the trivial "click again" case with no accounts to
|
||||
// build. Memory-only, so it resets on redeploy; a repeat vote after that just
|
||||
// counts twice, which is an acceptable ceiling for a beta feature.
|
||||
const storeRatingsSeen = new Set<string>();
|
||||
|
||||
function setStoreCors(res: ServerResponse) {
|
||||
res.setHeader("Access-Control-Allow-Origin", STORE_ALLOWED_ORIGIN);
|
||||
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
||||
}
|
||||
|
||||
function storeRating(theme: StoreTheme): { average: number; count: number } {
|
||||
return { average: theme.ratingCount ? theme.ratingSum / theme.ratingCount : 0, count: theme.ratingCount };
|
||||
}
|
||||
|
||||
async function handleStoreList(res: ServerResponse) {
|
||||
@@ -409,7 +447,16 @@ async function handleStoreList(res: ServerResponse) {
|
||||
const listing = themes
|
||||
.filter((t) => t.status === "approved")
|
||||
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
|
||||
.map(({ id, name, baseTheme, author, createdAt }) => ({ id, name, baseTheme, author, createdAt }));
|
||||
.map((t) => ({
|
||||
id: t.id,
|
||||
name: t.name,
|
||||
baseTheme: t.baseTheme,
|
||||
author: t.author,
|
||||
description: t.description,
|
||||
hasScreenshot: t.screenshot !== null,
|
||||
rating: storeRating(t),
|
||||
createdAt: t.createdAt,
|
||||
}));
|
||||
res.writeHead(200, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify(listing));
|
||||
}
|
||||
@@ -428,6 +475,83 @@ async function handleStoreDownload(res: ServerResponse, id: string) {
|
||||
res.end(JSON.stringify({ name: theme.name, baseTheme: theme.baseTheme, css: theme.css }));
|
||||
}
|
||||
|
||||
async function handleStoreScreenshot(res: ServerResponse, id: string) {
|
||||
const themes = await loadStoreThemes();
|
||||
const theme = themes.find((t) => t.id === id && t.status === "approved");
|
||||
if (!theme?.screenshot) {
|
||||
res.writeHead(404, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "not_found" }));
|
||||
return;
|
||||
}
|
||||
const match = /^data:(image\/[a-z]+);base64,(.+)$/.exec(theme.screenshot);
|
||||
if (!match) {
|
||||
res.writeHead(404, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "not_found" }));
|
||||
return;
|
||||
}
|
||||
res.writeHead(200, { "Content-Type": match[1], "Cache-Control": "public, max-age=3600" });
|
||||
res.end(Buffer.from(match[2], "base64"));
|
||||
}
|
||||
|
||||
async function handleStoreRate(req: IncomingMessage, res: ServerResponse, id: string) {
|
||||
const ip = (req.socket.remoteAddress ?? "unknown").replace(/^::ffff:/, "");
|
||||
const seenKey = `${ip}:${id}`;
|
||||
if (storeRatingsSeen.has(seenKey)) {
|
||||
res.writeHead(409, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "already_rated" }));
|
||||
return;
|
||||
}
|
||||
|
||||
let raw = "";
|
||||
for await (const chunk of req) {
|
||||
raw += chunk;
|
||||
if (raw.length > 200) {
|
||||
res.writeHead(413, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "payload_too_large" }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let body: { stars?: unknown };
|
||||
try {
|
||||
body = JSON.parse(raw || "{}");
|
||||
} catch {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "invalid_json" }));
|
||||
return;
|
||||
}
|
||||
|
||||
const stars = typeof body.stars === "number" ? Math.round(body.stars) : NaN;
|
||||
if (!Number.isInteger(stars) || stars < 1 || stars > 5) {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "invalid_stars" }));
|
||||
return;
|
||||
}
|
||||
|
||||
const themes = await loadStoreThemes();
|
||||
const theme = themes.find((t) => t.id === id && t.status === "approved");
|
||||
if (!theme) {
|
||||
res.writeHead(404, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "not_found" }));
|
||||
return;
|
||||
}
|
||||
|
||||
theme.ratingSum += stars;
|
||||
theme.ratingCount += 1;
|
||||
try {
|
||||
await saveStoreThemes(themes);
|
||||
} catch (err) {
|
||||
console.error("[store] Failed to save rating:", err);
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "save_failed" }));
|
||||
return;
|
||||
}
|
||||
storeRatingsSeen.add(seenKey);
|
||||
|
||||
res.writeHead(200, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ ok: true, rating: storeRating(theme) }));
|
||||
}
|
||||
|
||||
async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
const ip = (req.socket.remoteAddress ?? "unknown").replace(/^::ffff:/, "");
|
||||
if (isStoreRateLimited(ip)) {
|
||||
@@ -437,16 +561,25 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
}
|
||||
|
||||
let raw = "";
|
||||
const maxBytes = STORE_CSS_MAX_LENGTH + STORE_SCREENSHOT_MAX_DATA_URL_LENGTH + 5_000;
|
||||
for await (const chunk of req) {
|
||||
raw += chunk;
|
||||
if (raw.length > STORE_CSS_MAX_LENGTH + 5_000) {
|
||||
if (raw.length > maxBytes) {
|
||||
res.writeHead(413, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "payload_too_large" }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let body: { name?: unknown; baseTheme?: unknown; css?: unknown; author?: unknown; website?: unknown };
|
||||
let body: {
|
||||
name?: unknown;
|
||||
baseTheme?: unknown;
|
||||
css?: unknown;
|
||||
author?: unknown;
|
||||
description?: unknown;
|
||||
screenshot?: unknown;
|
||||
website?: unknown;
|
||||
};
|
||||
try {
|
||||
body = JSON.parse(raw || "{}");
|
||||
} catch {
|
||||
@@ -467,6 +600,7 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
const rawCss = typeof body.css === "string" ? body.css.slice(0, STORE_CSS_MAX_LENGTH) : "";
|
||||
const author =
|
||||
typeof body.author === "string" ? body.author.trim().slice(0, STORE_AUTHOR_MAX_LENGTH) || "Anonymous" : "Anonymous";
|
||||
const description = typeof body.description === "string" ? body.description.trim().slice(0, STORE_DESCRIPTION_MAX_LENGTH) : "";
|
||||
|
||||
if (!name || !baseTheme || !rawCss) {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
@@ -474,6 +608,16 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (STORE_RESERVED_AUTHORS.has(author.toLowerCase())) {
|
||||
const authHeader = req.headers.authorization ?? "";
|
||||
const token = authHeader.startsWith("Bearer ") ? authHeader.slice("Bearer ".length) : "";
|
||||
if (!isValidStoreAdminToken(token)) {
|
||||
res.writeHead(403, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "author_reserved" }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const css = sanitizeThemeCss(rawCss);
|
||||
if (css === null) {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
@@ -481,6 +625,16 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
let screenshot: string | null = null;
|
||||
if (typeof body.screenshot === "string" && body.screenshot !== "") {
|
||||
if (body.screenshot.length > STORE_SCREENSHOT_MAX_DATA_URL_LENGTH || !STORE_SCREENSHOT_RE.test(body.screenshot)) {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "invalid_screenshot" }));
|
||||
return;
|
||||
}
|
||||
screenshot = body.screenshot;
|
||||
}
|
||||
|
||||
const themes = await loadStoreThemes();
|
||||
if (themes.length >= STORE_MAX_THEMES) {
|
||||
res.writeHead(507, { "Content-Type": "application/json" });
|
||||
@@ -494,6 +648,10 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
|
||||
baseTheme,
|
||||
css,
|
||||
author,
|
||||
description,
|
||||
screenshot,
|
||||
ratingSum: 0,
|
||||
ratingCount: 0,
|
||||
createdAt: new Date().toISOString(),
|
||||
status: "approved",
|
||||
};
|
||||
@@ -528,8 +686,10 @@ async function handleStore(req: IncomingMessage, res: ServerResponse, pathname:
|
||||
if (req.method === "GET") return handleStoreList(res);
|
||||
if (req.method === "POST") return handleStoreSubmit(req, res);
|
||||
} else {
|
||||
const id = pathname.slice("/api/store/themes/".length);
|
||||
if (req.method === "GET" && id) return handleStoreDownload(res, id);
|
||||
const [id, sub] = pathname.slice("/api/store/themes/".length).split("/");
|
||||
if (id && !sub && req.method === "GET") return handleStoreDownload(res, id);
|
||||
if (id && sub === "screenshot" && req.method === "GET") return handleStoreScreenshot(res, id);
|
||||
if (id && sub === "rate" && req.method === "POST") return handleStoreRate(req, res, id);
|
||||
}
|
||||
|
||||
res.writeHead(405, { "Content-Type": "application/json" });
|
||||
|
||||
@@ -3378,6 +3378,41 @@
|
||||
background: conic-gradient(from 180deg, #7fb0e8, #ff8fab, #ffd166, #7fb0e8);
|
||||
}
|
||||
|
||||
.ts-design-theme-card-screenshot {
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--border-soft);
|
||||
object-fit: cover;
|
||||
max-height: 120px;
|
||||
}
|
||||
|
||||
.ts-design-theme-card-rating {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.1rem;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
|
||||
.ts-design-theme-card-star {
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--accent);
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ts-design-theme-card-star:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ts-design-theme-card-rating-count {
|
||||
margin-left: 0.3rem;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-design-theme-card-actions {
|
||||
display: flex;
|
||||
gap: 0.3rem;
|
||||
|
||||
+122
-1
@@ -311,9 +311,22 @@ type StoreThemeSummary = {
|
||||
name: string;
|
||||
baseTheme: DesignTheme;
|
||||
author: string;
|
||||
description: string;
|
||||
hasScreenshot: boolean;
|
||||
rating: { average: number; count: number };
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
// The operator's own admin token for publishing under a reserved author name
|
||||
// (see STORE_RESERVED_AUTHORS in gateway/src/index.ts) - kept in localStorage
|
||||
// so it only has to be entered once per browser, same idea as the last-used
|
||||
// connection fields above.
|
||||
const STORE_ADMIN_TOKEN_KEY = "webspeak3:store-admin-token";
|
||||
|
||||
// Mirrors the gateway's STORE_SCREENSHOT_MAX_DATA_URL_LENGTH - checked client-side
|
||||
// too so a rejected upload doesn't cost a round trip.
|
||||
const STORE_SCREENSHOT_MAX_DATA_URL_LENGTH = 400_000;
|
||||
|
||||
function isDesignTheme(value: string): value is DesignTheme {
|
||||
return value === "standard" || value === "nova" || value === "greenteaspeak" || value === "pulse";
|
||||
}
|
||||
@@ -5426,8 +5439,14 @@ function DesignStorePanel({
|
||||
const [installedIds, setInstalledIds] = useState<Set<string>>(new Set());
|
||||
const [publishTarget, setPublishTarget] = useState("");
|
||||
const [publishAuthor, setPublishAuthor] = useState("");
|
||||
const [publishDescription, setPublishDescription] = useState("");
|
||||
const [publishScreenshot, setPublishScreenshot] = useState<string | null>(null);
|
||||
const [publishAdminToken, setPublishAdminToken] = useState(
|
||||
() => localStorage.getItem(STORE_ADMIN_TOKEN_KEY) ?? ""
|
||||
);
|
||||
const [publishing, setPublishing] = useState(false);
|
||||
const [publishResult, setPublishResult] = useState<"ok" | "error" | null>(null);
|
||||
const [ratedIds, setRatedIds] = useState<Set<string>>(new Set());
|
||||
|
||||
const refreshThemes = () =>
|
||||
fetch(STORE_URL)
|
||||
@@ -5465,25 +5484,51 @@ function DesignStorePanel({
|
||||
}
|
||||
};
|
||||
|
||||
const handleScreenshotChange = (file: File | undefined) => {
|
||||
if (!file) {
|
||||
setPublishScreenshot(null);
|
||||
return;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const dataUrl = reader.result as string;
|
||||
if (dataUrl.length > STORE_SCREENSHOT_MAX_DATA_URL_LENGTH) {
|
||||
window.alert(t("design.store.publish.screenshotTooLarge"));
|
||||
return;
|
||||
}
|
||||
setPublishScreenshot(dataUrl);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
|
||||
const handlePublish = async () => {
|
||||
const theme = customThemes.find((c) => c.id === publishTarget);
|
||||
if (!theme) return;
|
||||
setPublishing(true);
|
||||
setPublishResult(null);
|
||||
try {
|
||||
const token = publishAdminToken.trim();
|
||||
if (token) localStorage.setItem(STORE_ADMIN_TOKEN_KEY, token);
|
||||
const res = await fetch(STORE_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: theme.name,
|
||||
baseTheme: theme.baseTheme,
|
||||
css: theme.css,
|
||||
author: publishAuthor.trim() || undefined,
|
||||
description: publishDescription.trim() || undefined,
|
||||
screenshot: publishScreenshot ?? undefined,
|
||||
}),
|
||||
});
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
setPublishResult("ok");
|
||||
setPublishAuthor("");
|
||||
setPublishDescription("");
|
||||
setPublishScreenshot(null);
|
||||
await refreshThemes();
|
||||
} catch {
|
||||
setPublishResult("error");
|
||||
@@ -5492,6 +5537,26 @@ function DesignStorePanel({
|
||||
}
|
||||
};
|
||||
|
||||
const handleRate = async (id: string, stars: number) => {
|
||||
setRatedIds((prev) => new Set(prev).add(id));
|
||||
try {
|
||||
const res = await fetch(`${STORE_URL}/${id}/rate`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ stars }),
|
||||
});
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
const parsed = await res.json();
|
||||
setThemes(
|
||||
(prev) => prev?.map((th) => (th.id === id ? { ...th, rating: parsed.rating } : th)) ?? prev
|
||||
);
|
||||
} catch {
|
||||
// Vote didn't count (already rated, offline, etc.) - the star stays marked
|
||||
// used locally so the person doesn't just click it again; no error UI needed
|
||||
// for what's a nice-to-have.
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3>{t("design.store.title")}</h3>
|
||||
@@ -5505,11 +5570,40 @@ function DesignStorePanel({
|
||||
{themes.length === 0 && <p className="ts-options-subtitle">{t("design.store.empty")}</p>}
|
||||
{themes.map((theme) => (
|
||||
<div key={theme.id} className="ts-design-theme-card ts-design-theme-card-custom">
|
||||
{theme.hasScreenshot && (
|
||||
<img
|
||||
className="ts-design-theme-card-screenshot"
|
||||
src={`${STORE_URL}/${theme.id}/screenshot`}
|
||||
alt={t("design.store.screenshotAlt", { name: theme.name })}
|
||||
/>
|
||||
)}
|
||||
<div className="ts-design-theme-card-select">
|
||||
<span className="ts-design-theme-swatch ts-design-theme-swatch-custom" />
|
||||
<span className="ts-design-theme-card-name">{theme.name}</span>
|
||||
<span className="ts-design-theme-card-desc">{t("design.store.by", { author: theme.author })}</span>
|
||||
</div>
|
||||
{theme.description && <p className="ts-design-theme-card-desc">{theme.description}</p>}
|
||||
<div className="ts-design-theme-card-rating">
|
||||
{[1, 2, 3, 4, 5].map((star) => (
|
||||
<button
|
||||
key={star}
|
||||
className="ts-design-theme-card-star"
|
||||
disabled={ratedIds.has(theme.id)}
|
||||
onClick={() => handleRate(theme.id, star)}
|
||||
title={t("design.store.rating.rate", { stars: String(star) })}
|
||||
>
|
||||
{star <= Math.round(theme.rating.average) ? "★" : "☆"}
|
||||
</button>
|
||||
))}
|
||||
<span className="ts-design-theme-card-rating-count">
|
||||
{theme.rating.count > 0
|
||||
? t("design.store.rating.summary", {
|
||||
average: theme.rating.average.toFixed(1),
|
||||
count: String(theme.rating.count),
|
||||
})
|
||||
: t("design.store.rating.none")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="ts-design-theme-card-actions">
|
||||
<button onClick={() => handleInstall(theme.id)} disabled={installedIds.has(theme.id)}>
|
||||
{installedIds.has(theme.id) ? t("design.store.installed") : t("design.store.install")}
|
||||
@@ -5543,6 +5637,33 @@ function DesignStorePanel({
|
||||
placeholder={t("design.store.publish.authorPlaceholder")}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-options-field">
|
||||
{t("design.store.publish.description")}
|
||||
<textarea
|
||||
value={publishDescription}
|
||||
onChange={(e) => setPublishDescription(e.target.value)}
|
||||
placeholder={t("design.store.publish.descriptionPlaceholder")}
|
||||
maxLength={300}
|
||||
rows={3}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-options-field">
|
||||
{t("design.store.publish.screenshot")}
|
||||
<input
|
||||
type="file"
|
||||
accept="image/png,image/jpeg,image/webp"
|
||||
onChange={(e) => handleScreenshotChange(e.target.files?.[0])}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-options-field">
|
||||
{t("design.store.publish.adminToken")}
|
||||
<input
|
||||
type="password"
|
||||
value={publishAdminToken}
|
||||
onChange={(e) => setPublishAdminToken(e.target.value)}
|
||||
placeholder={t("design.store.publish.adminTokenPlaceholder")}
|
||||
/>
|
||||
</label>
|
||||
<div className="ts-dialog-buttons-right">
|
||||
<button onClick={handlePublish} disabled={!publishTarget || publishing}>
|
||||
{t("design.store.publish.submit")}
|
||||
|
||||
@@ -298,11 +298,21 @@
|
||||
"design.store.install": "Installieren",
|
||||
"design.store.installed": "Installiert",
|
||||
"design.store.by": "von {author}",
|
||||
"design.store.screenshotAlt": "Screenshot von {name}",
|
||||
"design.store.rating.rate": "Mit {stars} Sternen bewerten",
|
||||
"design.store.rating.summary": "{average} ({count})",
|
||||
"design.store.rating.none": "Noch keine Bewertungen",
|
||||
"design.store.publishTitle": "Ein Design veröffentlichen",
|
||||
"design.store.publish.select": "Eigenes Design auswählen",
|
||||
"design.store.publish.none": "Du hast noch kein eigenes Design zum Veröffentlichen.",
|
||||
"design.store.publish.author": "Dein Name (optional)",
|
||||
"design.store.publish.authorPlaceholder": "Anonym",
|
||||
"design.store.publish.description": "Beschreibung (optional)",
|
||||
"design.store.publish.descriptionPlaceholder": "Was macht dieses Design besonders?",
|
||||
"design.store.publish.screenshot": "Screenshot (optional)",
|
||||
"design.store.publish.screenshotTooLarge": "Das Bild ist zu groß. Bitte ein kleineres Screenshot verwenden.",
|
||||
"design.store.publish.adminToken": "Admin-Token (nur für reservierte Namen nötig)",
|
||||
"design.store.publish.adminTokenPlaceholder": "Leer lassen, außer du weißt, was das ist",
|
||||
"design.store.publish.submit": "Im Store veröffentlichen",
|
||||
"design.store.publish.success": "Design wurde veröffentlicht!",
|
||||
"design.store.publish.error": "Veröffentlichen fehlgeschlagen.",
|
||||
|
||||
@@ -298,11 +298,21 @@
|
||||
"design.store.install": "Install",
|
||||
"design.store.installed": "Installed",
|
||||
"design.store.by": "by {author}",
|
||||
"design.store.screenshotAlt": "Screenshot of {name}",
|
||||
"design.store.rating.rate": "Rate {stars} stars",
|
||||
"design.store.rating.summary": "{average} ({count})",
|
||||
"design.store.rating.none": "No ratings yet",
|
||||
"design.store.publishTitle": "Publish a design",
|
||||
"design.store.publish.select": "Choose one of your own designs",
|
||||
"design.store.publish.none": "You don't have a custom design to publish yet.",
|
||||
"design.store.publish.author": "Your name (optional)",
|
||||
"design.store.publish.authorPlaceholder": "Anonymous",
|
||||
"design.store.publish.description": "Description (optional)",
|
||||
"design.store.publish.descriptionPlaceholder": "What makes this design special?",
|
||||
"design.store.publish.screenshot": "Screenshot (optional)",
|
||||
"design.store.publish.screenshotTooLarge": "That image is too large. Please use a smaller screenshot.",
|
||||
"design.store.publish.adminToken": "Admin token (only needed for reserved names)",
|
||||
"design.store.publish.adminTokenPlaceholder": "Leave empty unless you know what this is",
|
||||
"design.store.publish.submit": "Publish to the store",
|
||||
"design.store.publish.success": "Design published!",
|
||||
"design.store.publish.error": "Publishing failed.",
|
||||
|
||||
@@ -298,11 +298,21 @@
|
||||
"design.store.install": "نصب",
|
||||
"design.store.installed": "نصب شد",
|
||||
"design.store.by": "از {author}",
|
||||
"design.store.screenshotAlt": "اسکرینشات {name}",
|
||||
"design.store.rating.rate": "امتیاز {stars} ستاره",
|
||||
"design.store.rating.summary": "{average} ({count})",
|
||||
"design.store.rating.none": "هنوز امتیازی ثبت نشده",
|
||||
"design.store.publishTitle": "انتشار یک طراحی",
|
||||
"design.store.publish.select": "یکی از طراحیهای خودت را انتخاب کن",
|
||||
"design.store.publish.none": "هنوز طراحی سفارشی برای انتشار نداری.",
|
||||
"design.store.publish.author": "نام تو (اختیاری)",
|
||||
"design.store.publish.authorPlaceholder": "ناشناس",
|
||||
"design.store.publish.description": "توضیحات (اختیاری)",
|
||||
"design.store.publish.descriptionPlaceholder": "چه چیزی این طراحی را خاص میکند؟",
|
||||
"design.store.publish.screenshot": "اسکرینشات (اختیاری)",
|
||||
"design.store.publish.screenshotTooLarge": "این تصویر خیلی بزرگ است. لطفاً تصویر کوچکتری استفاده کن.",
|
||||
"design.store.publish.adminToken": "توکن ادمین (فقط برای نامهای رزرو شده لازم است)",
|
||||
"design.store.publish.adminTokenPlaceholder": "اگر نمیدانی این چیست، خالی بگذار",
|
||||
"design.store.publish.submit": "انتشار در فروشگاه",
|
||||
"design.store.publish.success": "طراحی منتشر شد!",
|
||||
"design.store.publish.error": "انتشار ناموفق بود.",
|
||||
|
||||
@@ -580,11 +580,21 @@
|
||||
"design.store.install": "安装",
|
||||
"design.store.installed": "已安装",
|
||||
"design.store.by": "作者:{author}",
|
||||
"design.store.screenshotAlt": "{name} 的截图",
|
||||
"design.store.rating.rate": "评{stars}星",
|
||||
"design.store.rating.summary": "{average}({count})",
|
||||
"design.store.rating.none": "暂无评分",
|
||||
"design.store.publishTitle": "发布设计",
|
||||
"design.store.publish.select": "选择你自己的设计",
|
||||
"design.store.publish.none": "你还没有可发布的自定义设计。",
|
||||
"design.store.publish.author": "你的名字(可选)",
|
||||
"design.store.publish.authorPlaceholder": "匿名",
|
||||
"design.store.publish.description": "描述(可选)",
|
||||
"design.store.publish.descriptionPlaceholder": "这个设计有什么特别之处?",
|
||||
"design.store.publish.screenshot": "截图(可选)",
|
||||
"design.store.publish.screenshotTooLarge": "图片太大,请使用更小的截图。",
|
||||
"design.store.publish.adminToken": "管理员令牌(仅保留名称需要)",
|
||||
"design.store.publish.adminTokenPlaceholder": "不确定的话请留空",
|
||||
"design.store.publish.submit": "发布到商店",
|
||||
"design.store.publish.success": "设计已发布!",
|
||||
"design.store.publish.error": "发布失败。",
|
||||
|
||||
Reference in new issue
Block a user