Merge branch 'develop' into feat/collapsible-custom-locations

This commit is contained in:
jc21 authored and GitHub committed 2026-08-26 13:00:05 +10:00
commit a7677c18c3
71 files changed
+2176 -1865

No files matched your search

+82 -82
View File
@@ -27,73 +27,73 @@ import langList from "./lang/lang-list.json";
// not the country code
// Remember when adding to this list, also update check-locales.js script
const localeOptions = [
["en", "en-US", langEn],
["de", "de-DE", langDe],
["es", "es-ES", langEs],
["et", "et-EE", langEt],
["pt", "pt-PT", langPt],
["fr", "fr-FR", langFr],
["ga", "ga-IE", langGa],
["ja", "ja-JP", langJa],
["it", "it-IT", langIt],
["nl", "nl-NL", langNl],
["pl", "pl-PL", langPl],
["ru", "ru-RU", langRu],
["sk", "sk-SK", langSk],
["cs", "cs-CZ", langCs],
["vi", "vi-VN", langVi],
["zh", "zh-CN", langZh],
["ko", "ko-KR", langKo],
["bg", "bg-BG", langBg],
["id", "id-ID", langId],
["tr", "tr-TR", langTr],
["hu", "hu-HU", langHu],
["no", "no-NO", langNo],
["en", "en-US", langEn],
["de", "de-DE", langDe],
["es", "es-ES", langEs],
["et", "et-EE", langEt],
["pt", "pt-PT", langPt],
["fr", "fr-FR", langFr],
["ga", "ga-IE", langGa],
["ja", "ja-JP", langJa],
["it", "it-IT", langIt],
["nl", "nl-NL", langNl],
["pl", "pl-PL", langPl],
["ru", "ru-RU", langRu],
["sk", "sk-SK", langSk],
["cs", "cs-CZ", langCs],
["vi", "vi-VN", langVi],
["zh", "zh-CN", langZh],
["ko", "ko-KR", langKo],
["bg", "bg-BG", langBg],
["id", "id-ID", langId],
["tr", "tr-TR", langTr],
["hu", "hu-HU", langHu],
["no", "no-NO", langNo],
];
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const thisLocale = (locale || "en").slice(0, 2);
const thisLocale = (locale || "en").slice(0, 2);
// ensure this lang exists in localeOptions above, otherwise fallback to en
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
return Object.assign({}, langList, langEn);
}
// ensure this lang exists in localeOptions above, otherwise fallback to en
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
return Object.assign({}, langList, langEn);
}
return Object.assign({}, langList, langEn, localeOptions.find(([code]) => code === thisLocale)?.[2]);
return Object.assign({}, langList, langEn, localeOptions.find(([code]) => code === thisLocale)?.[2]);
};
const getFlagCodeForLocale = (locale?: string) => {
const thisLocale = (locale || "en").slice(0, 2);
const thisLocale = (locale || "en").slice(0, 2);
// only add to this if your flag is different from the locale code
const specialCases: Record<string, string> = {
ja: "jp", // Japan
zh: "cn", // China
vi: "vn", // Vietnam
ko: "kr", // Korea
cs: "cz", // Czechia
ga: "ie", // Ireland (Irish)
};
// only add to this if your flag is different from the locale code
const specialCases: Record<string, string> = {
ja: "jp", // Japan
zh: "cn", // China
vi: "vn", // Vietnam
ko: "kr", // Korea
cs: "cz", // Czechia
ga: "ie", // Ireland (Irish)
};
if (specialCases[thisLocale]) {
return specialCases[thisLocale].toUpperCase();
}
return thisLocale.toUpperCase();
if (specialCases[thisLocale]) {
return specialCases[thisLocale].toUpperCase();
}
return thisLocale.toUpperCase();
};
const getLocale = (short = false) => {
let loc = window.localStorage.getItem("locale");
if (!loc) {
loc = document.documentElement.lang;
}
if (short) {
return loc.slice(0, 2);
}
// finally, fallback
if (!loc) {
loc = "en";
}
return loc;
let loc = window.localStorage.getItem("locale");
if (!loc) {
loc = document.documentElement.lang;
}
if (short) {
return loc.slice(0, 2);
}
// finally, fallback
if (!loc) {
loc = "en";
}
return loc;
};
const cache = createIntlCache();
@@ -102,41 +102,41 @@ const initialMessages = loadMessages(getLocale());
let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache);
const changeLocale = (locale: string): void => {
const messages = loadMessages(locale);
intl = createIntl({ locale, messages }, cache);
window.localStorage.setItem("locale", locale);
document.documentElement.lang = locale;
const messages = loadMessages(locale);
intl = createIntl({ locale, messages }, cache);
window.localStorage.setItem("locale", locale);
document.documentElement.lang = locale;
};
// This is a translation component that wraps the translation in a span with a data
// attribute so devs can inspect the element to see the translation ID
const T = ({
id,
data,
tData,
id,
data,
tData,
}: {
id: string;
data?: Record<string, string | number | undefined>;
tData?: Record<string, string>;
id: string;
data?: Record<string, string | number | undefined>;
tData?: Record<string, string>;
}) => {
const translatedData: Record<string, string> = {};
if (tData) {
// iterate over tData and translate each value
Object.entries(tData).forEach(([key, value]) => {
translatedData[key] = intl.formatMessage({ id: value });
});
}
return (
<span data-translation-id={id}>
{intl.formatMessage(
{ id },
{
...data,
...translatedData,
},
)}
</span>
);
const translatedData: Record<string, string> = {};
if (tData) {
// iterate over tData and translate each value
Object.entries(tData).forEach(([key, value]) => {
translatedData[key] = intl.formatMessage({ id: value });
});
}
return (
<span data-translation-id={id}>
{intl.formatMessage(
{ id },
{
...data,
...translatedData,
},
)}
</span>
);
};
//console.log("L:", localeOptions);
+1 -6
View File
@@ -1,9 +1,4 @@
import {
fromUnixTime,
type IntlFormatFormatOptions,
intlFormat,
parseISO,
} from "date-fns";
import { fromUnixTime, type IntlFormatFormatOptions, intlFormat, parseISO } from "date-fns";
const isUnixTimestamp = (value: unknown): boolean => {
if (typeof value !== "number" && typeof value !== "string") return false;
+1 -1
View File
@@ -3,4 +3,4 @@ export * as Certificates from "./Certificates.md";
export * as DeadHosts from "./DeadHosts.md";
export * as ProxyHosts from "./ProxyHosts.md";
export * as RedirectionHosts from "./RedirectionHosts.md";
export * as Streams from "./Streams.md";
export * as Streams from "./Streams.md";
+8 -9
View File
@@ -22,18 +22,17 @@ import * as hu from "./hu/index";
const items: any = { en, de, pt, es, et, ja, sk, cs, zh, pl, ru, it, vi, nl, bg, ko, ga, id, fr, tr, hu };
const fallbackLang = "en";
export const getHelpFile = (lang: string, section: string): string => {
if (typeof items[lang] !== "undefined" && typeof items[lang][section] !== "undefined") {
return items[lang][section].default;
}
// Fallback to English
if (typeof items[fallbackLang] !== "undefined" && typeof items[fallbackLang][section] !== "undefined") {
return items[fallbackLang][section].default;
}
throw new Error(`Cannot load help doc for ${lang}-${section}`);
if (typeof items[lang] !== "undefined" && typeof items[lang][section] !== "undefined") {
return items[lang][section].default;
}
// Fallback to English
if (typeof items[fallbackLang] !== "undefined" && typeof items[fallbackLang][section] !== "undefined") {
return items[fallbackLang][section].default;
}
throw new Error(`Cannot load help doc for ${lang}-${section}`);
};
export default items;
@@ -4,4 +4,3 @@ export * as DeadHosts from "./DeadHosts.md";
export * as ProxyHosts from "./ProxyHosts.md";
export * as RedirectionHosts from "./RedirectionHosts.md";
export * as Streams from "./Streams.md";
@@ -4,4 +4,3 @@ export * as DeadHosts from "./DeadHosts.md";
export * as ProxyHosts from "./ProxyHosts.md";
export * as RedirectionHosts from "./RedirectionHosts.md";
export * as Streams from "./Streams.md";
+122 -2
View File
@@ -1,4 +1,61 @@
{
"2fa.backup-codes-remaining": {
"defaultMessage": "Verbleibende Backup-Codes: {count}"
},
"2fa.backup-warning": {
"defaultMessage": "Bewahre diese Backup-Codes an einem sicheren Ort auf. Jeder Code kann nur einmal verwendet werden."
},
"2fa.disable": {
"defaultMessage": "Zwei-Faktor-Authentifizierung deaktivieren"
},
"2fa.disable-confirm": {
"defaultMessage": "2FA deaktivieren"
},
"2fa.disable-warning": {
"defaultMessage": "Das Deaktivieren der Zwei-Faktor-Authentifizierung macht dein Konto weniger sicher."
},
"2fa.disabled": {
"defaultMessage": "Deaktiviert"
},
"2fa.done": {
"defaultMessage": "Ich habe meine Backup-Codes gespeichert"
},
"2fa.enable": {
"defaultMessage": "Zwei-Faktor-Authentifizierung aktivieren"
},
"2fa.enabled": {
"defaultMessage": "Aktiviert"
},
"2fa.enter-code": {
"defaultMessage": "Verifizierungscode eingeben"
},
"2fa.enter-code-disable": {
"defaultMessage": "Verifizierungscode zum Deaktivieren eingeben"
},
"2fa.regenerate": {
"defaultMessage": "Neu generieren"
},
"2fa.regenerate-backup": {
"defaultMessage": "Backup-Codes neu generieren"
},
"2fa.regenerate-instructions": {
"defaultMessage": "Gib einen Verifizierungscode ein, um neue Backup-Codes zu generieren. Deine alten Codes werden dadurch ungültig."
},
"2fa.secret-key": {
"defaultMessage": "Geheimer Schlüssel"
},
"2fa.setup-instructions": {
"defaultMessage": "Scanne diesen QR-Code mit deiner Authenticator-App oder gib den geheimen Schlüssel manuell ein."
},
"2fa.status": {
"defaultMessage": "Status"
},
"2fa.title": {
"defaultMessage": "Zwei-Faktor-Authentifizierung"
},
"2fa.verify-enable": {
"defaultMessage": "Verifizieren und aktivieren"
},
"access-list": {
"defaultMessage": "Zugriffsliste"
},
@@ -23,6 +80,9 @@
"access-list.public.subtitle": {
"defaultMessage": "Keine Authentifizierung erforderlich"
},
"access-list.rule-source.placeholder": {
"defaultMessage": "192.168.1.100 oder 192.168.1.0/24 oder 2001:0db8::/32"
},
"access-list.satisfy-any": {
"defaultMessage": "Satisfy Any"
},
@@ -38,12 +98,18 @@
"action.add-location": {
"defaultMessage": "Pfad hinzufügen"
},
"action.allow": {
"defaultMessage": "Erlauben"
},
"action.close": {
"defaultMessage": "Schließen"
},
"action.delete": {
"defaultMessage": "Löschen"
},
"action.deny": {
"defaultMessage": "Verweigern"
},
"action.disable": {
"defaultMessage": "Deaktivieren"
},
@@ -68,6 +134,9 @@
"auditlogs": {
"defaultMessage": "Protokolle"
},
"auto": {
"defaultMessage": "Automatisch"
},
"cancel": {
"defaultMessage": "Abbrechen"
},
@@ -128,6 +197,9 @@
"certificates.dns.provider": {
"defaultMessage": "DNS Provider"
},
"certificates.dns.provider.placeholder": {
"defaultMessage": "Anbieter auswählen..."
},
"certificates.dns.warning": {
"defaultMessage": "Dieser Abschnitt erfordert einige Kenntnisse über Certbot und seine DNS-Plugins. Bitte konsultieren Sie die jeweilige Plugin-Dokumentation."
},
@@ -275,6 +347,9 @@
"domain-names.wildcards-not-supported": {
"defaultMessage": "Wildcards werden für diese Zertifizierungsstelle nicht unterstützt."
},
"domains.advanced": {
"defaultMessage": "Erweitert"
},
"domains.force-ssl": {
"defaultMessage": "Erzwinge SSL"
},
@@ -287,6 +362,9 @@
"domains.http2-support": {
"defaultMessage": "HTTP/2 Support"
},
"domains.trust-forwarded-proto": {
"defaultMessage": "Upstream Forwarded-Proto-Header vertrauen"
},
"domains.use-dns": {
"defaultMessage": "Nutze DNS Challenge"
},
@@ -354,7 +432,7 @@
"defaultMessage": "Pfad beibehalten"
},
"host.flags.protocols": {
"defaultMessage": "Protokole"
"defaultMessage": "Protokolle"
},
"host.flags.websockets-upgrade": {
"defaultMessage": "Websockets Support"
@@ -383,6 +461,21 @@
"loading": {
"defaultMessage": "Laden…"
},
"login.2fa-code": {
"defaultMessage": "Verifizierungscode"
},
"login.2fa-code-placeholder": {
"defaultMessage": "Code eingeben"
},
"login.2fa-description": {
"defaultMessage": "Gib den Code aus deiner Authenticator-App ein"
},
"login.2fa-title": {
"defaultMessage": "Zwei-Faktor-Authentifizierung"
},
"login.2fa-verify": {
"defaultMessage": "Verifizieren"
},
"login.title": {
"defaultMessage": "Anmelden"
},
@@ -530,6 +623,24 @@
"redirection-hosts.count": {
"defaultMessage": "{count} {count, plural, one {Redirection Host} other {Redirection Hosts}}"
},
"redirection-hosts.http-code.300": {
"defaultMessage": "300 Mehrere Auswahlmöglichkeiten"
},
"redirection-hosts.http-code.301": {
"defaultMessage": "301 Dauerhaft verschoben"
},
"redirection-hosts.http-code.302": {
"defaultMessage": "302 Vorübergehend verschoben"
},
"redirection-hosts.http-code.303": {
"defaultMessage": "303 Siehe andere"
},
"redirection-hosts.http-code.307": {
"defaultMessage": "307 Temporäre Umleitung"
},
"redirection-hosts.http-code.308": {
"defaultMessage": "308 Permanente Umleitung"
},
"role.admin": {
"defaultMessage": "Administrator"
},
@@ -587,6 +698,9 @@
"stream.forward-host": {
"defaultMessage": "Forward Host"
},
"stream.forward-host.placeholder": {
"defaultMessage": "example.com oder 10.0.0.1 oder 2001:db8:3333:4444:5555:6666:7777:8888"
},
"stream.incoming-port": {
"defaultMessage": "Incoming Port"
},
@@ -605,6 +719,9 @@
"test": {
"defaultMessage": "Test"
},
"update-available": {
"defaultMessage": "Update verfügbar: {latestVersion}"
},
"user": {
"defaultMessage": "User"
},
@@ -647,10 +764,13 @@
"user.switch-light": {
"defaultMessage": "Zum Light Mode wechseln"
},
"user.two-factor": {
"defaultMessage": "Zwei-Faktor-Auth"
},
"username": {
"defaultMessage": "Benutzername"
},
"users": {
"defaultMessage": "Benutzer"
}
}
}