Browse Source

update comments

pull/1397/head
Bernd Storath 9 months ago
parent
commit
2b8b300c3c
  1. 1
      src/app/pages/login.vue
  2. 9
      src/server/utils/WireGuard.ts
  3. 4
      src/server/utils/release.ts
  4. 2
      src/server/utils/wgHelper.ts
  5. 1
      src/services/database/migrations/1.ts

1
src/app/pages/login.vue

@ -102,6 +102,7 @@ type SetupError = {
const setupError = ref<null | SetupError>(null);
// TODO: check if needed
watch(setupError, (value) => {
if (value) {
setTimeout(() => {

9
src/server/utils/WireGuard.ts

@ -10,11 +10,17 @@ import { isIPv4 } from 'is-ip';
const DEBUG = debug('WireGuard');
class WireGuard {
/**
* Save and sync config
*/
async saveConfig() {
await this.#saveWireguardConfig();
await this.#syncWireguardConfig();
}
/**
* Generates and saves WireGuard config from database as wg0
*/
async #saveWireguardConfig() {
const system = await Database.system.get();
const clients = await Database.client.findAll();
@ -300,6 +306,8 @@ class WireGuard {
DEBUG('Cron Job started successfully.');
}
// TODO: handle as worker_thread
// would need a better database aswell
async startCronJob() {
await this.cronJob().catch((err) => {
DEBUG('Running Cron Job failed.');
@ -343,6 +351,7 @@ class WireGuard {
}
}
}
await this.saveConfig();
}
async getMetrics() {

4
src/server/utils/release.ts

@ -49,4 +49,8 @@ async function fetchLatestRelease() {
}
}
/**
* Fetch latest release from GitHub
* @cache Response is cached for 1 hour
*/
export const cachedFetchLatestRelease = cacheFunction(fetchLatestRelease);

2
src/server/utils/wgHelper.ts

@ -3,6 +3,8 @@ import type { DeepReadonly } from 'vue';
import type { Client } from '~~/services/database/repositories/client';
import type { System } from '~~/services/database/repositories/system';
// TODO: replace wg0 with parameter (to allow multi interface design)
export const wg = {
generateServerPeer: (client: DeepReadonly<Client>) => {
const allowedIps = [

1
src/services/database/migrations/1.ts

@ -39,7 +39,6 @@ export async function run1(db: Low<Database>) {
address6Range: address6Range,
defaultDns: ['1.1.1.1', '2606:4700:4700::1111'],
allowedIps: ['0.0.0.0/0', '::/0'],
// TODO: host has to be configured when onboarding
host: '',
port: 51820,
},

Loading…
Cancel
Save