mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-02-01 16:32:54 +00:00
Compare commits
167 Commits
v2.13.5
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8532e7520f | ||
|
|
bad3eac515 | ||
|
|
00b58f73f8 | ||
|
|
47981f0d56 | ||
|
|
38257859e2 | ||
|
|
a169e1131c | ||
|
|
a99cde9cd8 | ||
|
|
c69bd187af | ||
|
|
98fe622967 | ||
|
|
eddca3597d | ||
|
|
ed0b2306a2 | ||
|
|
17f6050de2 | ||
|
|
469d72a2f9 | ||
|
|
3ed3ec0001 | ||
|
|
24ff3c7b11 | ||
|
|
58dda941b8 | ||
|
|
f9f743499f | ||
|
|
534afe6067 | ||
|
|
9580903f5d | ||
|
|
df81c8425f | ||
|
|
b6f421c5fc | ||
|
|
c1ef3a3795 | ||
|
|
0aad939ccc | ||
|
|
7e092e265c | ||
|
|
cd01a2ee6b | ||
|
|
9e6720561a | ||
|
|
c50f0a144e | ||
|
|
2a9c1df3cb | ||
|
|
ef6391f22e | ||
|
|
0f46337710 | ||
|
|
1b84b8ace2 | ||
|
|
8ea8286cec | ||
|
|
7ca48f876b | ||
|
|
7c3c59c79f | ||
|
|
ef7f444404 | ||
|
|
f509e0bdba | ||
|
|
9b7af474bb | ||
|
|
28982b8bc2 | ||
|
|
19e654b998 | ||
|
|
eaf9f5ab1e | ||
|
|
4af0a968f0 | ||
|
|
df06eb6c2f | ||
|
|
74360cc9b3 | ||
|
|
16a301fc64 | ||
|
|
2d774124dc | ||
|
|
124737bbc6 | ||
|
|
d5d222ef2d | ||
|
|
b96e932c64 | ||
|
|
d09cb2884c | ||
|
|
71deabcc67 | ||
|
|
a78039b65f | ||
|
|
48acbd33ab | ||
|
|
32cabc0f83 | ||
|
|
03a82cd861 | ||
|
|
5f19f7125e | ||
|
|
8d35644190 | ||
|
|
ad2e4c8afe | ||
|
|
69f9031447 | ||
|
|
3308a308df | ||
|
|
59b0e75324 | ||
|
|
727bc944ea | ||
|
|
a0ef0d9048 | ||
|
|
d2e346c912 | ||
|
|
32a716b3a9 | ||
|
|
ef6918947c | ||
|
|
2deb5447d6 | ||
|
|
1bb29259ea | ||
|
|
fa20c7d8a4 | ||
|
|
4ed17fef01 | ||
|
|
fe316252f1 | ||
|
|
7747db994d | ||
|
|
9ffced265b | ||
|
|
50cf275328 | ||
|
|
7bcc34dea9 | ||
|
|
131e5fea4f | ||
|
|
4e412f18bb | ||
|
|
bb0a50eccb | ||
|
|
4185665570 | ||
|
|
9ea6fee3ce | ||
|
|
7ee9a3c9f0 | ||
|
|
afb196e5b6 | ||
|
|
0b464ac9fd | ||
|
|
7b3c1fd061 | ||
|
|
ee42202348 | ||
|
|
c1ad7788f1 | ||
|
|
d33bb02c74 | ||
|
|
462c134751 | ||
|
|
b7dfaddbb1 | ||
|
|
11ee4f0820 | ||
|
|
19970a4220 | ||
|
|
59bac3b468 | ||
|
|
48753fb101 | ||
|
|
2a3978ae3f | ||
|
|
4ce5da5930 | ||
|
|
89d3756ee6 | ||
|
|
58c63096e4 | ||
|
|
b01a22c393 | ||
|
|
9c25410331 | ||
|
|
b3a901bbc5 | ||
|
|
3e3396ba9a | ||
|
|
3eb493bb8b | ||
|
|
8c8221a352 | ||
|
|
582681e3ff | ||
|
|
52fae6d35f | ||
|
|
6c0ea835ce | ||
|
|
fb52655374 | ||
|
|
336726db8d | ||
|
|
4a7853163e | ||
|
|
b30f8e47e2 | ||
|
|
6fa30840be | ||
|
|
05726aaab9 | ||
|
|
f85bb79f13 | ||
|
|
471b62c7fe | ||
|
|
55a1e0a4e7 | ||
|
|
f25afa3590 | ||
|
|
9211ba6d1a | ||
|
|
aeb44244a7 | ||
|
|
d2d204ab8e | ||
|
|
427afa55b4 | ||
|
|
bbe98a639a | ||
|
|
f0c0b465d9 | ||
|
|
6c2f6a9d39 | ||
|
|
2f6e3ad804 | ||
|
|
c9f453714b | ||
|
|
5e6ead1eee | ||
|
|
da519e72ba | ||
|
|
b13ebb2247 | ||
|
|
6b322582b9 | ||
|
|
7fe5070337 | ||
|
|
1b8f1fbb79 | ||
|
|
4abea1247d | ||
|
|
073ee95e56 | ||
|
|
fec8b3b083 | ||
|
|
168078eb40 | ||
|
|
2c9f8f4d64 | ||
|
|
8403a0c761 | ||
|
|
d18c8cf4f1 | ||
|
|
bf4eab541a | ||
|
|
f9edcb10e6 | ||
|
|
ba43c144f6 | ||
|
|
896951f6cd | ||
|
|
865b566ea6 | ||
|
|
45bc44c6fa | ||
|
|
4ff402fff4 | ||
|
|
1c6f54fa3c | ||
|
|
e8ca72fb6a | ||
|
|
4712633568 | ||
|
|
a1fb54c394 | ||
|
|
927e57257b | ||
|
|
e353a66556 | ||
|
|
991bddf891 | ||
|
|
c076ad145c | ||
|
|
80cf4406d5 | ||
|
|
3cb124d5a0 | ||
|
|
03b0513a24 | ||
|
|
0528d65317 | ||
|
|
f9991084fc | ||
|
|
56875bba52 | ||
|
|
b55f51bd63 | ||
|
|
20e2d5ffb3 | ||
|
|
86b7394620 | ||
|
|
91a1f39c02 | ||
|
|
5c114e9db7 | ||
|
|
fec9bffe29 | ||
|
|
e3cdc8bb30 | ||
|
|
ba79eefe5e | ||
|
|
bb94ce75c1 |
104
.github/dependabot.yml
vendored
Normal file
104
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/backend"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
dev-patch-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
dev-minor-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
prod-patch-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
prod-minor-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/frontend"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
dev-patch-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
dev-minor-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
prod-patch-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
prod-minor-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/docs"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
dev-patch-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
dev-minor-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
prod-patch-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
prod-minor-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/test"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
dev-patch-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
dev-minor-updates:
|
||||||
|
dependency-type: "development"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
prod-patch-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
prod-minor-updates:
|
||||||
|
dependency-type: "production"
|
||||||
|
update-types:
|
||||||
|
- "minor"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "/docker"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
updates:
|
||||||
|
update-types:
|
||||||
|
- "patch"
|
||||||
|
- "minor"
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v9
|
- uses: actions/stale@v10
|
||||||
with:
|
with:
|
||||||
stale-issue-label: 'stale'
|
stale-issue-label: 'stale'
|
||||||
stale-pr-label: 'stale'
|
stale-pr-label: 'stale'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://nginxproxymanager.com/github.png">
|
<img src="https://nginxproxymanager.com/github.png">
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/badge/version-2.13.5-green.svg?style=for-the-badge">
|
<img src="https://img.shields.io/badge/version-2.13.6-green.svg?style=for-the-badge">
|
||||||
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
||||||
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.12/schema.json",
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"clientKind": "git",
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
"cloudns": {
|
"cloudns": {
|
||||||
"name": "ClouDNS",
|
"name": "ClouDNS",
|
||||||
"package_name": "certbot-dns-cloudns",
|
"package_name": "certbot-dns-cloudns",
|
||||||
"version": "~=0.6.0",
|
"version": "~=0.7.0",
|
||||||
"dependencies": "",
|
"dependencies": "",
|
||||||
"credentials": "# Target user ID (see https://www.cloudns.net/api-settings/)\n\tdns_cloudns_auth_id=1234\n\t# Alternatively, one of the following two options can be set:\n\t# dns_cloudns_sub_auth_id=1234\n\t# dns_cloudns_sub_auth_user=foobar\n\n\t# API password\n\tdns_cloudns_auth_password=password1",
|
"credentials": "# Target user ID (see https://www.cloudns.net/api-settings/)\n\tdns_cloudns_auth_id=1234\n\t# Alternatively, one of the following two options can be set:\n\t# dns_cloudns_sub_auth_id=1234\n\t# dns_cloudns_sub_auth_user=foobar\n\n\t# API password\n\tdns_cloudns_auth_password=password1",
|
||||||
"full_plugin_name": "dns-cloudns"
|
"full_plugin_name": "dns-cloudns"
|
||||||
@@ -255,6 +255,14 @@
|
|||||||
"credentials": "dns_gcore_apitoken = 0123456789abcdef0123456789abcdef01234567",
|
"credentials": "dns_gcore_apitoken = 0123456789abcdef0123456789abcdef01234567",
|
||||||
"full_plugin_name": "dns-gcore"
|
"full_plugin_name": "dns-gcore"
|
||||||
},
|
},
|
||||||
|
"glesys": {
|
||||||
|
"name": "Glesys",
|
||||||
|
"package_name": "certbot-dns-glesys",
|
||||||
|
"version": "~=2.1.0",
|
||||||
|
"dependencies": "",
|
||||||
|
"credentials": "dns_glesys_user = CL00000\ndns_glesys_password = apikeyvalue",
|
||||||
|
"full_plugin_name": "dns-glesys"
|
||||||
|
},
|
||||||
"godaddy": {
|
"godaddy": {
|
||||||
"name": "GoDaddy",
|
"name": "GoDaddy",
|
||||||
"package_name": "certbot-dns-godaddy",
|
"package_name": "certbot-dns-godaddy",
|
||||||
@@ -287,6 +295,14 @@
|
|||||||
"credentials": "dns_he_user = Me\ndns_he_pass = my HE password",
|
"credentials": "dns_he_user = Me\ndns_he_pass = my HE password",
|
||||||
"full_plugin_name": "dns-he"
|
"full_plugin_name": "dns-he"
|
||||||
},
|
},
|
||||||
|
"he-ddns": {
|
||||||
|
"name": "Hurricane Electric - DDNS",
|
||||||
|
"package_name": "certbot-dns-he-ddns",
|
||||||
|
"version": "~=0.1.0",
|
||||||
|
"dependencies": "",
|
||||||
|
"credentials": "dns_he_ddns_password = verysecurepassword",
|
||||||
|
"full_plugin_name": "dns-he-ddns"
|
||||||
|
},
|
||||||
"hetzner": {
|
"hetzner": {
|
||||||
"name": "Hetzner",
|
"name": "Hetzner",
|
||||||
"package_name": "certbot-dns-hetzner",
|
"package_name": "certbot-dns-hetzner",
|
||||||
@@ -367,6 +383,14 @@
|
|||||||
"credentials": "dns_joker_username = <Dynamic DNS Authentication Username>\ndns_joker_password = <Dynamic DNS Authentication Password>\ndns_joker_domain = <Dynamic DNS Domain>",
|
"credentials": "dns_joker_username = <Dynamic DNS Authentication Username>\ndns_joker_password = <Dynamic DNS Authentication Password>\ndns_joker_domain = <Dynamic DNS Domain>",
|
||||||
"full_plugin_name": "dns-joker"
|
"full_plugin_name": "dns-joker"
|
||||||
},
|
},
|
||||||
|
"kas": {
|
||||||
|
"name": "All-Inkl",
|
||||||
|
"package_name": "certbot-dns-kas",
|
||||||
|
"version": "~=0.1.1",
|
||||||
|
"dependencies": "kasserver",
|
||||||
|
"credentials": "dns_kas_user = your_kas_user\ndns_kas_password = your_kas_password",
|
||||||
|
"full_plugin_name": "dns-kas"
|
||||||
|
},
|
||||||
"leaseweb": {
|
"leaseweb": {
|
||||||
"name": "LeaseWeb",
|
"name": "LeaseWeb",
|
||||||
"package_name": "certbot-dns-leaseweb",
|
"package_name": "certbot-dns-leaseweb",
|
||||||
@@ -527,6 +551,14 @@
|
|||||||
"credentials": "[default]\naws_access_key_id=AKIAIOSFODNN7EXAMPLE\naws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
"credentials": "[default]\naws_access_key_id=AKIAIOSFODNN7EXAMPLE\naws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
||||||
"full_plugin_name": "dns-route53"
|
"full_plugin_name": "dns-route53"
|
||||||
},
|
},
|
||||||
|
"simply": {
|
||||||
|
"name": "Simply",
|
||||||
|
"package_name": "certbot-dns-simply",
|
||||||
|
"version": "~=0.1.2",
|
||||||
|
"dependencies": "",
|
||||||
|
"credentials": "dns_simply_account_name = UExxxxxx\ndns_simply_api_key = DsHJdsjh2812872sahj",
|
||||||
|
"full_plugin_name": "dns-simply"
|
||||||
|
},
|
||||||
"spaceship": {
|
"spaceship": {
|
||||||
"name": "Spaceship",
|
"name": "Spaceship",
|
||||||
"package_name": "certbot-dns-spaceship",
|
"package_name": "certbot-dns-spaceship",
|
||||||
|
|||||||
288
backend/internal/2fa.js
Normal file
288
backend/internal/2fa.js
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
import crypto from "node:crypto";
|
||||||
|
import bcrypt from "bcrypt";
|
||||||
|
import { authenticator } from "otplib";
|
||||||
|
import errs from "../lib/error.js";
|
||||||
|
import authModel from "../models/auth.js";
|
||||||
|
import internalUser from "./user.js";
|
||||||
|
|
||||||
|
const APP_NAME = "Nginx Proxy Manager";
|
||||||
|
const BACKUP_CODE_COUNT = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate backup codes
|
||||||
|
* @returns {Promise<{plain: string[], hashed: string[]}>}
|
||||||
|
*/
|
||||||
|
const generateBackupCodes = async () => {
|
||||||
|
const plain = [];
|
||||||
|
const hashed = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < BACKUP_CODE_COUNT; i++) {
|
||||||
|
const code = crypto.randomBytes(4).toString("hex").toUpperCase();
|
||||||
|
plain.push(code);
|
||||||
|
const hash = await bcrypt.hash(code, 10);
|
||||||
|
hashed.push(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { plain, hashed };
|
||||||
|
};
|
||||||
|
|
||||||
|
const internal2fa = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user has 2FA enabled
|
||||||
|
* @param {number} userId
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
isEnabled: async (userId) => {
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
return auth?.meta?.totp_enabled === true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get 2FA status for user
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {number} userId
|
||||||
|
* @returns {Promise<{enabled: boolean, backup_codes_remaining: number}>}
|
||||||
|
*/
|
||||||
|
getStatus: async (access, userId) => {
|
||||||
|
await access.can("users:password", userId);
|
||||||
|
await internalUser.get(access, { id: userId });
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
const enabled = auth?.meta?.totp_enabled === true;
|
||||||
|
let backup_codes_remaining = 0;
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
const backupCodes = auth.meta.backup_codes || [];
|
||||||
|
backup_codes_remaining = backupCodes.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
enabled,
|
||||||
|
backup_codes_remaining,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start 2FA setup - store pending secret
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {number} userId
|
||||||
|
* @returns {Promise<{secret: string, otpauth_url: string}>}
|
||||||
|
*/
|
||||||
|
startSetup: async (access, userId) => {
|
||||||
|
await access.can("users:password", userId);
|
||||||
|
const user = await internalUser.get(access, { id: userId });
|
||||||
|
const secret = authenticator.generateSecret();
|
||||||
|
const otpauth_url = authenticator.keyuri(user.email, APP_NAME, secret);
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
|
||||||
|
// ensure user isn't already setup for 2fa
|
||||||
|
const enabled = auth?.meta?.totp_enabled === true;
|
||||||
|
if (enabled) {
|
||||||
|
throw new errs.ValidationError("2FA is already enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = auth.meta || {};
|
||||||
|
meta.totp_pending_secret = secret;
|
||||||
|
|
||||||
|
await authModel.query()
|
||||||
|
.where("id", auth.id)
|
||||||
|
.andWhere("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.patch({ meta });
|
||||||
|
|
||||||
|
return { secret, otpauth_url };
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable 2FA after verifying code
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {number} userId
|
||||||
|
* @param {string} code
|
||||||
|
* @returns {Promise<{backup_codes: string[]}>}
|
||||||
|
*/
|
||||||
|
enable: async (access, userId, code) => {
|
||||||
|
await access.can("users:password", userId);
|
||||||
|
await internalUser.get(access, { id: userId });
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
const secret = auth?.meta?.totp_pending_secret || false;
|
||||||
|
|
||||||
|
if (!secret) {
|
||||||
|
throw new errs.ValidationError("No pending 2FA setup found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const valid = authenticator.verify({ token: code, secret });
|
||||||
|
if (!valid) {
|
||||||
|
throw new errs.ValidationError("Invalid verification code");
|
||||||
|
}
|
||||||
|
|
||||||
|
const { plain, hashed } = await generateBackupCodes();
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
...auth.meta,
|
||||||
|
totp_secret: secret,
|
||||||
|
totp_enabled: true,
|
||||||
|
totp_enabled_at: new Date().toISOString(),
|
||||||
|
backup_codes: hashed,
|
||||||
|
};
|
||||||
|
delete meta.totp_pending_secret;
|
||||||
|
|
||||||
|
await authModel
|
||||||
|
.query()
|
||||||
|
.where("id", auth.id)
|
||||||
|
.andWhere("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.patch({ meta });
|
||||||
|
|
||||||
|
return { backup_codes: plain };
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable 2FA
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {number} userId
|
||||||
|
* @param {string} code
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
disable: async (access, userId, code) => {
|
||||||
|
await access.can("users:password", userId);
|
||||||
|
await internalUser.get(access, { id: userId });
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
|
||||||
|
const enabled = auth?.meta?.totp_enabled === true;
|
||||||
|
if (!enabled) {
|
||||||
|
throw new errs.ValidationError("2FA is not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
const valid = authenticator.verify({
|
||||||
|
token: code,
|
||||||
|
secret: auth.meta.totp_secret,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!valid) {
|
||||||
|
throw new errs.AuthError("Invalid verification code");
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = { ...auth.meta };
|
||||||
|
delete meta.totp_secret;
|
||||||
|
delete meta.totp_enabled;
|
||||||
|
delete meta.totp_enabled_at;
|
||||||
|
delete meta.backup_codes;
|
||||||
|
|
||||||
|
await authModel
|
||||||
|
.query()
|
||||||
|
.where("id", auth.id)
|
||||||
|
.andWhere("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.patch({ meta });
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify 2FA code for login
|
||||||
|
*
|
||||||
|
* @param {number} userId
|
||||||
|
* @param {string} token
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
verifyForLogin: async (userId, token) => {
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
const secret = auth?.meta?.totp_secret || false;
|
||||||
|
|
||||||
|
if (!secret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try TOTP code first
|
||||||
|
const valid = authenticator.verify({
|
||||||
|
token,
|
||||||
|
secret,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (valid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try backup codes
|
||||||
|
const backupCodes = auth?.meta?.backup_codes || [];
|
||||||
|
for (let i = 0; i < backupCodes.length; i++) {
|
||||||
|
const match = await bcrypt.compare(code.toUpperCase(), backupCodes[i]);
|
||||||
|
if (match) {
|
||||||
|
// Remove used backup code
|
||||||
|
const updatedCodes = [...backupCodes];
|
||||||
|
updatedCodes.splice(i, 1);
|
||||||
|
const meta = { ...auth.meta, backup_codes: updatedCodes };
|
||||||
|
await authModel
|
||||||
|
.query()
|
||||||
|
.where("id", auth.id)
|
||||||
|
.andWhere("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.patch({ meta });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerate backup codes
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {number} userId
|
||||||
|
* @param {string} token
|
||||||
|
* @returns {Promise<{backup_codes: string[]}>}
|
||||||
|
*/
|
||||||
|
regenerateBackupCodes: async (access, userId, token) => {
|
||||||
|
await access.can("users:password", userId);
|
||||||
|
await internalUser.get(access, { id: userId });
|
||||||
|
const auth = await internal2fa.getUserPasswordAuth(userId);
|
||||||
|
const enabled = auth?.meta?.totp_enabled === true;
|
||||||
|
const secret = auth?.meta?.totp_secret || false;
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
throw new errs.ValidationError("2FA is not enabled");
|
||||||
|
}
|
||||||
|
if (!secret) {
|
||||||
|
throw new errs.ValidationError("No 2FA secret found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const valid = authenticator.verify({
|
||||||
|
token,
|
||||||
|
secret,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!valid) {
|
||||||
|
throw new errs.ValidationError("Invalid verification code");
|
||||||
|
}
|
||||||
|
|
||||||
|
const { plain, hashed } = await generateBackupCodes();
|
||||||
|
|
||||||
|
const meta = { ...auth.meta, backup_codes: hashed };
|
||||||
|
await authModel
|
||||||
|
.query()
|
||||||
|
.where("id", auth.id)
|
||||||
|
.andWhere("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.patch({ meta });
|
||||||
|
|
||||||
|
return { backup_codes: plain };
|
||||||
|
},
|
||||||
|
|
||||||
|
getUserPasswordAuth: async (userId) => {
|
||||||
|
const auth = await authModel
|
||||||
|
.query()
|
||||||
|
.where("user_id", userId)
|
||||||
|
.andWhere("type", "password")
|
||||||
|
.first();
|
||||||
|
|
||||||
|
if (!auth) {
|
||||||
|
throw new errs.ItemNotFoundError("Auth not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return auth;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default internal2fa;
|
||||||
@@ -798,6 +798,11 @@ const internalCertificate = {
|
|||||||
certificate.domain_names.join(","),
|
certificate.domain_names.join(","),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Add key-type parameter if specified
|
||||||
|
if (certificate.meta?.key_type) {
|
||||||
|
args.push("--key-type", certificate.meta.key_type);
|
||||||
|
}
|
||||||
|
|
||||||
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id);
|
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id);
|
||||||
args.push(...adds.args);
|
args.push(...adds.args);
|
||||||
|
|
||||||
@@ -858,6 +863,11 @@ const internalCertificate = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add key-type parameter if specified
|
||||||
|
if (certificate.meta?.key_type) {
|
||||||
|
args.push("--key-type", certificate.meta.key_type);
|
||||||
|
}
|
||||||
|
|
||||||
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
||||||
args.push(...adds.args);
|
args.push(...adds.args);
|
||||||
|
|
||||||
@@ -938,6 +948,11 @@ const internalCertificate = {
|
|||||||
"--disable-hook-validation",
|
"--disable-hook-validation",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Add key-type parameter if specified
|
||||||
|
if (certificate.meta?.key_type) {
|
||||||
|
args.push("--key-type", certificate.meta.key_type);
|
||||||
|
}
|
||||||
|
|
||||||
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
||||||
args.push(...adds.args);
|
args.push(...adds.args);
|
||||||
|
|
||||||
@@ -979,6 +994,11 @@ const internalCertificate = {
|
|||||||
"--no-random-sleep-on-renew",
|
"--no-random-sleep-on-renew",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Add key-type parameter if specified
|
||||||
|
if (certificate.meta?.key_type) {
|
||||||
|
args.push("--key-type", certificate.meta.key_type);
|
||||||
|
}
|
||||||
|
|
||||||
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id, certificate.meta.dns_provider);
|
||||||
args.push(...adds.args);
|
args.push(...adds.args);
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ const internalReport = {
|
|||||||
const userId = access.token.getUserId(1);
|
const userId = access.token.getUserId(1);
|
||||||
|
|
||||||
const promises = [
|
const promises = [
|
||||||
internalProxyHost.getCount(userId, access_data.visibility),
|
internalProxyHost.getCount(userId, access_data.permission_visibility),
|
||||||
internalRedirectionHost.getCount(userId, access_data.visibility),
|
internalRedirectionHost.getCount(userId, access_data.permission_visibility),
|
||||||
internalStream.getCount(userId, access_data.visibility),
|
internalStream.getCount(userId, access_data.permission_visibility),
|
||||||
internalDeadHost.getCount(userId, access_data.visibility),
|
internalDeadHost.getCount(userId, access_data.permission_visibility),
|
||||||
];
|
];
|
||||||
|
|
||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import { parseDatePeriod } from "../lib/helpers.js";
|
|||||||
import authModel from "../models/auth.js";
|
import authModel from "../models/auth.js";
|
||||||
import TokenModel from "../models/token.js";
|
import TokenModel from "../models/token.js";
|
||||||
import userModel from "../models/user.js";
|
import userModel from "../models/user.js";
|
||||||
|
import twoFactor from "./2fa.js";
|
||||||
|
|
||||||
const ERROR_MESSAGE_INVALID_AUTH = "Invalid email or password";
|
const ERROR_MESSAGE_INVALID_AUTH = "Invalid email or password";
|
||||||
const ERROR_MESSAGE_INVALID_AUTH_I18N = "error.invalid-auth";
|
const ERROR_MESSAGE_INVALID_AUTH_I18N = "error.invalid-auth";
|
||||||
|
const ERROR_MESSAGE_INVALID_2FA = "Invalid verification code";
|
||||||
|
const ERROR_MESSAGE_INVALID_2FA_I18N = "error.invalid-2fa";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +62,25 @@ export default {
|
|||||||
throw new errs.AuthError(`Invalid scope: ${data.scope}`);
|
throw new errs.AuthError(`Invalid scope: ${data.scope}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if 2FA is enabled
|
||||||
|
const has2FA = await twoFactor.isEnabled(user.id);
|
||||||
|
if (has2FA) {
|
||||||
|
// Return challenge token instead of full token
|
||||||
|
const challengeToken = await Token.create({
|
||||||
|
iss: issuer || "api",
|
||||||
|
attrs: {
|
||||||
|
id: user.id,
|
||||||
|
},
|
||||||
|
scope: ["2fa-challenge"],
|
||||||
|
expiresIn: "5m",
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
requires_2fa: true,
|
||||||
|
challenge_token: challengeToken.token,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Create a moment of the expiry expression
|
// Create a moment of the expiry expression
|
||||||
const expiry = parseDatePeriod(data.expiry);
|
const expiry = parseDatePeriod(data.expiry);
|
||||||
if (expiry === null) {
|
if (expiry === null) {
|
||||||
@@ -129,6 +151,65 @@ export default {
|
|||||||
throw new error.AssertionFailedError("Existing token contained invalid user data");
|
throw new error.AssertionFailedError("Existing token contained invalid user data");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify 2FA code and return full token
|
||||||
|
* @param {string} challengeToken
|
||||||
|
* @param {string} code
|
||||||
|
* @param {string} [expiry]
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
verify2FA: async (challengeToken, code, expiry) => {
|
||||||
|
const Token = TokenModel();
|
||||||
|
const tokenExpiry = expiry || "1d";
|
||||||
|
|
||||||
|
// Verify challenge token
|
||||||
|
let tokenData;
|
||||||
|
try {
|
||||||
|
tokenData = await Token.load(challengeToken);
|
||||||
|
} catch {
|
||||||
|
throw new errs.AuthError("Invalid or expired challenge token");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check scope
|
||||||
|
if (!tokenData.scope || tokenData.scope[0] !== "2fa-challenge") {
|
||||||
|
throw new errs.AuthError("Invalid challenge token");
|
||||||
|
}
|
||||||
|
|
||||||
|
const userId = tokenData.attrs?.id;
|
||||||
|
if (!userId) {
|
||||||
|
throw new errs.AuthError("Invalid challenge token");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify 2FA code
|
||||||
|
const valid = await twoFactor.verifyForLogin(userId, code);
|
||||||
|
if (!valid) {
|
||||||
|
throw new errs.AuthError(
|
||||||
|
ERROR_MESSAGE_INVALID_2FA,
|
||||||
|
ERROR_MESSAGE_INVALID_2FA_I18N,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create full token
|
||||||
|
const expiryDate = parseDatePeriod(tokenExpiry);
|
||||||
|
if (expiryDate === null) {
|
||||||
|
throw new errs.AuthError(`Invalid expiry time: ${tokenExpiry}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const signed = await Token.create({
|
||||||
|
iss: "api",
|
||||||
|
attrs: {
|
||||||
|
id: userId,
|
||||||
|
},
|
||||||
|
scope: ["user"],
|
||||||
|
expiresIn: tokenExpiry,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
token: signed.token,
|
||||||
|
expires: expiryDate.toISOString(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} user
|
* @param {Object} user
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
|
|||||||
@@ -14,34 +14,35 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
||||||
"ajv": "^8.17.1",
|
"ajv": "^8.17.1",
|
||||||
"archiver": "^5.3.0",
|
"archiver": "^7.0.1",
|
||||||
"batchflow": "^0.4.0",
|
"batchflow": "^0.4.0",
|
||||||
"bcrypt": "^5.0.0",
|
"bcrypt": "^6.0.0",
|
||||||
"body-parser": "^1.20.3",
|
"body-parser": "^2.2.2",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"express": "^4.20.0",
|
"express": "^5.2.1",
|
||||||
"express-fileupload": "^1.5.2",
|
"express-fileupload": "^1.5.2",
|
||||||
"gravatar": "^1.8.2",
|
"gravatar": "^1.8.2",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.3",
|
||||||
"knex": "2.4.2",
|
"knex": "3.1.0",
|
||||||
"liquidjs": "10.6.1",
|
"liquidjs": "10.24.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.23",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"mysql2": "^3.15.3",
|
"mysql2": "^3.16.2",
|
||||||
"node-rsa": "^1.1.1",
|
"node-rsa": "^1.1.1",
|
||||||
"objection": "3.0.1",
|
"objection": "3.1.5",
|
||||||
|
"otplib": "^12.0.1",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.17.2",
|
||||||
"proxy-agent": "^6.5.0",
|
"proxy-agent": "^6.5.0",
|
||||||
"signale": "1.4.0",
|
"signale": "1.4.0",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"temp-write": "^4.0.0"
|
"temp-write": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@apidevtools/swagger-parser": "^10.1.0",
|
"@apidevtools/swagger-parser": "^12.1.0",
|
||||||
"@biomejs/biome": "^2.3.2",
|
"@biomejs/biome": "^2.3.12",
|
||||||
"chalk": "4.1.2",
|
"chalk": "5.6.2",
|
||||||
"nodemon": "^2.0.2"
|
"nodemon": "^3.1.11"
|
||||||
},
|
},
|
||||||
"signale": {
|
"signale": {
|
||||||
"displayDate": true,
|
"displayDate": true,
|
||||||
|
|||||||
@@ -53,4 +53,26 @@ router
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router
|
||||||
|
.route("/2fa")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /tokens/2fa
|
||||||
|
*
|
||||||
|
* Verify 2FA code and get full token
|
||||||
|
*/
|
||||||
|
.post(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const { challenge_token, code } = await apiValidator(getValidationSchema("/tokens/2fa", "post"), req.body);
|
||||||
|
const result = await internalToken.verify2FA(challenge_token, code);
|
||||||
|
res.status(200).send(result);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
|
import internal2FA from "../internal/2fa.js";
|
||||||
import internalUser from "../internal/user.js";
|
import internalUser from "../internal/user.js";
|
||||||
import Access from "../lib/access.js";
|
import Access from "../lib/access.js";
|
||||||
import { isCI } from "../lib/config.js";
|
import { isCI } from "../lib/config.js";
|
||||||
@@ -325,4 +326,130 @@ router
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User 2FA status
|
||||||
|
*
|
||||||
|
* /api/users/123/2fa
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/:user_id/2fa")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
.all(userIdFromMe)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/users/123/2fa
|
||||||
|
*
|
||||||
|
* Start 2FA setup, returns QR code URL
|
||||||
|
*/
|
||||||
|
.post(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const result = await internal2FA.startSetup(res.locals.access, req.params.user_id);
|
||||||
|
res.status(200).send(result);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/users/123/2fa
|
||||||
|
*
|
||||||
|
* Get 2FA status for a user
|
||||||
|
*/
|
||||||
|
.get(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const status = await internal2FA.getStatus(res.locals.access, req.params.user_id);
|
||||||
|
res.status(200).send(status);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE /api/users/123/2fa?code=XXXXXX
|
||||||
|
*
|
||||||
|
* Disable 2FA for a user
|
||||||
|
*/
|
||||||
|
.delete(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const code = typeof req.query.code === "string" ? req.query.code : null;
|
||||||
|
if (!code) {
|
||||||
|
throw new errs.ValidationError("Missing required parameter: code");
|
||||||
|
}
|
||||||
|
await internal2FA.disable(res.locals.access, req.params.user_id, code);
|
||||||
|
res.status(200).send(true);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User 2FA enable
|
||||||
|
*
|
||||||
|
* /api/users/123/2fa/enable
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/:user_id/2fa/enable")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
.all(userIdFromMe)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/users/123/2fa/enable
|
||||||
|
*
|
||||||
|
* Verify code and enable 2FA
|
||||||
|
*/
|
||||||
|
.post(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const { code } = await apiValidator(
|
||||||
|
getValidationSchema("/users/{userID}/2fa/enable", "post"),
|
||||||
|
req.body,
|
||||||
|
);
|
||||||
|
const result = await internal2FA.enable(res.locals.access, req.params.user_id, code);
|
||||||
|
res.status(200).send(result);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User 2FA backup codes
|
||||||
|
*
|
||||||
|
* /api/users/123/2fa/backup-codes
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/:user_id/2fa/backup-codes")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
.all(userIdFromMe)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/users/123/2fa/backup-codes
|
||||||
|
*
|
||||||
|
* Regenerate backup codes
|
||||||
|
*/
|
||||||
|
.post(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const { code } = await apiValidator(
|
||||||
|
getValidationSchema("/users/{userID}/2fa/backup-codes", "post"),
|
||||||
|
req.body,
|
||||||
|
);
|
||||||
|
const result = await internal2FA.regenerateBackupCodes(res.locals.access, req.params.user_id, code);
|
||||||
|
res.status(200).send(result);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -71,6 +71,11 @@
|
|||||||
"propagation_seconds": {
|
"propagation_seconds": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"key_type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["rsa", "ecdsa"],
|
||||||
|
"default": "rsa"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example": {
|
"example": {
|
||||||
|
|||||||
18
backend/schema/components/token-challenge.json
Normal file
18
backend/schema/components/token-challenge.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"description": "Token object",
|
||||||
|
"required": ["requires_2fa", "challenge_token"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"requires_2fa": {
|
||||||
|
"description": "Whether this token request requires two-factor authentication",
|
||||||
|
"example": true,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"challenge_token": {
|
||||||
|
"description": "Challenge Token used in subsequent 2FA verification",
|
||||||
|
"example": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
backend/schema/paths/tokens/2fa/post.json
Normal file
55
backend/schema/paths/tokens/2fa/post.json
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"operationId": "loginWith2FA",
|
||||||
|
"summary": "Verify 2FA code and get full token",
|
||||||
|
"tags": ["tokens"],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "2fa Challenge Payload",
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"challenge_token": {
|
||||||
|
"minLength": 1,
|
||||||
|
"type": "string",
|
||||||
|
"example": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4"
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
"minLength": 6,
|
||||||
|
"maxLength": 6,
|
||||||
|
"type": "string",
|
||||||
|
"example": "012345"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["challenge_token", "code"],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"challenge_token": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4",
|
||||||
|
"code": "012345"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"expires": "2025-02-04T20:40:46.340Z",
|
||||||
|
"token": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../../../components/token-object.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "200 response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,7 +50,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "../../components/token-object.json"
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"$ref": "../../components/token-object.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "../../components/token-challenge.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
92
backend/schema/paths/users/userID/2fa/backup-codes/post.json
Normal file
92
backend/schema/paths/users/userID/2fa/backup-codes/post.json
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"operationId": "regenUser2faCodes",
|
||||||
|
"summary": "Regenerate 2FA backup codes",
|
||||||
|
"tags": ["users"],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "userID",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "User ID",
|
||||||
|
"example": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Verififcation Payload",
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"minLength": 6,
|
||||||
|
"maxLength": 6,
|
||||||
|
"type": "string",
|
||||||
|
"example": "123456"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["code"],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"code": "123456"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"backup_codes": [
|
||||||
|
"6CD7CB06",
|
||||||
|
"495302F3",
|
||||||
|
"D8037852",
|
||||||
|
"A6FFC956",
|
||||||
|
"BC1A1851",
|
||||||
|
"A05E644F",
|
||||||
|
"A406D2E8",
|
||||||
|
"0AE3C522"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["backup_codes"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"backup_codes": {
|
||||||
|
"description": "Backup codes",
|
||||||
|
"example": [
|
||||||
|
"6CD7CB06",
|
||||||
|
"495302F3",
|
||||||
|
"D8037852",
|
||||||
|
"A6FFC956",
|
||||||
|
"BC1A1851",
|
||||||
|
"A05E644F",
|
||||||
|
"A406D2E8",
|
||||||
|
"0AE3C522"
|
||||||
|
],
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "6CD7CB06"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "200 response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
backend/schema/paths/users/userID/2fa/delete.json
Normal file
48
backend/schema/paths/users/userID/2fa/delete.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"operationId": "disableUser2fa",
|
||||||
|
"summary": "Disable 2fa for user",
|
||||||
|
"tags": ["users"],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "userID",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "User ID",
|
||||||
|
"example": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "code",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 6,
|
||||||
|
"maxLength": 6,
|
||||||
|
"example": "012345"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "2fa Code",
|
||||||
|
"example": "012345"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "200 response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
92
backend/schema/paths/users/userID/2fa/enable/post.json
Normal file
92
backend/schema/paths/users/userID/2fa/enable/post.json
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"operationId": "enableUser2fa",
|
||||||
|
"summary": "Verify code and enable 2FA",
|
||||||
|
"tags": ["users"],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "userID",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "User ID",
|
||||||
|
"example": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Verififcation Payload",
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"minLength": 6,
|
||||||
|
"maxLength": 6,
|
||||||
|
"type": "string",
|
||||||
|
"example": "123456"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["code"],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"code": "123456"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"backup_codes": [
|
||||||
|
"6CD7CB06",
|
||||||
|
"495302F3",
|
||||||
|
"D8037852",
|
||||||
|
"A6FFC956",
|
||||||
|
"BC1A1851",
|
||||||
|
"A05E644F",
|
||||||
|
"A406D2E8",
|
||||||
|
"0AE3C522"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["backup_codes"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"backup_codes": {
|
||||||
|
"description": "Backup codes",
|
||||||
|
"example": [
|
||||||
|
"6CD7CB06",
|
||||||
|
"495302F3",
|
||||||
|
"D8037852",
|
||||||
|
"A6FFC956",
|
||||||
|
"BC1A1851",
|
||||||
|
"A05E644F",
|
||||||
|
"A406D2E8",
|
||||||
|
"0AE3C522"
|
||||||
|
],
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "6CD7CB06"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "200 response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
backend/schema/paths/users/userID/2fa/get.json
Normal file
57
backend/schema/paths/users/userID/2fa/get.json
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"operationId": "getUser2faStatus",
|
||||||
|
"summary": "Get user 2fa Status",
|
||||||
|
"tags": ["users"],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"bearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "userID",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "User ID",
|
||||||
|
"example": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "200 response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"enabled": false,
|
||||||
|
"backup_codes_remaining": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["enabled", "backup_codes_remaining"],
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Is 2FA enabled for this user",
|
||||||
|
"example": true
|
||||||
|
},
|
||||||
|
"backup_codes_remaining": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Number of remaining backup codes for this user",
|
||||||
|
"example": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
backend/schema/paths/users/userID/2fa/post.json
Normal file
52
backend/schema/paths/users/userID/2fa/post.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"operationId": "setupUser2fa",
|
||||||
|
"summary": "Start 2FA setup, returns QR code URL",
|
||||||
|
"tags": ["users"],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "path",
|
||||||
|
"name": "userID",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"description": "User ID",
|
||||||
|
"example": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"secret": "JZYCEBIEEJYUGPQM",
|
||||||
|
"otpauth_url": "otpauth://totp/Nginx%20Proxy%20Manager:jc%40jc21.com?secret=JZYCEBIEEJYUGPQM&period=30&digits=6&algorithm=SHA1&issuer=Nginx%20Proxy%20Manager"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["secret", "otpauth_url"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"secret": {
|
||||||
|
"description": "TOTP Secret",
|
||||||
|
"example": "JZYCEBIEEJYUGPQM",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"otpauth_url": {
|
||||||
|
"description": "OTP Auth URL for QR Code generation",
|
||||||
|
"example": "otpauth://totp/Nginx%20Proxy%20Manager:jc%40jc21.com?secret=JZYCEBIEEJYUGPQM&period=30&digits=6&algorithm=SHA1&issuer=Nginx%20Proxy%20Manager",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "200 response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -293,6 +293,11 @@
|
|||||||
"$ref": "./paths/tokens/post.json"
|
"$ref": "./paths/tokens/post.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/tokens/2fa": {
|
||||||
|
"post": {
|
||||||
|
"$ref": "./paths/tokens/2fa/post.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
"/version/check": {
|
"/version/check": {
|
||||||
"get": {
|
"get": {
|
||||||
"$ref": "./paths/version/check/get.json"
|
"$ref": "./paths/version/check/get.json"
|
||||||
@@ -317,6 +322,27 @@
|
|||||||
"$ref": "./paths/users/userID/delete.json"
|
"$ref": "./paths/users/userID/delete.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/users/{userID}/2fa": {
|
||||||
|
"post": {
|
||||||
|
"$ref": "./paths/users/userID/2fa/post.json"
|
||||||
|
},
|
||||||
|
"get": {
|
||||||
|
"$ref": "./paths/users/userID/2fa/get.json"
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"$ref": "./paths/users/userID/2fa/delete.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{userID}/2fa/enable": {
|
||||||
|
"post": {
|
||||||
|
"$ref": "./paths/users/userID/2fa/enable/post.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{userID}/2fa/backup-codes": {
|
||||||
|
"post": {
|
||||||
|
"$ref": "./paths/users/userID/2fa/backup-codes/post.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
"/users/{userID}/auth": {
|
"/users/{userID}/auth": {
|
||||||
"put": {
|
"put": {
|
||||||
"$ref": "./paths/users/userID/auth/put.json"
|
"$ref": "./paths/users/userID/auth/put.json"
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ server {
|
|||||||
|
|
||||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||||
|
|
||||||
|
access_log /data/logs/stream-{{ id }}_access.log stream;
|
||||||
|
error_log /data/logs/stream-{{ id }}_error.log warn;
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
include /data/nginx/custom/server_stream[.]conf;
|
include /data/nginx/custom/server_stream[.]conf;
|
||||||
include /data/nginx/custom/server_stream_tcp[.]conf;
|
include /data/nginx/custom/server_stream_tcp[.]conf;
|
||||||
@@ -25,9 +28,12 @@ server {
|
|||||||
|
|
||||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||||
|
|
||||||
|
access_log /data/logs/stream-{{ id }}_access.log stream;
|
||||||
|
error_log /data/logs/stream-{{ id }}_error.log warn;
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
include /data/nginx/custom/server_stream[.]conf;
|
include /data/nginx/custom/server_stream[.]conf;
|
||||||
include /data/nginx/custom/server_stream_udp[.]conf;
|
include /data/nginx/custom/server_stream_udp[.]conf;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
1361
backend/yarn.lock
1361
backend/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -109,7 +109,7 @@ services:
|
|||||||
- "cypress_logs:/test/results"
|
- "cypress_logs:/test/results"
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
command: cypress run --browser chrome --config-file=cypress/config/ci.js
|
command: cypress run --browser chrome --config-file=cypress/config/ci.mjs
|
||||||
networks:
|
networks:
|
||||||
- fulltest
|
- fulltest
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ services:
|
|||||||
- "../test/results:/results"
|
- "../test/results:/results"
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
command: cypress run --browser chrome --config-file=cypress/config/ci.js
|
command: cypress run --browser chrome --config-file=cypress/config/ci.mjs
|
||||||
networks:
|
networks:
|
||||||
- nginx_proxy_manager
|
- nginx_proxy_manager
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ server {
|
|||||||
set $port "80";
|
set $port "80";
|
||||||
|
|
||||||
server_name localhost-nginx-proxy-manager;
|
server_name localhost-nginx-proxy-manager;
|
||||||
access_log /data/logs/fallback_access.log standard;
|
access_log /data/logs/fallback_http_access.log standard;
|
||||||
error_log /data/logs/fallback_error.log warn;
|
error_log /data/logs/fallback_http_error.log warn;
|
||||||
include conf.d/include/assets.conf;
|
include conf.d/include/assets.conf;
|
||||||
include conf.d/include/block-exploits.conf;
|
include conf.d/include/block-exploits.conf;
|
||||||
include conf.d/include/letsencrypt-acme-challenge.conf;
|
include conf.d/include/letsencrypt-acme-challenge.conf;
|
||||||
@@ -30,7 +30,7 @@ server {
|
|||||||
set $port "443";
|
set $port "443";
|
||||||
|
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
access_log /data/logs/fallback_access.log standard;
|
access_log /data/logs/fallback_http_access.log standard;
|
||||||
error_log /dev/null crit;
|
error_log /dev/null crit;
|
||||||
include conf.d/include/ssl-ciphers.conf;
|
include conf.d/include/ssl-ciphers.conf;
|
||||||
ssl_reject_handshake on;
|
ssl_reject_handshake on;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ if ($scheme = "http") {
|
|||||||
if ($request_uri = /.well-known/acme-challenge/test-challenge) {
|
if ($request_uri = /.well-known/acme-challenge/test-challenge) {
|
||||||
set $test "${test}T";
|
set $test "${test}T";
|
||||||
}
|
}
|
||||||
|
if ($http_x_forwarded_proto = "https") {
|
||||||
|
set $test "${test}S";
|
||||||
|
}
|
||||||
if ($test = H) {
|
if ($test = H) {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
|
log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
|
||||||
log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
|
log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
|
||||||
|
|
||||||
access_log /data/logs/fallback_access.log proxy;
|
access_log /data/logs/fallback_http_access.log proxy;
|
||||||
3
docker/rootfs/etc/nginx/conf.d/include/log-stream.conf
Normal file
3
docker/rootfs/etc/nginx/conf.d/include/log-stream.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
log_format stream '[$time_local] [Client $remote_addr:$remote_port] $protocol $status $bytes_sent $bytes_received $session_time [Sent-to $upstream_addr] [Sent $upstream_bytes_sent] [Received $upstream_bytes_received] [Time $upstream_connect_time] $ssl_protocol $ssl_cipher';
|
||||||
|
|
||||||
|
access_log /data/logs/fallback_stream_access.log stream;
|
||||||
@@ -47,7 +47,7 @@ http {
|
|||||||
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
|
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
|
||||||
|
|
||||||
# Log format and fallback log file
|
# Log format and fallback log file
|
||||||
include /etc/nginx/conf.d/include/log.conf;
|
include /etc/nginx/conf.d/include/log-proxy.conf;
|
||||||
|
|
||||||
# Dynamically generated resolvers file
|
# Dynamically generated resolvers file
|
||||||
include /etc/nginx/conf.d/include/resolvers.conf;
|
include /etc/nginx/conf.d/include/resolvers.conf;
|
||||||
@@ -85,6 +85,9 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream {
|
stream {
|
||||||
|
# Log format and fallback log file
|
||||||
|
include /etc/nginx/conf.d/include/log-stream.conf;
|
||||||
|
|
||||||
# Files generated by NPM
|
# Files generated by NPM
|
||||||
include /data/nginx/stream/*.conf;
|
include /data/nginx/stream/*.conf;
|
||||||
|
|
||||||
|
|||||||
946
docs/yarn.lock
946
docs/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.12/schema.json",
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"clientKind": "git",
|
||||||
|
|||||||
@@ -7,22 +7,26 @@
|
|||||||
// - Also checks the error messages returned by the backend
|
// - Also checks the error messages returned by the backend
|
||||||
|
|
||||||
const allLocales = [
|
const allLocales = [
|
||||||
["en", "en-US"],
|
["en", "en-US"],
|
||||||
["de", "de-DE"],
|
["de", "de-DE"],
|
||||||
["es", "es-ES"],
|
["es", "es-ES"],
|
||||||
["it", "it-IT"],
|
["fr", "fr-FR"],
|
||||||
["ja", "ja-JP"],
|
["it", "it-IT"],
|
||||||
["nl", "nl-NL"],
|
["ja", "ja-JP"],
|
||||||
["pl", "pl-PL"],
|
["nl", "nl-NL"],
|
||||||
["ru", "ru-RU"],
|
["pl", "pl-PL"],
|
||||||
["sk", "sk-SK"],
|
["ru", "ru-RU"],
|
||||||
["vi", "vi-VN"],
|
["sk", "sk-SK"],
|
||||||
["zh", "zh-CN"],
|
["vi", "vi-VN"],
|
||||||
|
["zh", "zh-CN"],
|
||||||
|
["ko", "ko-KR"],
|
||||||
|
["bg", "bg-BG"],
|
||||||
|
["id", "id-ID"],
|
||||||
|
["tr", "tr-TR"],
|
||||||
|
["hu", "hu-HU"],
|
||||||
];
|
];
|
||||||
|
|
||||||
const ignoreUnused = [
|
const ignoreUnused = [/^.*$/];
|
||||||
/^.*$/,
|
|
||||||
];
|
|
||||||
|
|
||||||
const { spawnSync } = require("child_process");
|
const { spawnSync } = require("child_process");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
@@ -63,105 +67,95 @@ const allWarnings = [];
|
|||||||
const allKeys = [];
|
const allKeys = [];
|
||||||
|
|
||||||
const checkLangList = (fullCode) => {
|
const checkLangList = (fullCode) => {
|
||||||
const key = "locale-" + fullCode;
|
const key = "locale-" + fullCode;
|
||||||
if (typeof langList[key] === "undefined") {
|
if (typeof langList[key] === "undefined") {
|
||||||
allErrors.push(
|
allErrors.push("ERROR: `" + key + "` language does not exist in lang-list.json");
|
||||||
"ERROR: `" + key + "` language does not exist in lang-list.json",
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const compareLocale = (locale) => {
|
const compareLocale = (locale) => {
|
||||||
const projectLocaleKeys = Object.keys(allLocalesInProject);
|
const projectLocaleKeys = Object.keys(allLocalesInProject);
|
||||||
// Check that locale contains the items used in the codebase
|
// Check that locale contains the items used in the codebase
|
||||||
projectLocaleKeys.map((key) => {
|
projectLocaleKeys.map((key) => {
|
||||||
if (typeof locale.data[key] === "undefined") {
|
if (typeof locale.data[key] === "undefined") {
|
||||||
allErrors.push(
|
allErrors.push("ERROR: `" + locale[0] + "` does not contain item: `" + key + "`");
|
||||||
"ERROR: `" + locale[0] + "` does not contain item: `" + key + "`",
|
}
|
||||||
);
|
return null;
|
||||||
}
|
});
|
||||||
return null;
|
// Check that locale contains all error.* items
|
||||||
});
|
BACKEND_ERRORS.forEach((key) => {
|
||||||
// Check that locale contains all error.* items
|
if (typeof locale.data[key] === "undefined") {
|
||||||
BACKEND_ERRORS.forEach((key) => {
|
allErrors.push("ERROR: `" + locale[0] + "` does not contain item: `" + key + "`");
|
||||||
if (typeof locale.data[key] === "undefined") {
|
}
|
||||||
allErrors.push(
|
return null;
|
||||||
"ERROR: `" + locale[0] + "` does not contain item: `" + key + "`",
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Check that locale does not contain items not used in the codebase
|
// Check that locale does not contain items not used in the codebase
|
||||||
const localeKeys = Object.keys(locale.data);
|
const localeKeys = Object.keys(locale.data);
|
||||||
localeKeys.map((key) => {
|
localeKeys.map((key) => {
|
||||||
let ignored = false;
|
let ignored = false;
|
||||||
ignoreUnused.map((regex) => {
|
ignoreUnused.map((regex) => {
|
||||||
if (key.match(regex)) {
|
if (key.match(regex)) {
|
||||||
ignored = true;
|
ignored = true;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!ignored && typeof allLocalesInProject[key] === "undefined") {
|
if (!ignored && typeof allLocalesInProject[key] === "undefined") {
|
||||||
// ensure this key doesn't exist in the backend errors either
|
// ensure this key doesn't exist in the backend errors either
|
||||||
if (!BACKEND_ERRORS.includes(key)) {
|
if (!BACKEND_ERRORS.includes(key)) {
|
||||||
allErrors.push(
|
allErrors.push("ERROR: `" + locale[0] + "` contains unused item: `" + key + "`");
|
||||||
"ERROR: `" + locale[0] + "` contains unused item: `" + key + "`",
|
}
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add this key to allKeys
|
// Add this key to allKeys
|
||||||
if (allKeys.indexOf(key) === -1) {
|
if (allKeys.indexOf(key) === -1) {
|
||||||
allKeys.push(key);
|
allKeys.push(key);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Checks for any keys missing from this locale, that
|
// Checks for any keys missing from this locale, that
|
||||||
// have been defined in any other locales
|
// have been defined in any other locales
|
||||||
const checkForMissing = (locale) => {
|
const checkForMissing = (locale) => {
|
||||||
allKeys.forEach((key) => {
|
allKeys.forEach((key) => {
|
||||||
if (typeof locale.data[key] === "undefined") {
|
if (typeof locale.data[key] === "undefined") {
|
||||||
allWarnings.push(
|
allWarnings.push("WARN: `" + locale[0] + "` does not contain item: `" + key + "`");
|
||||||
"WARN: `" + locale[0] + "` does not contain item: `" + key + "`",
|
}
|
||||||
);
|
return null;
|
||||||
}
|
});
|
||||||
return null;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Local all locale data
|
// Local all locale data
|
||||||
allLocales.map((locale, idx) => {
|
allLocales.map((locale, idx) => {
|
||||||
checkLangList(locale[1]);
|
checkLangList(locale[1]);
|
||||||
allLocales[idx].data = require("./src/locale/src/" + locale[0] + ".json");
|
allLocales[idx].data = require("./src/locale/src/" + locale[0] + ".json");
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verify all locale data
|
// Verify all locale data
|
||||||
allLocales.map((locale) => {
|
allLocales.map((locale) => {
|
||||||
compareLocale(locale);
|
compareLocale(locale);
|
||||||
checkForMissing(locale);
|
checkForMissing(locale);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (allErrors.length) {
|
if (allErrors.length) {
|
||||||
allErrors.map((err) => {
|
allErrors.map((err) => {
|
||||||
console.log("\x1b[31m%s\x1b[0m", err);
|
console.log("\x1b[31m%s\x1b[0m", err);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (allWarnings.length) {
|
if (allWarnings.length) {
|
||||||
allWarnings.map((err) => {
|
allWarnings.map((err) => {
|
||||||
console.log("\x1b[33m%s\x1b[0m", err);
|
console.log("\x1b[33m%s\x1b[0m", err);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allErrors.length) {
|
if (allErrors.length) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("\x1b[32m%s\x1b[0m", "Locale check passed");
|
console.log("\x1b[32m%s\x1b[0m", "Locale check passed");
|
||||||
|
|||||||
@@ -17,50 +17,50 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tabler/core": "^1.4.0",
|
"@tabler/core": "^1.4.0",
|
||||||
"@tabler/icons-react": "^3.35.0",
|
"@tabler/icons-react": "^3.36.1",
|
||||||
"@tanstack/react-query": "^5.90.6",
|
"@tanstack/react-query": "^5.90.20",
|
||||||
"@tanstack/react-table": "^8.21.3",
|
"@tanstack/react-table": "^8.21.3",
|
||||||
"@uiw/react-textarea-code-editor": "^3.1.1",
|
"@uiw/react-textarea-code-editor": "^3.1.1",
|
||||||
"classnames": "^2.5.1",
|
"classnames": "^2.5.1",
|
||||||
"country-flag-icons": "^1.5.21",
|
"country-flag-icons": "^1.6.12",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"ez-modal-react": "^1.0.5",
|
"ez-modal-react": "^1.0.5",
|
||||||
"formik": "^2.4.6",
|
"formik": "^2.4.9",
|
||||||
"generate-password-browser": "^1.1.0",
|
"generate-password-browser": "^1.1.0",
|
||||||
"humps": "^2.0.1",
|
"humps": "^2.0.1",
|
||||||
"query-string": "^9.3.1",
|
"query-string": "^9.3.1",
|
||||||
"react": "^19.2.0",
|
"react": "^19.2.4",
|
||||||
"react-bootstrap": "^2.10.10",
|
"react-bootstrap": "^2.10.10",
|
||||||
"react-dom": "^19.2.0",
|
"react-dom": "^19.2.4",
|
||||||
"react-intl": "^7.1.14",
|
"react-intl": "^7.1.14",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router-dom": "^7.9.5",
|
"react-router-dom": "^7.13.0",
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"react-toastify": "^11.0.5",
|
"react-toastify": "^11.0.5",
|
||||||
"rooks": "^9.3.0"
|
"rooks": "^9.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.3.2",
|
"@biomejs/biome": "^2.3.13",
|
||||||
"@formatjs/cli": "^6.7.4",
|
"@formatjs/cli": "^6.12.0",
|
||||||
"@tanstack/react-query-devtools": "^5.90.2",
|
"@tanstack/react-query-devtools": "^5.91.2",
|
||||||
"@testing-library/dom": "^10.4.1",
|
"@testing-library/dom": "^10.4.1",
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.2",
|
||||||
"@types/country-flag-icons": "^1.2.2",
|
"@types/country-flag-icons": "^1.2.2",
|
||||||
"@types/humps": "^2.0.6",
|
"@types/humps": "^2.0.6",
|
||||||
"@types/react": "^19.2.2",
|
"@types/react": "^19.2.10",
|
||||||
"@types/react-dom": "^19.2.2",
|
"@types/react-dom": "^19.2.3",
|
||||||
"@types/react-table": "^7.7.20",
|
"@types/react-table": "^7.7.20",
|
||||||
"@vitejs/plugin-react": "^5.1.0",
|
"@vitejs/plugin-react": "^5.1.2",
|
||||||
"happy-dom": "^20.0.10",
|
"happy-dom": "^20.4.0",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"sass": "^1.93.3",
|
"sass": "^1.97.3",
|
||||||
"tmp": "^0.2.5",
|
"tmp": "^0.2.5",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite": "^7.1.12",
|
"vite": "^7.3.1",
|
||||||
"vite-plugin-checker": "^0.11.0",
|
"vite-plugin-checker": "^0.12.0",
|
||||||
"vite-tsconfig-paths": "^5.1.4",
|
"vite-tsconfig-paths": "^6.0.5",
|
||||||
"vitest": "^4.0.6"
|
"vitest": "^4.0.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ export async function del({ url, params }: DeleteArgs, abortController?: AbortCo
|
|||||||
const method = "DELETE";
|
const method = "DELETE";
|
||||||
const headers = {
|
const headers = {
|
||||||
...buildAuthHeader(),
|
...buildAuthHeader(),
|
||||||
[contentTypeHeader]: "application/json",
|
|
||||||
};
|
};
|
||||||
const signal = abortController?.signal;
|
const signal = abortController?.signal;
|
||||||
const response = await fetch(apiUrl, { method, headers, signal });
|
const response = await fetch(apiUrl, { method, headers, signal });
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
import * as api from "./base";
|
import * as api from "./base";
|
||||||
import type { TokenResponse } from "./responseTypes";
|
import type { TokenResponse, TwoFactorChallengeResponse } from "./responseTypes";
|
||||||
|
|
||||||
export async function getToken(identity: string, secret: string): Promise<TokenResponse> {
|
export type LoginResponse = TokenResponse | TwoFactorChallengeResponse;
|
||||||
|
|
||||||
|
export function isTwoFactorChallenge(response: LoginResponse): response is TwoFactorChallengeResponse {
|
||||||
|
return "requires2fa" in response && response.requires2fa === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getToken(identity: string, secret: string): Promise<LoginResponse> {
|
||||||
return await api.post({
|
return await api.post({
|
||||||
url: "/tokens",
|
url: "/tokens",
|
||||||
data: { identity, secret },
|
data: { identity, secret },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function verify2FA(challengeToken: string, code: string): Promise<TokenResponse> {
|
||||||
|
return await api.post({
|
||||||
|
url: "/tokens/2fa",
|
||||||
|
data: { challengeToken, code },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,3 +60,4 @@ export * from "./updateStream";
|
|||||||
export * from "./updateUser";
|
export * from "./updateUser";
|
||||||
export * from "./uploadCertificate";
|
export * from "./uploadCertificate";
|
||||||
export * from "./validateCertificate";
|
export * from "./validateCertificate";
|
||||||
|
export * from "./twoFactor";
|
||||||
|
|||||||
@@ -25,3 +25,22 @@ export interface VersionCheckResponse {
|
|||||||
latest: string | null;
|
latest: string | null;
|
||||||
updateAvailable: boolean;
|
updateAvailable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TwoFactorChallengeResponse {
|
||||||
|
requires2fa: boolean;
|
||||||
|
challengeToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TwoFactorStatusResponse {
|
||||||
|
enabled: boolean;
|
||||||
|
backupCodesRemaining: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TwoFactorSetupResponse {
|
||||||
|
secret: string;
|
||||||
|
otpauthUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TwoFactorEnableResponse {
|
||||||
|
backupCodes: string[];
|
||||||
|
}
|
||||||
|
|||||||
37
frontend/src/api/backend/twoFactor.ts
Normal file
37
frontend/src/api/backend/twoFactor.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import * as api from "./base";
|
||||||
|
import type { TwoFactorEnableResponse, TwoFactorSetupResponse, TwoFactorStatusResponse } from "./responseTypes";
|
||||||
|
|
||||||
|
export async function get2FAStatus(userId: number | "me"): Promise<TwoFactorStatusResponse> {
|
||||||
|
return await api.get({
|
||||||
|
url: `/users/${userId}/2fa`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function start2FASetup(userId: number | "me"): Promise<TwoFactorSetupResponse> {
|
||||||
|
return await api.post({
|
||||||
|
url: `/users/${userId}/2fa`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function enable2FA(userId: number | "me", code: string): Promise<TwoFactorEnableResponse> {
|
||||||
|
return await api.post({
|
||||||
|
url: `/users/${userId}/2fa/enable`,
|
||||||
|
data: { code },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function disable2FA(userId: number | "me", code: string): Promise<boolean> {
|
||||||
|
return await api.del({
|
||||||
|
url: `/users/${userId}/2fa`,
|
||||||
|
params: {
|
||||||
|
code,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function regenerateBackupCodes(userId: number | "me", code: string): Promise<TwoFactorEnableResponse> {
|
||||||
|
return await api.post({
|
||||||
|
url: `/users/${userId}/2fa/backup-codes`,
|
||||||
|
data: { code },
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import { Field, useFormikContext } from "formik";
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
||||||
import type { AccessList } from "src/api/backend";
|
import type { AccessList } from "src/api/backend";
|
||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { useAccessLists } from "src/hooks";
|
import { useAccessLists } from "src/hooks";
|
||||||
import { formatDateTime, intl, T } from "src/locale";
|
import { formatDateTime, intl, T } from "src/locale";
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ interface Props {
|
|||||||
label?: string;
|
label?: string;
|
||||||
}
|
}
|
||||||
export function AccessField({ name = "accessListId", label = "access-list", id = "accessListId" }: Props) {
|
export function AccessField({ name = "accessListId", label = "access-list", id = "accessListId" }: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
const { isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]);
|
const { isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]);
|
||||||
const { setFieldValue } = useFormikContext();
|
const { setFieldValue } = useFormikContext();
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ export function AccessField({ name = "accessListId", label = "access-list", id =
|
|||||||
{
|
{
|
||||||
users: item?.items?.length,
|
users: item?.items?.length,
|
||||||
rules: item?.clients?.length,
|
rules: item?.clients?.length,
|
||||||
date: item?.createdOn ? formatDateTime(item?.createdOn) : "N/A",
|
date: item?.createdOn ? formatDateTime(item?.createdOn, locale) : "N/A",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: <IconLock size={14} className="text-lime" />,
|
icon: <IconLock size={14} className="text-lime" />,
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export function DNSProviderFields({ showBoundaryBox = false }: Props) {
|
|||||||
type="number"
|
type="number"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
min={0}
|
min={0}
|
||||||
max={600}
|
max={7200}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<small className="text-muted">
|
<small className="text-muted">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { IconShield } from "@tabler/icons-react";
|
|||||||
import { Field, useFormikContext } from "formik";
|
import { Field, useFormikContext } from "formik";
|
||||||
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
||||||
import type { Certificate } from "src/api/backend";
|
import type { Certificate } from "src/api/backend";
|
||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { useCertificates } from "src/hooks";
|
import { useCertificates } from "src/hooks";
|
||||||
import { formatDateTime, intl, T } from "src/locale";
|
import { formatDateTime, intl, T } from "src/locale";
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ export function SSLCertificateField({
|
|||||||
allowNew,
|
allowNew,
|
||||||
forHttp = true,
|
forHttp = true,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
const { isLoading, isError, error, data } = useCertificates();
|
const { isLoading, isError, error, data } = useCertificates();
|
||||||
const { values, setFieldValue } = useFormikContext();
|
const { values, setFieldValue } = useFormikContext();
|
||||||
const v: any = values || {};
|
const v: any = values || {};
|
||||||
@@ -75,7 +77,7 @@ export function SSLCertificateField({
|
|||||||
data?.map((cert: Certificate) => ({
|
data?.map((cert: Certificate) => ({
|
||||||
value: cert.id,
|
value: cert.id,
|
||||||
label: cert.niceName,
|
label: cert.niceName,
|
||||||
subLabel: `${cert.provider === "letsencrypt" ? intl.formatMessage({ id: "lets-encrypt" }) : cert.provider} — ${intl.formatMessage({ id: "expires.on" }, { date: cert.expiresOn ? formatDateTime(cert.expiresOn) : "N/A" })}`,
|
subLabel: `${cert.provider === "letsencrypt" ? intl.formatMessage({ id: "lets-encrypt" }) : cert.provider} — ${intl.formatMessage({ id: "expires.on" }, { date: cert.expiresOn ? formatDateTime(cert.expiresOn, locale) : "N/A" })}`,
|
||||||
icon: <IconShield size={14} className="text-pink" />,
|
icon: <IconShield size={14} className="text-pink" />,
|
||||||
})) || [];
|
})) || [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { IconLock, IconLogout, IconUser } from "@tabler/icons-react";
|
import { IconLock, IconLogout, IconShieldLock, IconUser } from "@tabler/icons-react";
|
||||||
import { LocalePicker, NavLink, ThemeSwitcher } from "src/components";
|
import { LocalePicker, NavLink, ThemeSwitcher } from "src/components";
|
||||||
import { useAuthState } from "src/context";
|
import { useAuthState } from "src/context";
|
||||||
import { useUser } from "src/hooks";
|
import { useUser } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { T } from "src/locale";
|
||||||
import { showChangePasswordModal, showUserModal } from "src/modals";
|
import { showChangePasswordModal, showTwoFactorModal, showUserModal } from "src/modals";
|
||||||
import styles from "./SiteHeader.module.css";
|
import styles from "./SiteHeader.module.css";
|
||||||
|
|
||||||
export function SiteHeader() {
|
export function SiteHeader() {
|
||||||
@@ -108,6 +108,17 @@ export function SiteHeader() {
|
|||||||
<IconLock width={18} />
|
<IconLock width={18} />
|
||||||
<T id="user.change-password" />
|
<T id="user.change-password" />
|
||||||
</a>
|
</a>
|
||||||
|
<a
|
||||||
|
href="?"
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
showTwoFactorModal("me");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconShieldLock width={18} />
|
||||||
|
<T id="user.two-factor" />
|
||||||
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
href="?"
|
href="?"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { differenceInDays, isPast } from "date-fns";
|
import { differenceInDays, isPast } from "date-fns";
|
||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { formatDateTime, parseDate } from "src/locale";
|
import { formatDateTime, parseDate } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -8,6 +9,7 @@ interface Props {
|
|||||||
highlistNearlyExpired?: boolean;
|
highlistNearlyExpired?: boolean;
|
||||||
}
|
}
|
||||||
export function DateFormatter({ value, highlightPast, highlistNearlyExpired }: Props) {
|
export function DateFormatter({ value, highlightPast, highlistNearlyExpired }: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
const d = parseDate(value);
|
const d = parseDate(value);
|
||||||
const dateIsPast = d ? isPast(d) : false;
|
const dateIsPast = d ? isPast(d) : false;
|
||||||
const days = d ? differenceInDays(d, new Date()) : 0;
|
const days = d ? differenceInDays(d, new Date()) : 0;
|
||||||
@@ -15,5 +17,5 @@ export function DateFormatter({ value, highlightPast, highlistNearlyExpired }: P
|
|||||||
"text-danger": highlightPast && dateIsPast,
|
"text-danger": highlightPast && dateIsPast,
|
||||||
"text-warning": highlistNearlyExpired && !dateIsPast && days <= 30 && days >= 0,
|
"text-warning": highlistNearlyExpired && !dateIsPast && days <= 30 && days >= 0,
|
||||||
});
|
});
|
||||||
return <span className={cl}>{formatDateTime(value)}</span>;
|
return <span className={cl}>{formatDateTime(value, locale)}</span>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { formatDateTime, T } from "src/locale";
|
import { formatDateTime, T } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -37,7 +38,9 @@ const DomainLink = ({ domain, color }: { domain?: string; color?: string }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function DomainsFormatter({ domains, createdOn, niceName, provider, color }: Props) {
|
export function DomainsFormatter({ domains, createdOn, niceName, provider, color }: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
const elms: ReactNode[] = [];
|
const elms: ReactNode[] = [];
|
||||||
|
|
||||||
if ((!domains || domains.length === 0) && !niceName) {
|
if ((!domains || domains.length === 0) && !niceName) {
|
||||||
elms.push(
|
elms.push(
|
||||||
<span key="nice-name" className="badge bg-danger-lt me-2">
|
<span key="nice-name" className="badge bg-danger-lt me-2">
|
||||||
@@ -62,7 +65,7 @@ export function DomainsFormatter({ domains, createdOn, niceName, provider, color
|
|||||||
<div className="font-weight-medium">{...elms}</div>
|
<div className="font-weight-medium">{...elms}</div>
|
||||||
{createdOn ? (
|
{createdOn ? (
|
||||||
<div className="text-secondary mt-1">
|
<div className="text-secondary mt-1">
|
||||||
<T id="created-on" data={{ date: formatDateTime(createdOn) }} />
|
<T id="created-on" data={{ date: formatDateTime(createdOn, locale) }} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc, IconLock, IconShield, IconUser } from "@tabler/icons-react";
|
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc, IconLock, IconShield, IconUser } from "@tabler/icons-react";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import type { AuditLog } from "src/api/backend";
|
import type { AuditLog } from "src/api/backend";
|
||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { formatDateTime, T } from "src/locale";
|
import { formatDateTime, T } from "src/locale";
|
||||||
|
|
||||||
const getEventValue = (event: AuditLog) => {
|
const getEventValue = (event: AuditLog) => {
|
||||||
@@ -66,6 +67,7 @@ interface Props {
|
|||||||
row: AuditLog;
|
row: AuditLog;
|
||||||
}
|
}
|
||||||
export function EventFormatter({ row }: Props) {
|
export function EventFormatter({ row }: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
return (
|
return (
|
||||||
<div className="flex-fill">
|
<div className="flex-fill">
|
||||||
<div className="font-weight-medium">
|
<div className="font-weight-medium">
|
||||||
@@ -73,7 +75,7 @@ export function EventFormatter({ row }: Props) {
|
|||||||
<T id={`object.event.${row.action}`} tData={{ object: row.objectType }} />
|
<T id={`object.event.${row.action}`} tData={{ object: row.objectType }} />
|
||||||
— <span className="badge">{getEventValue(row)}</span>
|
— <span className="badge">{getEventValue(row)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-secondary mt-1">{formatDateTime(row.createdOn)}</div>
|
<div className="text-secondary mt-1">{formatDateTime(row.createdOn, locale)}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useLocaleState } from "src/context";
|
||||||
import { formatDateTime, T } from "src/locale";
|
import { formatDateTime, T } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -6,6 +7,7 @@ interface Props {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
export function ValueWithDateFormatter({ value, createdOn, disabled }: Props) {
|
export function ValueWithDateFormatter({ value, createdOn, disabled }: Props) {
|
||||||
|
const { locale } = useLocaleState();
|
||||||
return (
|
return (
|
||||||
<div className="flex-fill">
|
<div className="flex-fill">
|
||||||
<div className="font-weight-medium">
|
<div className="font-weight-medium">
|
||||||
@@ -13,7 +15,7 @@ export function ValueWithDateFormatter({ value, createdOn, disabled }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
{createdOn ? (
|
{createdOn ? (
|
||||||
<div className={`text-secondary mt-1 ${disabled ? "text-red" : ""}`}>
|
<div className={`text-secondary mt-1 ${disabled ? "text-red" : ""}`}>
|
||||||
<T id={disabled ? "disabled" : "created-on"} data={{ date: formatDateTime(createdOn) }} />
|
<T id={disabled ? "disabled" : "created-on"} data={{ date: formatDateTime(createdOn, locale) }} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { createContext, type ReactNode, useContext, useState } from "react";
|
import { createContext, type ReactNode, useContext, useState } from "react";
|
||||||
import { useIntervalWhen } from "rooks";
|
import { useIntervalWhen } from "rooks";
|
||||||
import { getToken, loginAsUser, refreshToken, type TokenResponse } from "src/api/backend";
|
import {
|
||||||
|
getToken,
|
||||||
|
isTwoFactorChallenge,
|
||||||
|
loginAsUser,
|
||||||
|
refreshToken,
|
||||||
|
verify2FA,
|
||||||
|
type TokenResponse,
|
||||||
|
} from "src/api/backend";
|
||||||
import AuthStore from "src/modules/AuthStore";
|
import AuthStore from "src/modules/AuthStore";
|
||||||
|
|
||||||
|
// 2FA challenge state
|
||||||
|
export interface TwoFactorChallenge {
|
||||||
|
challengeToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
// Context
|
// Context
|
||||||
export interface AuthContextType {
|
export interface AuthContextType {
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
twoFactorChallenge: TwoFactorChallenge | null;
|
||||||
login: (username: string, password: string) => Promise<void>;
|
login: (username: string, password: string) => Promise<void>;
|
||||||
|
verifyTwoFactor: (code: string) => Promise<void>;
|
||||||
|
cancelTwoFactor: () => void;
|
||||||
loginAs: (id: number) => Promise<void>;
|
loginAs: (id: number) => Promise<void>;
|
||||||
logout: () => void;
|
logout: () => void;
|
||||||
token?: string;
|
token?: string;
|
||||||
@@ -24,17 +39,35 @@ interface Props {
|
|||||||
function AuthProvider({ children, tokenRefreshInterval = 5 * 60 * 1000 }: Props) {
|
function AuthProvider({ children, tokenRefreshInterval = 5 * 60 * 1000 }: Props) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [authenticated, setAuthenticated] = useState(AuthStore.hasActiveToken());
|
const [authenticated, setAuthenticated] = useState(AuthStore.hasActiveToken());
|
||||||
|
const [twoFactorChallenge, setTwoFactorChallenge] = useState<TwoFactorChallenge | null>(null);
|
||||||
|
|
||||||
const handleTokenUpdate = (response: TokenResponse) => {
|
const handleTokenUpdate = (response: TokenResponse) => {
|
||||||
AuthStore.set(response);
|
AuthStore.set(response);
|
||||||
setAuthenticated(true);
|
setAuthenticated(true);
|
||||||
|
setTwoFactorChallenge(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const login = async (identity: string, secret: string) => {
|
const login = async (identity: string, secret: string) => {
|
||||||
const response = await getToken(identity, secret);
|
const response = await getToken(identity, secret);
|
||||||
|
if (isTwoFactorChallenge(response)) {
|
||||||
|
setTwoFactorChallenge({ challengeToken: response.challengeToken });
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleTokenUpdate(response);
|
handleTokenUpdate(response);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const verifyTwoFactor = async (code: string) => {
|
||||||
|
if (!twoFactorChallenge) {
|
||||||
|
throw new Error("No 2FA challenge pending");
|
||||||
|
}
|
||||||
|
const response = await verify2FA(twoFactorChallenge.challengeToken, code);
|
||||||
|
handleTokenUpdate(response);
|
||||||
|
};
|
||||||
|
|
||||||
|
const cancelTwoFactor = () => {
|
||||||
|
setTwoFactorChallenge(null);
|
||||||
|
};
|
||||||
|
|
||||||
const loginAs = async (id: number) => {
|
const loginAs = async (id: number) => {
|
||||||
const response = await loginAsUser(id);
|
const response = await loginAsUser(id);
|
||||||
AuthStore.add(response);
|
AuthStore.add(response);
|
||||||
@@ -69,7 +102,15 @@ function AuthProvider({ children, tokenRefreshInterval = 5 * 60 * 1000 }: Props)
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
const value = { authenticated, login, logout, loginAs };
|
const value = {
|
||||||
|
authenticated,
|
||||||
|
twoFactorChallenge,
|
||||||
|
login,
|
||||||
|
verifyTwoFactor,
|
||||||
|
cancelTwoFactor,
|
||||||
|
loginAs,
|
||||||
|
logout,
|
||||||
|
};
|
||||||
|
|
||||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,73 +1,89 @@
|
|||||||
import { createIntl, createIntlCache } from "react-intl";
|
import { createIntl, createIntlCache } from "react-intl";
|
||||||
|
import langBg from "./lang/bg.json";
|
||||||
import langDe from "./lang/de.json";
|
import langDe from "./lang/de.json";
|
||||||
import langEn from "./lang/en.json";
|
import langEn from "./lang/en.json";
|
||||||
import langEs from "./lang/es.json";
|
import langEs from "./lang/es.json";
|
||||||
|
import langFr from "./lang/fr.json";
|
||||||
|
import langGa from "./lang/ga.json";
|
||||||
|
import langId from "./lang/id.json";
|
||||||
import langIt from "./lang/it.json";
|
import langIt from "./lang/it.json";
|
||||||
import langJa from "./lang/ja.json";
|
import langJa from "./lang/ja.json";
|
||||||
import langList from "./lang/lang-list.json";
|
import langKo from "./lang/ko.json";
|
||||||
import langNl from "./lang/nl.json";
|
import langNl from "./lang/nl.json";
|
||||||
import langPl from "./lang/pl.json";
|
import langPl from "./lang/pl.json";
|
||||||
import langRu from "./lang/ru.json";
|
import langRu from "./lang/ru.json";
|
||||||
import langSk from "./lang/sk.json";
|
import langSk from "./lang/sk.json";
|
||||||
import langVi from "./lang/vi.json";
|
import langVi from "./lang/vi.json";
|
||||||
import langZh from "./lang/zh.json";
|
import langZh from "./lang/zh.json";
|
||||||
|
import langTr from "./lang/tr.json";
|
||||||
|
import langHu from "./lang/hu.json";
|
||||||
|
import langList from "./lang/lang-list.json";
|
||||||
|
|
||||||
// first item of each array should be the language code,
|
// first item of each array should be the language code,
|
||||||
// not the country code
|
// not the country code
|
||||||
// Remember when adding to this list, also update check-locales.js script
|
// Remember when adding to this list, also update check-locales.js script
|
||||||
const localeOptions = [
|
const localeOptions = [
|
||||||
["en", "en-US", langEn],
|
["en", "en-US", langEn],
|
||||||
["de", "de-DE", langDe],
|
["de", "de-DE", langDe],
|
||||||
["es", "es-ES", langEs],
|
["es", "es-ES", langEs],
|
||||||
["ja", "ja-JP", langJa],
|
["fr", "fr-FR", langFr],
|
||||||
["it", "it-IT", langIt],
|
["ga", "ga-IE", langGa],
|
||||||
["nl", "nl-NL", langNl],
|
["ja", "ja-JP", langJa],
|
||||||
["pl", "pl-PL", langPl],
|
["it", "it-IT", langIt],
|
||||||
["ru", "ru-RU", langRu],
|
["nl", "nl-NL", langNl],
|
||||||
["sk", "sk-SK", langSk],
|
["pl", "pl-PL", langPl],
|
||||||
["vi", "vi-VN", langVi],
|
["ru", "ru-RU", langRu],
|
||||||
["zh", "zh-CN", langZh],
|
["sk", "sk-SK", langSk],
|
||||||
|
["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],
|
||||||
];
|
];
|
||||||
|
|
||||||
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
|
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
|
// ensure this lang exists in localeOptions above, otherwise fallback to en
|
||||||
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
|
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
|
||||||
return Object.assign({}, langList, langEn);
|
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 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
|
// only add to this if your flag is different from the locale code
|
||||||
const specialCases: Record<string, string> = {
|
const specialCases: Record<string, string> = {
|
||||||
ja: "jp", // Japan
|
ja: "jp", // Japan
|
||||||
zh: "cn", // China
|
zh: "cn", // China
|
||||||
};
|
vi: "vn", // Vietnam
|
||||||
|
ko: "kr", // Korea
|
||||||
|
};
|
||||||
|
|
||||||
if (specialCases[thisLocale]) {
|
if (specialCases[thisLocale]) {
|
||||||
return specialCases[thisLocale].toUpperCase();
|
return specialCases[thisLocale].toUpperCase();
|
||||||
}
|
}
|
||||||
return thisLocale.toUpperCase();
|
return thisLocale.toUpperCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLocale = (short = false) => {
|
const getLocale = (short = false) => {
|
||||||
let loc = window.localStorage.getItem("locale");
|
let loc = window.localStorage.getItem("locale");
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = document.documentElement.lang;
|
loc = document.documentElement.lang;
|
||||||
}
|
}
|
||||||
if (short) {
|
if (short) {
|
||||||
return loc.slice(0, 2);
|
return loc.slice(0, 2);
|
||||||
}
|
}
|
||||||
// finally, fallback
|
// finally, fallback
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = "en";
|
loc = "en";
|
||||||
}
|
}
|
||||||
return loc;
|
return loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cache = createIntlCache();
|
const cache = createIntlCache();
|
||||||
@@ -76,43 +92,43 @@ const initialMessages = loadMessages(getLocale());
|
|||||||
let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache);
|
let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache);
|
||||||
|
|
||||||
const changeLocale = (locale: string): void => {
|
const changeLocale = (locale: string): void => {
|
||||||
const messages = loadMessages(locale);
|
const messages = loadMessages(locale);
|
||||||
intl = createIntl({ locale, messages }, cache);
|
intl = createIntl({ locale, messages }, cache);
|
||||||
window.localStorage.setItem("locale", locale);
|
window.localStorage.setItem("locale", locale);
|
||||||
document.documentElement.lang = locale;
|
document.documentElement.lang = locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is a translation component that wraps the translation in a span with a data
|
// 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
|
// attribute so devs can inspect the element to see the translation ID
|
||||||
const T = ({
|
const T = ({
|
||||||
id,
|
id,
|
||||||
data,
|
data,
|
||||||
tData,
|
tData,
|
||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
data?: Record<string, string | number | undefined>;
|
data?: Record<string, string | number | undefined>;
|
||||||
tData?: Record<string, string>;
|
tData?: Record<string, string>;
|
||||||
}) => {
|
}) => {
|
||||||
const translatedData: Record<string, string> = {};
|
const translatedData: Record<string, string> = {};
|
||||||
if (tData) {
|
if (tData) {
|
||||||
// iterate over tData and translate each value
|
// iterate over tData and translate each value
|
||||||
Object.entries(tData).forEach(([key, value]) => {
|
Object.entries(tData).forEach(([key, value]) => {
|
||||||
translatedData[key] = intl.formatMessage({ id: value });
|
translatedData[key] = intl.formatMessage({ id: value });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<span data-translation-id={id}>
|
<span data-translation-id={id}>
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id },
|
{ id },
|
||||||
{
|
{
|
||||||
...data,
|
...data,
|
||||||
...translatedData,
|
...translatedData,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("L:", localeOptions);
|
//console.log("L:", localeOptions);
|
||||||
|
|
||||||
export { localeOptions, getFlagCodeForLocale, getLocale, createIntl, changeLocale, intl, T };
|
export { localeOptions, getFlagCodeForLocale, getLocale, createIntl, changeLocale, intl, T };
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ not be complete by the time you're reading this:
|
|||||||
- frontend/src/locale/src/[yourlang].json
|
- frontend/src/locale/src/[yourlang].json
|
||||||
- frontend/src/locale/src/lang-list.json
|
- frontend/src/locale/src/lang-list.json
|
||||||
- frontend/src/locale/src/HelpDoc/[yourlang]/*
|
- frontend/src/locale/src/HelpDoc/[yourlang]/*
|
||||||
|
- frontend/src/locale/src/HelpDoc/index.tsx
|
||||||
- frontend/src/locale/IntlProvider.tsx
|
- frontend/src/locale/IntlProvider.tsx
|
||||||
- frontend/check-locales.cjs
|
- frontend/check-locales.cjs
|
||||||
|
|
||||||
|
|||||||
@@ -39,19 +39,19 @@ describe("DateFormatter", () => {
|
|||||||
it("format date from iso date", () => {
|
it("format date from iso date", () => {
|
||||||
const value = "2024-01-01T00:00:00.000Z";
|
const value = "2024-01-01T00:00:00.000Z";
|
||||||
const text = formatDateTime(value);
|
const text = formatDateTime(value);
|
||||||
expect(text).toBe("Monday, 01/01/2024, 12:00:00 am");
|
expect(text).toBe("1 Jan 2024, 12:00:00 am");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("format date from unix timestamp number", () => {
|
it("format date from unix timestamp number", () => {
|
||||||
const value = 1762476112;
|
const value = 1762476112;
|
||||||
const text = formatDateTime(value);
|
const text = formatDateTime(value);
|
||||||
expect(text).toBe("Friday, 07/11/2025, 12:41:52 am");
|
expect(text).toBe("7 Nov 2025, 12:41:52 am");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("format date from unix timestamp string", () => {
|
it("format date from unix timestamp string", () => {
|
||||||
const value = "1762476112";
|
const value = "1762476112";
|
||||||
const text = formatDateTime(value);
|
const text = formatDateTime(value);
|
||||||
expect(text).toBe("Friday, 07/11/2025, 12:41:52 am");
|
expect(text).toBe("7 Nov 2025, 12:41:52 am");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("catch bad format from string", () => {
|
it("catch bad format from string", () => {
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { fromUnixTime, intlFormat, parseISO } from "date-fns";
|
import {
|
||||||
|
fromUnixTime,
|
||||||
|
type IntlFormatFormatOptions,
|
||||||
|
intlFormat,
|
||||||
|
parseISO,
|
||||||
|
} from "date-fns";
|
||||||
|
|
||||||
const isUnixTimestamp = (value: unknown): boolean => {
|
const isUnixTimestamp = (value: unknown): boolean => {
|
||||||
if (typeof value !== "number" && typeof value !== "string") return false;
|
if (typeof value !== "number" && typeof value !== "string") return false;
|
||||||
@@ -20,20 +25,19 @@ const parseDate = (value: string | number): Date | null => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDateTime = (value: string | number): string => {
|
const formatDateTime = (value: string | number, locale = "en-US"): string => {
|
||||||
const d = parseDate(value);
|
const d = parseDate(value);
|
||||||
if (!d) return `${value}`;
|
if (!d) return `${value}`;
|
||||||
try {
|
try {
|
||||||
return intlFormat(d, {
|
return intlFormat(
|
||||||
weekday: "long",
|
d,
|
||||||
year: "numeric",
|
{
|
||||||
month: "numeric",
|
dateStyle: "medium",
|
||||||
day: "numeric",
|
timeStyle: "medium",
|
||||||
hour: "numeric",
|
hourCycle: "h12",
|
||||||
minute: "numeric",
|
} as IntlFormatFormatOptions,
|
||||||
second: "numeric",
|
{ locale },
|
||||||
hour12: true,
|
);
|
||||||
});
|
|
||||||
} catch {
|
} catch {
|
||||||
return `${value}`;
|
return `${value}`;
|
||||||
}
|
}
|
||||||
|
|||||||
69
frontend/src/locale/scripts/locale-sort.cjs
Normal file
69
frontend/src/locale/scripts/locale-sort.cjs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const DIR = path.resolve(__dirname, "../src");
|
||||||
|
|
||||||
|
// Function to sort object keys recursively
|
||||||
|
function sortKeys(obj) {
|
||||||
|
if (obj === null || typeof obj !== "object" || obj instanceof Array) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sorted = {};
|
||||||
|
const keys = Object.keys(obj).sort();
|
||||||
|
for (const key of keys) {
|
||||||
|
const value = obj[key];
|
||||||
|
if (typeof value === "object" && value !== null && !(value instanceof Array)) {
|
||||||
|
sorted[key] = sortKeys(value);
|
||||||
|
} else {
|
||||||
|
sorted[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all JSON files in the directory
|
||||||
|
const files = fs.readdirSync(DIR).filter((file) => {
|
||||||
|
return file.endsWith(".json") && file !== "lang-list.json";
|
||||||
|
});
|
||||||
|
|
||||||
|
files.forEach((file) => {
|
||||||
|
const filePath = path.join(DIR, file);
|
||||||
|
const stats = fs.statSync(filePath);
|
||||||
|
|
||||||
|
if (!stats.isFile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.size === 0) {
|
||||||
|
console.log(`Skipping empty file ${file}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Read original content
|
||||||
|
const originalContent = fs.readFileSync(filePath, "utf8");
|
||||||
|
const originalJson = JSON.parse(originalContent);
|
||||||
|
|
||||||
|
// Sort keys
|
||||||
|
const sortedJson = sortKeys(originalJson);
|
||||||
|
|
||||||
|
// Convert back to string with tabs
|
||||||
|
const sortedContent = JSON.stringify(sortedJson, null, "\t") + "\n";
|
||||||
|
|
||||||
|
// Compare (normalize whitespace)
|
||||||
|
if (originalContent.trim() === sortedContent.trim()) {
|
||||||
|
console.log(`${file} is already sorted`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write sorted content
|
||||||
|
fs.writeFileSync(filePath, sortedContent, "utf8");
|
||||||
|
console.log(`Sorted ${file}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error processing ${file}:`, error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@@ -31,6 +31,6 @@ for file in *.json; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Sorting $file"
|
echo "Sorting $file"
|
||||||
jq --tab --sort-keys . "$file" | sponge "$file"
|
tmp=$(mktemp) && jq --tab --sort-keys . "$file" > "$tmp" && mv "$tmp" "$file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
7
frontend/src/locale/src/HelpDoc/bg/AccessLists.md
Normal file
7
frontend/src/locale/src/HelpDoc/bg/AccessLists.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Какво представлява Списъкът за достъп?
|
||||||
|
|
||||||
|
Списъците за достъп предоставят черен или бял списък от конкретни клиентски IP адреси, както и удостоверяване за Прокси хостове чрез базова HTTP автентикация.
|
||||||
|
|
||||||
|
Можете да конфигурирате множество клиентски правила, потребителски имена и пароли в един Списък за достъп и след това да го приложите към един или повече _Прокси хостове_.
|
||||||
|
|
||||||
|
Това е най-полезно при препращани уеб услуги, които нямат вградени механизми за удостоверяване, или когато искате да защитите достъпа от неизвестни клиенти.
|
||||||
21
frontend/src/locale/src/HelpDoc/bg/Certificates.md
Normal file
21
frontend/src/locale/src/HelpDoc/bg/Certificates.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Помощ за сертификати
|
||||||
|
|
||||||
|
### HTTP сертификат
|
||||||
|
|
||||||
|
HTTP валидираният сертификат означава, че сървърите на Let’s Encrypt ще се опитат да достигнат вашите домейни по HTTP (не по HTTPS!) и ако успеят, ще издадат сертификата.
|
||||||
|
|
||||||
|
За този метод трябва да имате създаден _Прокси хост_ за вашия/вашите домейни, който да е достъпен по HTTP и да сочи към тази Nginx инсталация. След като бъде издаден сертификат, можете да промените _Прокси хоста_ така, че да използва сертификата и за HTTPS връзки. Въпреки това, _Прокси хостът_ трябва да остане конфигуриран за достъп по HTTP, за да може сертификатът да се подновява.
|
||||||
|
|
||||||
|
Този процес _не_ поддържа wildcard домейни.
|
||||||
|
|
||||||
|
### DNS сертификат
|
||||||
|
|
||||||
|
DNS валидираният сертификат изисква използването на DNS Provider плъгин. Този DNS Provider ще бъде използван за временно създаване на записи във вашия домейн, след което Let’s Encrypt ще ги провери, за да се увери, че сте собственикът, и при успех ще издаде сертификата.
|
||||||
|
|
||||||
|
Не е необходимо да имате _Прокси хост_, създаден предварително, за да заявите този тип сертификат. Нито е нужно вашият _Прокси хост_ да бъде конфигуриран за достъп по HTTP.
|
||||||
|
|
||||||
|
Този процес _поддържа_ wildcard домейни.
|
||||||
|
|
||||||
|
### Персонализиран сертификат
|
||||||
|
|
||||||
|
Използвайте тази опция, за да качите собствен SSL сертификат, предоставен от ваша сертификатна агенция.
|
||||||
10
frontend/src/locale/src/HelpDoc/bg/DeadHosts.md
Normal file
10
frontend/src/locale/src/HelpDoc/bg/DeadHosts.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## Какво представлява 404 хост?
|
||||||
|
|
||||||
|
404 хост е просто конфигурация на хост, който показва страница с грешка 404.
|
||||||
|
|
||||||
|
Това може да е полезно, когато вашият домейн е индексиран в търсачките и искате
|
||||||
|
да предоставите по-приятна страница за грешка или да уведомите индексиращите системи,
|
||||||
|
че страниците на домейна вече не съществуват.
|
||||||
|
|
||||||
|
Допълнително предимство на този хост е възможността да проследявате логовете на заявките
|
||||||
|
към него и да виждате реферерите.
|
||||||
7
frontend/src/locale/src/HelpDoc/bg/ProxyHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/bg/ProxyHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Какво представлява Прокси хост?
|
||||||
|
|
||||||
|
Прокси хост е входна точка за уеб услуга, която искате да препращате.
|
||||||
|
|
||||||
|
Той предоставя възможност за SSL терминaция на услуга, която може да няма вградена поддръжка на SSL.
|
||||||
|
|
||||||
|
Прокси хостовете са най-често използваната функция в Nginx Proxy Manager.
|
||||||
7
frontend/src/locale/src/HelpDoc/bg/RedirectionHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/bg/RedirectionHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Какво представлява Хост за пренасочване?
|
||||||
|
|
||||||
|
Хостът за пренасочване пренасочва заявките от входящия домейн и прехвърля
|
||||||
|
потребителя към друг домейн.
|
||||||
|
|
||||||
|
Най-честата причина за използване на този тип хост е, когато вашият уебсайт
|
||||||
|
промени домейна си, но все още има линкове от търсачки или реферери, които сочат към стария домейн.
|
||||||
6
frontend/src/locale/src/HelpDoc/bg/Streams.md
Normal file
6
frontend/src/locale/src/HelpDoc/bg/Streams.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
## Какво представлява Потокът (Stream)?
|
||||||
|
|
||||||
|
Относително нова функция за Nginx, Потокът позволява препращане на TCP/UDP
|
||||||
|
трафик директно към друг компютър в мрежата.
|
||||||
|
|
||||||
|
Това е полезно, ако хоствате игрови сървъри, FTP или SSH сървъри.
|
||||||
6
frontend/src/locale/src/HelpDoc/bg/index.ts
Normal file
6
frontend/src/locale/src/HelpDoc/bg/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
7
frontend/src/locale/src/HelpDoc/fr/AccessLists.md
Normal file
7
frontend/src/locale/src/HelpDoc/fr/AccessLists.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Qu'est-ce qu'une liste d'accès ?
|
||||||
|
|
||||||
|
Les listes d'accès permettent de définir une liste noire ou une liste blanche d'adresses IP clientes spécifiques, ainsi que l'authentification des Hôtes Proxy via l'authentification HTTP de base.
|
||||||
|
|
||||||
|
Vous pouvez configurer plusieurs règles client, noms d'utilisateur et mots de passe pour une même liste d'accès, puis l'appliquer à un ou plusieurs Hôtes Proxy.
|
||||||
|
|
||||||
|
Ceci est particulièrement utile pour les services web redirigés qui ne disposent pas de mécanismes d'authentification intégrés ou lorsque vous souhaitez vous protéger contre les clients inconnus.
|
||||||
23
frontend/src/locale/src/HelpDoc/fr/Certificates.md
Normal file
23
frontend/src/locale/src/HelpDoc/fr/Certificates.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
## Aide concernant les certificats
|
||||||
|
|
||||||
|
### Certificat HTTP
|
||||||
|
|
||||||
|
Un certificat HTTP validé signifie que les serveurs de Let's Encrypt testeront d'accéder à vos domaines via HTTP (et non HTTPS !). En cas de succès, ils émettront votre certificat.
|
||||||
|
|
||||||
|
Pour cette méthode, vous devrez créer un Hôte Proxy pour votre ou vos domaines. Cet Hôte Proxy devra être accessible via HTTP et pointer vers cette installation Nginx. Une fois le certificat émis, vous pourrez modifier l'Hôte Proxy pour qu'il utilise également ce certificat pour les connexions HTTPS. Cependant, l'Hôte Proxy devra toujours être configuré pour l'accès HTTP afin que le certificat puisse être renouvelé.
|
||||||
|
|
||||||
|
Ce processus ne prend pas en charge les domaines génériques.
|
||||||
|
|
||||||
|
### Certificat DNS
|
||||||
|
|
||||||
|
Un certificat DNS validé nécessite l'utilisation du plugin Fournisseur DNS. Fournisseur DNS créera des enregistrements temporaires sur votre domaine. Let's Encrypt interrogera ensuite ces enregistrements pour vérifier que vous en êtes bien le propriétaire. En cas de succès, votre certificat sera émis.
|
||||||
|
|
||||||
|
Il n'est pas nécessaire de créer un Hôte Proxy avant de demander ce type de certificat.
|
||||||
|
|
||||||
|
Il n'est pas non plus nécessaire de configurer votre Hôte Proxy pour l'accès HTTP.
|
||||||
|
|
||||||
|
Ce processus prend en charge les domaines génériques.
|
||||||
|
|
||||||
|
## Certificat personnalisé
|
||||||
|
|
||||||
|
Utilisez cette option pour importer votre propre certificat SSL, fourni par votre autorité de certification.
|
||||||
7
frontend/src/locale/src/HelpDoc/fr/DeadHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/fr/DeadHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Qu'est-ce qu'un serveur 404 ?
|
||||||
|
|
||||||
|
Un Hôte 404 est simplement un hôte configuré pour afficher une page 404.
|
||||||
|
|
||||||
|
Cela peut s'avérer utile lorsque votre domaine est indexé par les moteurs de recherche et que vous souhaitez fournir une page d'erreur plus conviviale ou, plus précisément, indiquer aux moteurs de recherche que les pages du domaine n'existent plus.
|
||||||
|
|
||||||
|
Un autre avantage de cet hôte est la possibilité de suivre les journaux et de consulter les sites référenceurs.
|
||||||
7
frontend/src/locale/src/HelpDoc/fr/ProxyHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/fr/ProxyHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Qu'est-ce qu'un hôte proxy ?
|
||||||
|
|
||||||
|
Un Hôte Proxy est le point de terminaison entrant d'un service web que vous souhaitez rediriger.
|
||||||
|
|
||||||
|
Il assure la terminaison SSL optionnelle pour votre service qui ne prend pas en charge SSL nativement.
|
||||||
|
|
||||||
|
Les Hôtes Proxy constituent l'utilisation la plus courante du Nginx Proxy Manager.
|
||||||
5
frontend/src/locale/src/HelpDoc/fr/RedirectionHosts.md
Normal file
5
frontend/src/locale/src/HelpDoc/fr/RedirectionHosts.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Qu'est-ce qu'un serveur de redirection ?
|
||||||
|
|
||||||
|
Un Hôte de Redirection redirige les requêtes provenant du domaine entrant vers un autre domaine.
|
||||||
|
|
||||||
|
On utilise généralement ce type d'hôte lorsque votre site web change de domaine, mais que des liens provenant des moteurs de recherche ou des sites référenceurs pointent toujours vers l'ancien domaine.
|
||||||
5
frontend/src/locale/src/HelpDoc/fr/Streams.md
Normal file
5
frontend/src/locale/src/HelpDoc/fr/Streams.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Qu'est-ce qu'un Stream ?
|
||||||
|
|
||||||
|
Fonctionnalité relativement récente de Nginx, un Stream permet de rediriger le trafic TCP/UDP directement vers un autre ordinateur du réseau.
|
||||||
|
|
||||||
|
Si vous gérez des serveurs de jeux, FTP ou SSH, cela peut s'avérer très utile.
|
||||||
6
frontend/src/locale/src/HelpDoc/fr/index.ts
Normal file
6
frontend/src/locale/src/HelpDoc/fr/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
7
frontend/src/locale/src/HelpDoc/ga/AccessLists.md
Normal file
7
frontend/src/locale/src/HelpDoc/ga/AccessLists.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Cad is Liosta Rochtana ann?
|
||||||
|
|
||||||
|
Soláthraíonn Liostaí Rochtana liosta dubh nó liosta bán de sheoltaí IP cliant ar leith mar aon le fíordheimhniú do na hÓstaigh Seachfhreastalaí trí Fhíordheimhniú Bunúsach HTTP.
|
||||||
|
|
||||||
|
Is féidir leat rialacha cliant, ainmneacha úsáideora agus pasfhocail iolracha a chumrú le haghaidh Liosta Rochtana aonair agus ansin iad sin a chur i bhfeidhm ar _Óstach Seachfhreastalaí_ amháin nó níos mó.
|
||||||
|
|
||||||
|
Tá sé seo an-úsáideach i gcás seirbhísí gréasáin atreoraithe nach bhfuil meicníochtaí fíordheimhnithe ionsuite iontu nó nuair is mian leat cosaint a dhéanamh ar chliaint anaithnide.
|
||||||
21
frontend/src/locale/src/HelpDoc/ga/Certificates.md
Normal file
21
frontend/src/locale/src/HelpDoc/ga/Certificates.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Cabhair le Deimhnithe
|
||||||
|
|
||||||
|
### Teastas HTTP
|
||||||
|
|
||||||
|
Ciallaíonn deimhniú bailíochtaithe HTTP go ndéanfaidh freastalaithe Let's Encrypt iarracht teacht ar do fhearainn thar HTTP (ní HTTPS!) agus má éiríonn leo, eiseoidh siad do theastas.
|
||||||
|
|
||||||
|
Chun an modh seo a dhéanamh, beidh ort _Óstach Proxy_ a chruthú do do fhearainn(eanna) atá inrochtana le HTTP agus ag pointeáil chuig an suiteáil Nginx seo. Tar éis deimhniú a thabhairt, is féidir leat an _Óstach Proxy_ a mhodhnú chun an deimhniú seo a úsáid le haghaidh naisc HTTPS freisin. Mar sin féin, beidh ort an _Óstach Proxy_ a chumrú fós le haghaidh rochtain HTTP chun go ndéanfar an deimhniú a athnuachan.
|
||||||
|
|
||||||
|
_Ní thacaíonn_ an próiseas seo le fearainn fiáine.
|
||||||
|
|
||||||
|
### Teastas DNS
|
||||||
|
|
||||||
|
Éilíonn deimhniú bailíochtaithe DNS ort breiseán Soláthraí DNS a úsáid. Úsáidfear an Soláthraí DNS seo chun taifid shealadacha a chruthú ar do fhearann agus ansin déanfaidh Let's Encrypt fiosrúchán ar na taifid sin lena chinntiú gurb tusa an t-úinéir agus má éiríonn leo, eiseoidh siad do theastas.
|
||||||
|
|
||||||
|
Ní gá duit _Óstach Proxy_ a chruthú sula n-iarrann tú an cineál seo teastais. Ní gá duit do _Óstach Proxy_ a chumrú le haghaidh rochtana HTTP ach an oiread.
|
||||||
|
|
||||||
|
_Tacaíonn_ an próiseas seo le fearainn fiáine.
|
||||||
|
|
||||||
|
### Teastas Saincheaptha
|
||||||
|
|
||||||
|
Úsáid an rogha seo chun do Theastas SSL féin a uaslódáil, mar a sholáthraíonn d'Údarás Deimhnithe féin é.
|
||||||
7
frontend/src/locale/src/HelpDoc/ga/DeadHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/ga/DeadHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Cad is Óstach 404 ann?
|
||||||
|
|
||||||
|
Is socrú óstach a thaispeánann leathanach 404 é Óstach 404.
|
||||||
|
|
||||||
|
Is féidir leis seo a bheith úsáideach nuair a bhíonn do fhearann liostaithe in innill chuardaigh agus más mian leat leathanach earráide níos deise a sholáthar nó a chur in iúl do na hinnéacsóirí cuardaigh go sonrach nach bhfuil na leathanaigh fearainn ann a thuilleadh.
|
||||||
|
|
||||||
|
Buntáiste eile a bhaineann leis an óstach seo a bheith agat ná go bhfeictear na logaí le haghaidh amas agus go bhfeictear na tagairtí.
|
||||||
7
frontend/src/locale/src/HelpDoc/ga/ProxyHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/ga/ProxyHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Cad is Óstach Seachfhreastalaí ann?
|
||||||
|
|
||||||
|
Is é Óstach Seachfhreastalaí an críochphointe isteach do sheirbhís ghréasáin ar mhaith leat a atreorú.
|
||||||
|
|
||||||
|
Soláthraíonn sé foirceannadh SSL roghnach do do sheirbhís nach bhfuil tacaíocht SSL ionsuite inti b'fhéidir.
|
||||||
|
|
||||||
|
Is iad Óstaigh Seachfhreastalaí an úsáid is coitianta a bhaintear as Bainisteoir Seachfhreastalaí Nginx.
|
||||||
5
frontend/src/locale/src/HelpDoc/ga/RedirectionHosts.md
Normal file
5
frontend/src/locale/src/HelpDoc/ga/RedirectionHosts.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Cad is Óstach Athsheolta ann?
|
||||||
|
|
||||||
|
Déanfaidh Óstach Athsheolta iarratais a atreorú ón bhfearann ag teacht isteach agus an breathnóir a bhrú chuig fearann eile.
|
||||||
|
|
||||||
|
Is é an chúis is coitianta le húsáid a bhaint as an gcineál seo óstála ná nuair a athraíonn do shuíomh Gréasáin fearainn ach go bhfuil naisc innill chuardaigh nó atreoraithe agat fós ag tagairt don seanfhearann.
|
||||||
5
frontend/src/locale/src/HelpDoc/ga/Streams.md
Normal file
5
frontend/src/locale/src/HelpDoc/ga/Streams.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Cad is Sruth ann?
|
||||||
|
|
||||||
|
Gné réasúnta nua do Nginx is ea Sruth a sheolfaidh trácht TCP/UDP go díreach chuig ríomhaire eile ar an líonra.
|
||||||
|
|
||||||
|
Más freastalaithe cluichí, freastalaithe FTP nó SSH atá á rith agat, d’fhéadfadh sé seo a bheith úsáideach.
|
||||||
6
frontend/src/locale/src/HelpDoc/ga/index.ts
Normal file
6
frontend/src/locale/src/HelpDoc/ga/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
7
frontend/src/locale/src/HelpDoc/hu/AccessLists.md
Normal file
7
frontend/src/locale/src/HelpDoc/hu/AccessLists.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Mi az a hozzáférési lista?
|
||||||
|
|
||||||
|
A hozzáférési listák feketelistát vagy fehérlistát biztosítanak meghatározott kliens IP-címekhez, valamint alap HTTP-hitelesítést (Basic HTTP Authentication) a proxy kiszolgálókhoz.
|
||||||
|
|
||||||
|
Egyetlen hozzáférési listához több kliensszabályt, felhasználónevet és jelszót is beállíthatsz, majd ezt alkalmazhatod egy vagy több _Proxy Kiszolgáló_-ra.
|
||||||
|
|
||||||
|
Ez különösen hasznos olyan továbbított webszolgáltatásoknál, amelyekben nincs beépített hitelesítési mechanizmus, vagy amikor ismeretlen kliensektől szeretnél védeni.
|
||||||
21
frontend/src/locale/src/HelpDoc/hu/Certificates.md
Normal file
21
frontend/src/locale/src/HelpDoc/hu/Certificates.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Tanúsítványok súgó
|
||||||
|
|
||||||
|
### HTTP tanúsítvány
|
||||||
|
|
||||||
|
A HTTP érvényes tanúsítvány azt jelenti, hogy a Let's Encrypt szerverek megpróbálják elérni a domaineket HTTP-n keresztül (nem HTTPS-en!), és ha sikerül, kiállítják a tanúsítványt.
|
||||||
|
|
||||||
|
Ehhez a módszerhez létre kell hoznod egy _Proxy Kiszolgáló_-t a domain(ek)hez, amely HTTP-n keresztül elérhető és erre az Nginx telepítésre mutat. Miután a tanúsítvány megérkezett, módosíthatod a _Proxy Kiszolgáló_-t, hogy ezt a tanúsítványt használja a HTTPS kapcsolatokhoz is. Azonban a _Proxy Kiszolgáló_-nak továbbra is konfigurálva kell lennie HTTP hozzáféréshez, hogy a tanúsítvány megújulhasson.
|
||||||
|
|
||||||
|
Ez a folyamat _nem_ támogatja a helyettesítő karakteres domaineket.
|
||||||
|
|
||||||
|
### DNS tanúsítvány
|
||||||
|
|
||||||
|
A DNS érvényes tanúsítvány megköveteli, hogy DNS szolgáltató plugint használj. Ez a DNS szolgáltató ideiglenes rekordokat hoz létre a domainen, majd a Let's Encrypt lekérdezi ezeket a rekordokat, hogy megbizonyosodjon a tulajdonjogról, és ha sikeres, kiállítják a tanúsítványt.
|
||||||
|
|
||||||
|
Nem szükséges előzetesen _Proxy Kiszolgáló_-t létrehozni az ilyen típusú tanúsítvány igényléséhez. Nem is kell a _Proxy Kiszolgáló_-t HTTP hozzáférésre konfigurálni.
|
||||||
|
|
||||||
|
Ez a folyamat _támogatja_ a helyettesítő karakteres domaineket.
|
||||||
|
|
||||||
|
### Egyéni tanúsítvány
|
||||||
|
|
||||||
|
Ezt az opciót használd a saját SSL tanúsítvány feltöltéséhez, amelyet a saját tanúsítványkibocsátód biztosított.
|
||||||
7
frontend/src/locale/src/HelpDoc/hu/DeadHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/hu/DeadHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Mi az a 404-es Kiszolgáló?
|
||||||
|
|
||||||
|
A 404-es Kiszolgáló egyszerűen egy olyan kiszolgáló beállítás, amely egy 404-es oldalt jelenít meg.
|
||||||
|
|
||||||
|
Ez akkor lehet hasznos, ha a domained szerepel a keresőmotorokban, és egy szebb hibaoldalt szeretnél nyújtani, vagy kifejezetten jelezni akarod a keresőrobotoknak, hogy a domain oldalai már nem léteznek.
|
||||||
|
|
||||||
|
Ennek a kiszolgálónak egy további előnye, hogy nyomon követheted a rá érkező találatokat a naplókban, és megtekintheted a hivatkozó oldalakat.
|
||||||
7
frontend/src/locale/src/HelpDoc/hu/ProxyHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/hu/ProxyHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Mi az a Proxy Kiszolgáló?
|
||||||
|
|
||||||
|
A Proxy Kiszolgáló egy bejövő végpont egy olyan webszolgáltatáshoz, amelyet továbbítani szeretnél.
|
||||||
|
|
||||||
|
Opcionális SSL lezárást biztosít a szolgáltatásodhoz, amelyben esetleg nincs beépített SSL támogatás.
|
||||||
|
|
||||||
|
A Proxy Kiszolgálók az Nginx Proxy Manager leggyakoribb felhasználási módjai.
|
||||||
5
frontend/src/locale/src/HelpDoc/hu/RedirectionHosts.md
Normal file
5
frontend/src/locale/src/HelpDoc/hu/RedirectionHosts.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Mi az az Átirányító Kiszolgáló?
|
||||||
|
|
||||||
|
Az Átirányító Kiszolgáló a bejövő domainre érkező kéréseket átirányítja, és a látogatót egy másik domainre küldi.
|
||||||
|
|
||||||
|
Ennek a kiszolgálótípusnak a leggyakoribb használati oka az, amikor a weboldalad domaint vált, de a keresőkben vagy a hivatkozó oldalakon még mindig a régi domainre mutató linkek vannak.
|
||||||
5
frontend/src/locale/src/HelpDoc/hu/Streams.md
Normal file
5
frontend/src/locale/src/HelpDoc/hu/Streams.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Mi az a Stream?
|
||||||
|
|
||||||
|
Az Nginx egy viszonylag új funkciója, a Stream arra szolgál, hogy a TCP/UDP forgalmat közvetlenül továbbítsa a hálózat egy másik számítógépére.
|
||||||
|
|
||||||
|
Ha játékszervereket, FTP vagy SSH szervereket futtatsz, ez hasznos lehet.
|
||||||
6
frontend/src/locale/src/HelpDoc/hu/index.ts
Normal file
6
frontend/src/locale/src/HelpDoc/hu/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
7
frontend/src/locale/src/HelpDoc/id/AccessLists.md
Normal file
7
frontend/src/locale/src/HelpDoc/id/AccessLists.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Apa itu Daftar Akses?
|
||||||
|
|
||||||
|
Daftar Akses menyediakan daftar hitam atau daftar putih alamat IP klien tertentu beserta autentikasi untuk Host Proxy melalui Autentikasi HTTP Basic.
|
||||||
|
|
||||||
|
Anda dapat mengonfigurasi beberapa aturan klien, nama pengguna, dan kata sandi untuk satu Daftar Akses lalu menerapkannya ke satu atau lebih _Host Proxy_.
|
||||||
|
|
||||||
|
Ini paling berguna untuk layanan web yang diteruskan yang tidak memiliki mekanisme autentikasi bawaan atau ketika Anda ingin melindungi dari klien yang tidak dikenal.
|
||||||
32
frontend/src/locale/src/HelpDoc/id/Certificates.md
Normal file
32
frontend/src/locale/src/HelpDoc/id/Certificates.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
## Bantuan Sertifikat
|
||||||
|
|
||||||
|
### Sertifikat HTTP
|
||||||
|
|
||||||
|
Sertifikat yang divalidasi HTTP berarti server Let's Encrypt akan
|
||||||
|
mencoba menjangkau domain Anda melalui HTTP (bukan HTTPS!) dan jika berhasil, mereka
|
||||||
|
akan menerbitkan sertifikat Anda.
|
||||||
|
|
||||||
|
Untuk metode ini, Anda harus membuat _Host Proxy_ untuk domain Anda yang
|
||||||
|
dapat diakses dengan HTTP dan mengarah ke instalasi Nginx ini. Setelah sertifikat
|
||||||
|
diberikan, Anda dapat mengubah _Host Proxy_ agar juga menggunakan sertifikat ini untuk HTTPS
|
||||||
|
koneksi. Namun, _Host Proxy_ tetap perlu dikonfigurasi untuk akses HTTP
|
||||||
|
agar sertifikat dapat diperpanjang.
|
||||||
|
|
||||||
|
Proses ini _tidak_ mendukung domain wildcard.
|
||||||
|
|
||||||
|
### Sertifikat DNS
|
||||||
|
|
||||||
|
Sertifikat yang divalidasi DNS mengharuskan Anda menggunakan plugin Penyedia DNS. Penyedia DNS ini
|
||||||
|
akan digunakan untuk membuat record sementara pada domain Anda dan kemudian Let's
|
||||||
|
Encrypt akan menanyakan record tersebut untuk memastikan Anda pemiliknya dan jika berhasil, mereka
|
||||||
|
akan menerbitkan sertifikat Anda.
|
||||||
|
|
||||||
|
Anda tidak perlu membuat _Host Proxy_ sebelum meminta jenis sertifikat ini.
|
||||||
|
Anda juga tidak perlu mengonfigurasi _Host Proxy_ untuk akses HTTP.
|
||||||
|
|
||||||
|
Proses ini _mendukung_ domain wildcard.
|
||||||
|
|
||||||
|
### Sertifikat Kustom
|
||||||
|
|
||||||
|
Gunakan opsi ini untuk mengunggah Sertifikat SSL Anda sendiri, sebagaimana disediakan oleh
|
||||||
|
Certificate Authority Anda.
|
||||||
10
frontend/src/locale/src/HelpDoc/id/DeadHosts.md
Normal file
10
frontend/src/locale/src/HelpDoc/id/DeadHosts.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## Apa itu Host 404?
|
||||||
|
|
||||||
|
Host 404 adalah konfigurasi host yang menampilkan halaman 404.
|
||||||
|
|
||||||
|
Ini dapat berguna ketika domain Anda terindeks di mesin pencari dan Anda ingin
|
||||||
|
menyediakan halaman error yang lebih baik atau secara khusus memberi tahu pengindeks pencarian bahwa
|
||||||
|
halaman domain tersebut sudah tidak ada.
|
||||||
|
|
||||||
|
Manfaat lain memiliki host ini adalah melacak log untuk akses ke host tersebut dan
|
||||||
|
melihat perujuk.
|
||||||
7
frontend/src/locale/src/HelpDoc/id/ProxyHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/id/ProxyHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Apa itu Host Proxy?
|
||||||
|
|
||||||
|
Host Proxy adalah endpoint masuk untuk layanan web yang ingin Anda teruskan.
|
||||||
|
|
||||||
|
Host ini menyediakan terminasi SSL opsional untuk layanan Anda yang mungkin tidak memiliki dukungan SSL bawaan.
|
||||||
|
|
||||||
|
Host Proxy adalah penggunaan paling umum untuk Nginx Proxy Manager.
|
||||||
5
frontend/src/locale/src/HelpDoc/id/RedirectionHosts.md
Normal file
5
frontend/src/locale/src/HelpDoc/id/RedirectionHosts.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## Apa itu Host Pengalihan?
|
||||||
|
|
||||||
|
Host Pengalihan akan mengalihkan permintaan dari domain masuk dan mengarahkan pengunjung ke domain lain.
|
||||||
|
|
||||||
|
Alasan paling umum menggunakan jenis host ini adalah ketika situs Anda berpindah domain tetapi masih ada tautan mesin pencari atau perujuk yang mengarah ke domain lama.
|
||||||
6
frontend/src/locale/src/HelpDoc/id/Streams.md
Normal file
6
frontend/src/locale/src/HelpDoc/id/Streams.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
## Apa itu Stream?
|
||||||
|
|
||||||
|
Fitur yang relatif baru untuk Nginx, Stream berfungsi untuk meneruskan trafik TCP/UDP
|
||||||
|
langsung ke komputer lain di jaringan.
|
||||||
|
|
||||||
|
Jika Anda menjalankan server game, FTP, atau SSH, ini bisa sangat membantu.
|
||||||
6
frontend/src/locale/src/HelpDoc/id/index.ts
Normal file
6
frontend/src/locale/src/HelpDoc/id/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
@@ -1,33 +1,35 @@
|
|||||||
|
import * as bg from "./bg/index";
|
||||||
import * as de from "./de/index";
|
import * as de from "./de/index";
|
||||||
import * as en from "./en/index";
|
import * as en from "./en/index";
|
||||||
|
import * as es from "./es/index";
|
||||||
|
import * as fr from "./fr/index";
|
||||||
|
import * as ga from "./ga/index";
|
||||||
|
import * as id from "./id/index";
|
||||||
import * as it from "./it/index";
|
import * as it from "./it/index";
|
||||||
import * as ja from "./ja/index";
|
import * as ja from "./ja/index";
|
||||||
|
import * as ko from "./ko/index";
|
||||||
import * as nl from "./nl/index";
|
import * as nl from "./nl/index";
|
||||||
import * as pl from "./pl/index";
|
import * as pl from "./pl/index";
|
||||||
import * as ru from "./ru/index";
|
import * as ru from "./ru/index";
|
||||||
import * as sk from "./sk/index";
|
import * as sk from "./sk/index";
|
||||||
import * as vi from "./vi/index";
|
import * as vi from "./vi/index";
|
||||||
import * as zh from "./zh/index";
|
import * as zh from "./zh/index";
|
||||||
|
import * as tr from "./tr/index";
|
||||||
|
import * as hu from "./hu/index";
|
||||||
|
|
||||||
const items: any = { en, de, ja, sk, zh, pl, ru, it, vi, nl };
|
const items: any = { en, de, es, ja, sk, zh, pl, ru, it, vi, nl, bg, ko, ga, id, fr, tr, hu };
|
||||||
|
|
||||||
const fallbackLang = "en";
|
const fallbackLang = "en";
|
||||||
|
|
||||||
export const getHelpFile = (lang: string, section: string): string => {
|
export const getHelpFile = (lang: string, section: string): string => {
|
||||||
if (
|
if (typeof items[lang] !== "undefined" && typeof items[lang][section] !== "undefined") {
|
||||||
typeof items[lang] !== "undefined" &&
|
return items[lang][section].default;
|
||||||
typeof items[lang][section] !== "undefined"
|
}
|
||||||
) {
|
// Fallback to English
|
||||||
return items[lang][section].default;
|
if (typeof items[fallbackLang] !== "undefined" && typeof items[fallbackLang][section] !== "undefined") {
|
||||||
}
|
return items[fallbackLang][section].default;
|
||||||
// Fallback to English
|
}
|
||||||
if (
|
throw new Error(`Cannot load help doc for ${lang}-${section}`);
|
||||||
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;
|
export default items;
|
||||||
|
|||||||
11
frontend/src/locale/src/HelpDoc/ko/AccessLists.md
Normal file
11
frontend/src/locale/src/HelpDoc/ko/AccessLists.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
## 접근 정책이란?
|
||||||
|
|
||||||
|
접근 정책은 특정 클라이언트 IP 주소를 허용하거나 거부할 수 있으며,
|
||||||
|
프록시 호스트에 기본 HTTP 인증(Basic Auth) 을 적용할 수 있는 기능입니다.
|
||||||
|
|
||||||
|
하나의 접근 목록에 여러 클라이언트 규칙과 사용자 이름, 비밀번호를 추가한 뒤
|
||||||
|
이를 하나 이상의 프록시 호스트에 적용할 수 있습니다.
|
||||||
|
|
||||||
|
이 기능은 인증 기능이 없는 웹 서비스에 인증을 추가하거나,
|
||||||
|
알 수 없는 클라이언트로부터 서비스를 보호할 때 유용합니다.
|
||||||
|
|
||||||
28
frontend/src/locale/src/HelpDoc/ko/Certificates.md
Normal file
28
frontend/src/locale/src/HelpDoc/ko/Certificates.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
## 인증서 도움말
|
||||||
|
|
||||||
|
### HTTP 인증서
|
||||||
|
|
||||||
|
HTTP 검증 방식의 인증서는 Let's Encrypt 서버가 **HTTPS가 아닌 HTTP로** 해당 도메인에 접속을 시도해 응답이 확인되면 인증서를 발급하는 방식입니다.
|
||||||
|
|
||||||
|
이 방식을 사용하려면 도메인에 대한 **프록시 호스트가 미리 생성되어 있어야 하며**, HTTP로 접근할 수 있어야 하고 Nginx Proxy Manager가 설치된 서버를 가리켜야 합니다. 인증서가 발급된 이후에는 해당 프록시 호스트에 HTTPS용 인증서를 적용할 수 있습니다.
|
||||||
|
|
||||||
|
다만, **인증서 자동 갱신을 위해서는 HTTP 접근이 계속 필요합니다.**
|
||||||
|
|
||||||
|
이 방식은 **와일드카드 도메인을 지원하지 않습니다.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### DNS 인증서
|
||||||
|
|
||||||
|
DNS 검증 방식의 인증서는 DNS 공급자 플러그인을 사용해야 합니다. 이 플러그인은 도메인에 임시 DNS 레코드를 생성하며, Let's Encrypt는 해당 레코드를 조회해 도메인 소유 여부를 확인합니다. 검증이 성공하면 인증서가 발급됩니다.
|
||||||
|
|
||||||
|
이 방식은 인증서를 요청하기 전에 **프록시 호스트를 생성할 필요가 없으며**, 프록시 호스트에 HTTP 접근을 설정할 필요도 없습니다.
|
||||||
|
|
||||||
|
이 방식은 **와일드카드 도메인을 지원합니다.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 사용자 지정 인증서
|
||||||
|
|
||||||
|
이 옵션을 사용하면 직접 보유한 인증 기관(CA)에서 발급한 SSL 인증서를 직접 업로드하여 사용할 수 있습니다.
|
||||||
|
|
||||||
10
frontend/src/locale/src/HelpDoc/ko/DeadHosts.md
Normal file
10
frontend/src/locale/src/HelpDoc/ko/DeadHosts.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## 404 호스트란?
|
||||||
|
|
||||||
|
404 호스트는 404 오류 페이지를 표시하도록 구성된 호스트입니다.
|
||||||
|
|
||||||
|
이 기능은 도메인이 검색 엔진에 이미 색인되어 있을 때,
|
||||||
|
더 깔끔한 오류 페이지를 제공하거나 해당 페이지가 더 이상 존재하지 않음을
|
||||||
|
검색 엔진에게 명확하게 알려야 할 때 유용합니다.
|
||||||
|
|
||||||
|
또한 404 호스트를 사용하면 접근 로그를 확인하고, 어떤 경로(Referrer)를 통해 들어왔는지 추적할 수 있다는 장점도 있습니다.
|
||||||
|
|
||||||
8
frontend/src/locale/src/HelpDoc/ko/ProxyHosts.md
Normal file
8
frontend/src/locale/src/HelpDoc/ko/ProxyHosts.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
## 프록시 호스트란?
|
||||||
|
|
||||||
|
프록시 호스트는 외부에서 들어오는 웹 요청을 받아 지정한 전달 대상으로 전달하는 역할을 합니다.
|
||||||
|
|
||||||
|
원래 SSL을 지원하지 않는 대상이라도, 프록시 호스트를 통해 SSL(HTTPS) 연결을 적용할 수 있습니다.
|
||||||
|
|
||||||
|
프록시 호스트는 Nginx Proxy Manager에서 가장 일반적으로 사용되는 기능입니다.
|
||||||
|
|
||||||
7
frontend/src/locale/src/HelpDoc/ko/RedirectionHosts.md
Normal file
7
frontend/src/locale/src/HelpDoc/ko/RedirectionHosts.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## 리다이렉션 호스트란?
|
||||||
|
|
||||||
|
리다이렉션 호스트는 외부에서 들어오는 도메인 요청을 다른 도메인으로 자동 이동(리다이렉트)시키는 역할을 합니다.
|
||||||
|
|
||||||
|
이 유형의 호스트는 주로 웹사이트의 도메인이 변경되었지만,
|
||||||
|
검색 엔진이나 다른 사이트에 이전 도메인 링크가 남아 있을 때 사용하면 가장 효과적입니다.
|
||||||
|
|
||||||
7
frontend/src/locale/src/HelpDoc/ko/Streams.md
Normal file
7
frontend/src/locale/src/HelpDoc/ko/Streams.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## 호스트 스트림이란?
|
||||||
|
|
||||||
|
호스트 스트림은 비교적 최근에 Nginx에 추가된 기능으로,
|
||||||
|
TCP/UDP 트래픽을 네트워크 내의 다른 컴퓨터로 직접 전달하는 데 사용됩니다.
|
||||||
|
|
||||||
|
게임 서버나 FTP, SSH 서버 등을 운영할 때 유용하게 사용할 수 있습니다.
|
||||||
|
|
||||||
7
frontend/src/locale/src/HelpDoc/ko/index.ts
Normal file
7
frontend/src/locale/src/HelpDoc/ko/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export * as AccessLists from "./AccessLists.md";
|
||||||
|
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";
|
||||||
|
|
||||||
8
frontend/src/locale/src/HelpDoc/tr/AccessLists.md
Normal file
8
frontend/src/locale/src/HelpDoc/tr/AccessLists.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
## Erişim Listesi Nedir?
|
||||||
|
|
||||||
|
Erişim Listeleri, Temel HTTP Kimlik Doğrulama aracılığıyla Proxy Host'lar için belirli istemci IP adreslerinin kara listesi veya beyaz listesini ve kimlik doğrulamasını sağlar.
|
||||||
|
|
||||||
|
Tek bir Erişim Listesi için birden fazla istemci kuralı, kullanıcı adı ve şifre yapılandırabilir ve bunu bir veya daha fazla _Proxy Host_'a uygulayabilirsiniz.
|
||||||
|
|
||||||
|
Bu, yerleşik kimlik doğrulama mekanizmaları olmayan veya bilinmeyen istemcilerden korunmak istediğinizde iletilen web hizmetleri için en kullanışlıdır.
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user