mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-03-14 09:38:15 -04:00
Basis for Certificate modal
This commit is contained in:
parent
df33db24bb
commit
a2b4fbc36f
@ -20,6 +20,8 @@ const ignoreUnused = [
|
|||||||
/^type\..*$/,
|
/^type\..*$/,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const ignoreMissing = [/^acmesh\..*$/];
|
||||||
|
|
||||||
const { spawnSync } = require("child_process");
|
const { spawnSync } = require("child_process");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
@ -53,6 +55,8 @@ const langList = require("./src/locale/src/lang-list.json");
|
|||||||
|
|
||||||
// store a list of all validation errors
|
// store a list of all validation errors
|
||||||
const allErrors = [];
|
const allErrors = [];
|
||||||
|
const allWarnings = [];
|
||||||
|
const allKeys = [];
|
||||||
|
|
||||||
const checkLangList = (fullCode) => {
|
const checkLangList = (fullCode) => {
|
||||||
const key = "locale-" + 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;
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -117,6 +149,7 @@ allLocales.map((locale, idx) => {
|
|||||||
// Verify all locale data
|
// Verify all locale data
|
||||||
allLocales.map((locale) => {
|
allLocales.map((locale) => {
|
||||||
compareLocale(locale);
|
compareLocale(locale);
|
||||||
|
checkForMissing(locale);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -125,7 +158,15 @@ if (allErrors.length) {
|
|||||||
console.log("\x1b[31m%s\x1b[0m", err);
|
console.log("\x1b[31m%s\x1b[0m", err);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (allWarnings.length) {
|
||||||
|
allWarnings.map((err) => {
|
||||||
|
console.log("\x1b[33m%s\x1b[0m", err);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allErrors.length) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +347,30 @@
|
|||||||
"theme.to-light": {
|
"theme.to-light": {
|
||||||
"defaultMessage": "Wechseln Sie zum Lichtdesign"
|
"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": {
|
"unhealthy.body": {
|
||||||
"defaultMessage": "Wir werden weiterhin den Zustand überprüfen und hoffen, bald wieder einsatzbereit zu sein!"
|
"defaultMessage": "Wir werden weiterhin den Zustand überprüfen und hoffen, bald wieder einsatzbereit zu sein!"
|
||||||
},
|
},
|
||||||
|
@ -626,6 +626,9 @@
|
|||||||
"theme.to-light": {
|
"theme.to-light": {
|
||||||
"defaultMessage": "Switch to light theme"
|
"defaultMessage": "Switch to light theme"
|
||||||
},
|
},
|
||||||
|
"type.custom": {
|
||||||
|
"defaultMessage": "Custom"
|
||||||
|
},
|
||||||
"type.dead": {
|
"type.dead": {
|
||||||
"defaultMessage": "404 Host"
|
"defaultMessage": "404 Host"
|
||||||
},
|
},
|
||||||
|
@ -350,6 +350,30 @@
|
|||||||
"theme.to-light": {
|
"theme.to-light": {
|
||||||
"defaultMessage": "به طرح زمینه روشن تغییر دهید"
|
"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": {
|
"unhealthy.body": {
|
||||||
"defaultMessage": "ما همچنان به بررسی وضعیت سلامتی خود ادامه خواهیم داد و امیدواریم به زودی دوباره راه اندازی شده و کار کنیم!"
|
"defaultMessage": "ما همچنان به بررسی وضعیت سلامتی خود ادامه خواهیم داد و امیدواریم به زودی دوباره راه اندازی شده و کار کنیم!"
|
||||||
},
|
},
|
||||||
|
@ -24,6 +24,8 @@ import { useSetCertificate } from "hooks";
|
|||||||
import { intl } from "locale";
|
import { intl } from "locale";
|
||||||
import { validateString } from "modules/Validations";
|
import { validateString } from "modules/Validations";
|
||||||
|
|
||||||
|
import HTTPForm from "./HTTPForm";
|
||||||
|
|
||||||
interface CertificateCreateModalProps {
|
interface CertificateCreateModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@ -104,13 +106,18 @@ function CertificateCreateModal({
|
|||||||
<ButtonGroup style={{ width: "100%" }}>
|
<ButtonGroup style={{ width: "100%" }}>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setCertType("http")}
|
onClick={() => setCertType("http")}
|
||||||
style={{ width: "50%" }}>
|
style={{ width: "33%" }}>
|
||||||
HTTP
|
{intl.formatMessage({ id: "type.http" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setCertType("dns")}
|
onClick={() => setCertType("dns")}
|
||||||
style={{ width: "50%" }}>
|
style={{ width: "34%" }}>
|
||||||
DNS
|
{intl.formatMessage({ id: "type.dns" })}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => setCertType("custom")}
|
||||||
|
style={{ width: "33%" }}>
|
||||||
|
{intl.formatMessage({ id: "type.custom" })}
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -143,6 +150,8 @@ function CertificateCreateModal({
|
|||||||
</Field>
|
</Field>
|
||||||
</Stack>
|
</Stack>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{certType === "http" ? <HTTPForm /> : null}
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
{certType !== "" ? (
|
{certType !== "" ? (
|
@ -0,0 +1,5 @@
|
|||||||
|
function CustomForm() {
|
||||||
|
return <p>Custom form</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CustomForm;
|
5
frontend/src/modals/CertificateCreateModal/DNSForm.tsx
Normal file
5
frontend/src/modals/CertificateCreateModal/DNSForm.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function DNSForm() {
|
||||||
|
return <p>DNS form</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DNSForm;
|
5
frontend/src/modals/CertificateCreateModal/HTTPForm.tsx
Normal file
5
frontend/src/modals/CertificateCreateModal/HTTPForm.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function HTTPForm() {
|
||||||
|
return <p>Http form</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HTTPForm;
|
1
frontend/src/modals/CertificateCreateModal/index.ts
Normal file
1
frontend/src/modals/CertificateCreateModal/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./CertificateCreateModal";
|
Loading…
Reference in New Issue
Block a user