diff --git a/frontend/check-locales.js b/frontend/check-locales.js index c8d62dbe..cc52dd8e 100755 --- a/frontend/check-locales.js +++ b/frontend/check-locales.js @@ -20,6 +20,8 @@ const ignoreUnused = [ /^type\..*$/, ]; +const ignoreMissing = [/^acmesh\..*$/]; + const { spawnSync } = require("child_process"); const fs = require("fs"); @@ -53,6 +55,8 @@ const langList = require("./src/locale/src/lang-list.json"); // store a list of all validation errors const allErrors = []; +const allWarnings = []; +const allKeys = []; const checkLangList = (fullCode) => { const key = "locale-" + fullCode; @@ -103,6 +107,34 @@ const compareLocale = (locale) => { ); } } + + // Add this key to allKeys + if (allKeys.indexOf(key) === -1) { + allKeys.push(key); + } + return null; + }); +}; + +// Checks for any keys missing from this locale, that +// have been defined in any other locales +const checkForMissing = (locale) => { + allKeys.forEach((key) => { + if (typeof locale.data[key] === "undefined") { + let ignored = false; + ignoreMissing.map((regex) => { + if (key.match(regex)) { + ignored = true; + } + return null; + }); + + if (!ignored) { + allWarnings.push( + "WARN: `" + locale[0] + "` does not contain item: `" + key + "`", + ); + } + } return null; }); }; @@ -117,6 +149,7 @@ allLocales.map((locale, idx) => { // Verify all locale data allLocales.map((locale) => { compareLocale(locale); + checkForMissing(locale); return null; }); @@ -125,7 +158,15 @@ if (allErrors.length) { console.log("\x1b[31m%s\x1b[0m", err); return null; }); +} +if (allWarnings.length) { + allWarnings.map((err) => { + console.log("\x1b[33m%s\x1b[0m", err); + return null; + }); +} +if (allErrors.length) { process.exit(1); } diff --git a/frontend/src/locale/src/de.json b/frontend/src/locale/src/de.json index 319d4fcf..dee8a3f1 100644 --- a/frontend/src/locale/src/de.json +++ b/frontend/src/locale/src/de.json @@ -347,6 +347,30 @@ "theme.to-light": { "defaultMessage": "Wechseln Sie zum Lichtdesign" }, + "type.custom": { + "defaultMessage": "Custom" + }, + "type.dead": { + "defaultMessage": "404 Host" + }, + "type.dns": { + "defaultMessage": "DNS" + }, + "type.http": { + "defaultMessage": "HTTP" + }, + "type.proxy": { + "defaultMessage": "Proxy Host" + }, + "type.redirect": { + "defaultMessage": "Redirection" + }, + "type.stream": { + "defaultMessage": "Stream" + }, + "type.upstream": { + "defaultMessage": "Upstream" + }, "unhealthy.body": { "defaultMessage": "Wir werden weiterhin den Zustand überprüfen und hoffen, bald wieder einsatzbereit zu sein!" }, diff --git a/frontend/src/locale/src/en.json b/frontend/src/locale/src/en.json index 0a8cac72..d657a718 100644 --- a/frontend/src/locale/src/en.json +++ b/frontend/src/locale/src/en.json @@ -626,6 +626,9 @@ "theme.to-light": { "defaultMessage": "Switch to light theme" }, + "type.custom": { + "defaultMessage": "Custom" + }, "type.dead": { "defaultMessage": "404 Host" }, diff --git a/frontend/src/locale/src/fa.json b/frontend/src/locale/src/fa.json index 4b3d7e80..4d3abeeb 100644 --- a/frontend/src/locale/src/fa.json +++ b/frontend/src/locale/src/fa.json @@ -350,6 +350,30 @@ "theme.to-light": { "defaultMessage": "به طرح زمینه روشن تغییر دهید" }, + "type.custom": { + "defaultMessage": "Custom" + }, + "type.dead": { + "defaultMessage": "404 Host" + }, + "type.dns": { + "defaultMessage": "DNS" + }, + "type.http": { + "defaultMessage": "HTTP" + }, + "type.proxy": { + "defaultMessage": "Proxy Host" + }, + "type.redirect": { + "defaultMessage": "Redirection" + }, + "type.stream": { + "defaultMessage": "Stream" + }, + "type.upstream": { + "defaultMessage": "Upstream" + }, "unhealthy.body": { "defaultMessage": "ما همچنان به بررسی وضعیت سلامتی خود ادامه خواهیم داد و امیدواریم به زودی دوباره راه اندازی شده و کار کنیم!" }, diff --git a/frontend/src/modals/CertificateCreateModal.tsx b/frontend/src/modals/CertificateCreateModal/CertificateCreateModal.tsx similarity index 89% rename from frontend/src/modals/CertificateCreateModal.tsx rename to frontend/src/modals/CertificateCreateModal/CertificateCreateModal.tsx index 59cab44c..fc43c45b 100644 --- a/frontend/src/modals/CertificateCreateModal.tsx +++ b/frontend/src/modals/CertificateCreateModal/CertificateCreateModal.tsx @@ -24,6 +24,8 @@ import { useSetCertificate } from "hooks"; import { intl } from "locale"; import { validateString } from "modules/Validations"; +import HTTPForm from "./HTTPForm"; + interface CertificateCreateModalProps { isOpen: boolean; onClose: () => void; @@ -104,13 +106,18 @@ function CertificateCreateModal({ + @@ -143,6 +150,8 @@ function CertificateCreateModal({ ) : null} + + {certType === "http" ? : null} {certType !== "" ? ( diff --git a/frontend/src/modals/CertificateCreateModal/CustomForm.tsx b/frontend/src/modals/CertificateCreateModal/CustomForm.tsx new file mode 100644 index 00000000..e76cbbb3 --- /dev/null +++ b/frontend/src/modals/CertificateCreateModal/CustomForm.tsx @@ -0,0 +1,5 @@ +function CustomForm() { + return

Custom form

; +} + +export default CustomForm; diff --git a/frontend/src/modals/CertificateCreateModal/DNSForm.tsx b/frontend/src/modals/CertificateCreateModal/DNSForm.tsx new file mode 100644 index 00000000..adf1f5e3 --- /dev/null +++ b/frontend/src/modals/CertificateCreateModal/DNSForm.tsx @@ -0,0 +1,5 @@ +function DNSForm() { + return

DNS form

; +} + +export default DNSForm; diff --git a/frontend/src/modals/CertificateCreateModal/HTTPForm.tsx b/frontend/src/modals/CertificateCreateModal/HTTPForm.tsx new file mode 100644 index 00000000..82e13737 --- /dev/null +++ b/frontend/src/modals/CertificateCreateModal/HTTPForm.tsx @@ -0,0 +1,5 @@ +function HTTPForm() { + return

Http form

; +} + +export default HTTPForm; diff --git a/frontend/src/modals/CertificateCreateModal/index.ts b/frontend/src/modals/CertificateCreateModal/index.ts new file mode 100644 index 00000000..94830905 --- /dev/null +++ b/frontend/src/modals/CertificateCreateModal/index.ts @@ -0,0 +1 @@ +export * from "./CertificateCreateModal";