diff --git a/src/lib/Server.js b/src/lib/Server.js index 54fc192..22d3946 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -345,10 +345,6 @@ module.exports = class Server { }); }; - // Prometheus Metrics API - const routerPrometheusMetrics = createRouter(); - app.use(routerPrometheusMetrics); - // Check Prometheus credentials app.use( fromNodeMiddleware((req, res, next) => { @@ -356,11 +352,10 @@ module.exports = class Server { return next(); } const user = basicAuth(req); - if (requiresPrometheusPassword && !user) { + if (!user) { res.statusCode = 401; return { error: 'Not Logged In' }; } - if (user.pass) { if (isPasswordValid(user.pass, PROMETHEUS_METRICS_PASSWORD)) { return next(); @@ -373,6 +368,10 @@ module.exports = class Server { }), ); + // Prometheus Metrics API + const routerPrometheusMetrics = createRouter(); + app.use(routerPrometheusMetrics); + // Prometheus Routes routerPrometheusMetrics .get('/metrics', defineEventHandler(async (event) => { diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 7973d52..6ebc45d 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -357,8 +357,8 @@ Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; async eraseOneTimeLink({ clientId }) { const client = await this.getClient({ clientId }); - client.oneTimeLink = null; - client.oneTimeLinkExpiresAt = null; + // client.oneTimeLink = null; + client.oneTimeLinkExpiresAt = new Date(Date.now() + 10 * 1000); client.updatedAt = new Date(); await this.saveConfig(); } diff --git a/src/www/js/i18n.js b/src/www/js/i18n.js index 5f3d64d..b74c30a 100644 --- a/src/www/js/i18n.js +++ b/src/www/js/i18n.js @@ -496,10 +496,23 @@ const messages = { // eslint-disable-line no-unused-vars disableClient: '禁用客户端', enableClient: '启用客户端', noClients: '目前没有客户端。', + noPrivKey: '此客户端没有已知的私钥。无法创建配置。', showQR: '显示二维码', downloadConfig: '下载配置', madeBy: '由', donate: '捐赠', + toggleCharts: '显示/隐藏图表', + theme: { dark: '暗黑主题', light: '明亮主题', auto: '自动主题' }, + restore: '恢复', + backup: '备份', + titleRestoreConfig: '恢复您的配置', + titleBackupConfig: '备份您的配置', + rememberMe: '记住我', + titleRememberMe: '关闭浏览器后保持登录', + sort: '排序', + ExpireDate: '到期日期', + Permanent: '永久', + OneTimeLink: '生成一次性短链接', }, cht: { name: '名字', @@ -523,10 +536,23 @@ const messages = { // eslint-disable-line no-unused-vars disableClient: '停用使用者', enableClient: '啟用使用者', noClients: '目前沒有使用者。', + noPrivKey: '此使用者沒有已知的私鑰。無法創建配置。', showQR: '顯示 QR Code', downloadConfig: '下載 Config 檔', madeBy: '由', donate: '抖內', + toggleCharts: '顯示/隱藏圖表', + theme: { dark: '暗黑主題', light: '明亮主題', auto: '自動主題' }, + restore: '恢復', + backup: '備份', + titleRestoreConfig: '恢復您的配置', + titleBackupConfig: '備份您的配置', + rememberMe: '記住我', + titleRememberMe: '關閉瀏覽器後保持登錄', + sort: '排序', + ExpireDate: '到期日期', + Permanent: '永久', + OneTimeLink: '生成一次性短鏈接', }, it: { name: 'Nome',