Revert "import & export configuration"

This commit is contained in:
Philip H
2024-07-10 12:44:59 +02:00
committed by GitHub
parent 8b2706e3c2
commit abdf96011e
7 changed files with 37 additions and 149 deletions

View File

@@ -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;
}