diff --git a/assets/screenshot.png b/assets/screenshot.png index 6f87a64..c5b73cc 100644 Binary files a/assets/screenshot.png and b/assets/screenshot.png differ diff --git a/src/lib/Server.js b/src/lib/Server.js index 315679c..40341ee 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -265,23 +265,6 @@ module.exports = class Server { }); }; - // import_export - const router3 = createRouter(); - app.use(router3); - - router3 - .get('/api/wireguard/backup', defineEventHandler(async (event) => { - const config = await WireGuard.backupConfiguration(); - setHeader(event, 'Content-Disposition', 'attachment; filename="wg0.json"'); - setHeader(event, 'Content-Type', 'text/json'); - return config; - })) - .put('/api/wireguard/restore', defineEventHandler(async (event) => { - const { file } = await readBody(event); - await WireGuard.restoreConfiguration(file); - return { success: true }; - })); - // Static assets const publicDir = '/app/www'; app.use( @@ -293,7 +276,7 @@ module.exports = class Server { getMeta: async (id) => { const filePath = safePathJoin(publicDir, id); - const stats = await stat(filePath).catch(() => { }); + const stats = await stat(filePath).catch(() => {}); if (!stats || !stats.isFile()) { return; } diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 215d0d5..d4f32c5 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -319,22 +319,6 @@ Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; await this.saveConfig(); } - async ___forceRestart() { - this.__configPromise = null; - await this.saveConfig(); - } - - async restoreConfiguration(config) { - const _config = JSON.parse(config); - await this.__saveConfig(_config); - await this.___forceRestart(); - } - - async backupConfiguration() { - const config = await this.getConfig(); - return JSON.stringify(config, null, 2); - } - // Shutdown wireguard async Shutdown() { await Util.exec('wg-quick down wg0').catch(() => { }); diff --git a/src/www/index.html b/src/www/index.html index 4c32ae0..7204472 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -3,7 +3,7 @@ WireGuard - + @@ -23,50 +23,45 @@

- WireGuard + WireGuard

-
- - - - - - - - - {{$t("backup")}} - -