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