diff --git a/changelog.d/20261027-public-listing-window.md b/changelog.d/20261027-public-listing-window.md index 10187f9..520ac5f 100644 --- a/changelog.d/20261027-public-listing-window.md +++ b/changelog.d/20261027-public-listing-window.md @@ -4,4 +4,4 @@ type: changed audience: admins title: Public listing is a short list of realms with a window for the details --- -Settings shows one line per realm with its listing state, and publishing or changing a realm opens a window. You can publish every realm at once, and each realm card on Overview has a button for its listing. +Settings shows one line per realm with its state, and publishing opens a window. Publish all realms at once. Account creation and portable characters are chosen before publishing; portable characters are on by default. diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index dde4d29..c03aa14 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -1113,17 +1113,18 @@ const en = { "registry.publishAll": "Publish all realms", "registry.publishAllText": "One description, language and region for every realm that is not listed yet. Each realm is listed under the server name; the realms that start next to the main one get their realm name added.", "registry.publishAllButton": "Publish {n} realms", - "registry.alreadyListed": "Already listed", + "registry.alreadyListed": "Already published", "registry.configure": "Configure", "registry.publishShort": "Publish", - "registry.short.starting": "Starting", - "registry.short.waiting_for_realm": "Waiting for the realm", - "registry.short.realm_stopped": "Listed as offline", - "registry.short.online": "Listed and online", + "registry.short.starting": "Publishing…", + "registry.accessFailed": "The realm is published, but its joining options were not saved: {reason}", + "registry.short.waiting_for_realm": "Not published", + "registry.short.realm_stopped": "Published, realm is off", + "registry.short.online": "Published", "registry.short.retrying": "Registry unreachable", - "registry.short.rejected": "Refused", - "registry.short.unpublishing": "Removing", - "registry.short.disabled": "Not listed", + "registry.short.rejected": "Refused by the registry", + "registry.short.unpublishing": "Removing from the list", + "registry.short.disabled": "Not published", "registry.text": "Publish this realm in the central list so that players can find it. Only its name, description, language, region, rates, modules, player counts, version and capabilities are shared: no passwords, no characters, no accounts. The realm keeps running if the list is unreachable.", "registry.url": "Registry address", "registry.urlSave": "Save address", diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 75ff0d2..c5886dc 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -1095,17 +1095,18 @@ const ru: Partial> = { "registry.publishAll": "Опубликовать все реалмы", "registry.publishAllText": "Одно описание, язык и регион для каждого реалма, которого ещё нет в списке. Реалмы публикуются под названием сервера; к реалмам, которые запускаются рядом с основным, добавляется название реалма.", "registry.publishAllButton": "Опубликовать реалмов: {n}", - "registry.alreadyListed": "Уже в списке", + "registry.alreadyListed": "Уже опубликован", "registry.configure": "Настроить", "registry.publishShort": "Опубликовать", - "registry.short.starting": "Запускается", - "registry.short.waiting_for_realm": "Ждёт реалм", - "registry.short.realm_stopped": "В списке как офлайн", - "registry.short.online": "В списке, онлайн", - "registry.short.retrying": "Реестр недоступен", - "registry.short.rejected": "Отклонён", - "registry.short.unpublishing": "Удаляется", - "registry.short.disabled": "Не в списке", + "registry.short.starting": "Публикуется…", + "registry.accessFailed": "Реалм опубликован, но настройки входа игроков не сохранены: {reason}", + "registry.short.waiting_for_realm": "Не опубликован", + "registry.short.realm_stopped": "Опубликован, реалм выключен", + "registry.short.online": "Опубликован", + "registry.short.retrying": "Нет связи с реестром", + "registry.short.rejected": "Реестр отклонил", + "registry.short.unpublishing": "Снимается с публикации", + "registry.short.disabled": "Не опубликован", "registry.text": "Опубликуйте этот реалм в общем списке, чтобы игроки могли его найти. Передаются только название, описание, язык, регион, рейты, модули, число игроков и ботов, версия и возможности реалма: никаких паролей, персонажей и аккаунтов. Если список недоступен, реалм продолжает работать.", "registry.url": "Адрес реестра", "registry.urlSave": "Сохранить адрес", diff --git a/src/screens/PublishDialog.tsx b/src/screens/PublishDialog.tsx index d16d160..55237b8 100644 --- a/src/screens/PublishDialog.tsx +++ b/src/screens/PublishDialog.tsx @@ -62,6 +62,19 @@ function ListingFields({ idPrefix, name, setName, description, setDescription, l ; } +/** Who may join and how: shown before publishing, so the choice is made once, not found later. */ +function JoinChoices({ existingOnly, setExistingOnly, allowPortable, setAllowPortable }: { existingOnly: boolean; setExistingOnly: (v: boolean) => void; allowPortable: boolean; setAllowPortable: (v: boolean) => void }) { + const t = useT(); + return ( +
+

{t("access.title")}

+

{t("access.text")}

+ + +
+ ); +} + /** Publishing, stopping and the access options of one realm. */ export function PublishRealmDialog({ realm, onClose }: { realm: PublishRealm; onClose: () => void }) { const t = useT(); @@ -75,7 +88,8 @@ export function PublishRealmDialog({ realm, onClose }: { realm: PublishRealm; on const [region, setRegion] = useState(""); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); - const [allowPortable, setAllowPortable] = useState(false); + // New listings start with portable characters allowed and accounts created for new players; the choice is shown before publishing. + const [allowPortable, setAllowPortable] = useState(true); const [existingOnly, setExistingOnly] = useState(false); const [route, setRoute] = useState(""); const [accessSaved, setAccessSaved] = useState(false); @@ -103,6 +117,17 @@ export function PublishRealmDialog({ realm, onClose }: { realm: PublishRealm; on setError(null); try { await action(); await refresh(); } catch (e) { setError(asUiError(e).technical); } finally { setBusy(false); } } + async function publish() { + setBusy(true); + setError(null); + try { + await realmRegistry.publish(localId, name, description, language, region.trim() === "" ? null : region.trim()); + // Saving the joining options needs the listing to exist; if it cannot be saved now (for example the server is running), the options stay available below. + try { await control.setAccess(localId, existingOnly, allowPortable, route.trim() === "" ? null : route.trim()); } + catch (e) { setError(t("registry.accessFailed", { reason: asControlError(e).message })); } + await refresh(); + } catch (e) { setError(asUiError(e).technical); } finally { setBusy(false); } + } return ( @@ -110,8 +135,9 @@ export function PublishRealmDialog({ realm, onClose }: { realm: PublishRealm; on {!published &&
+
- {!status?.url &&

{t("registry.noUrl")}

} @@ -159,6 +185,8 @@ export function PublishAllDialog({ realms, onClose }: { realms: PublishRealm[]; const [description, setDescription] = useState(""); const [language, setLanguage] = useState("en"); const [region, setRegion] = useState(""); + const [allowPortable, setAllowPortable] = useState(true); + const [existingOnly, setExistingOnly] = useState(false); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const todo = realms.filter((r) => !isListed(status?.realms.find((s) => s.local_id === r.localId))); @@ -167,8 +195,15 @@ export function PublishAllDialog({ realms, onClose }: { realms: PublishRealm[]; setBusy(true); setError(null); try { for (const r of todo) await realmRegistry.publish(r.localId, r.defaultName, description, language, region.trim() === "" ? null : region.trim()); + // The joining options are saved realm by realm; one that cannot be saved now (for example the server is running) does not stop the others. + const failed: string[] = []; + for (const r of todo) { + try { await control.setAccess(r.localId, existingOnly, allowPortable, null); } + catch (e) { failed.push(`${r.label}: ${asControlError(e).message}`); } + } await refresh(); - onClose(); + if (failed.length === 0) onClose(); + else setError(t("registry.accessFailed", { reason: failed.join(" · ") })); } catch (e) { setError(asUiError(e).technical); await refresh(); } finally { setBusy(false); } } @@ -180,6 +215,7 @@ export function PublishAllDialog({ realms, onClose }: { realms: PublishRealm[]; {todo.length > 0 &&
undefined} description={description} setDescription={setDescription} language={language} setLanguage={setLanguage} region={region} setRegion={setRegion} hideName /> +