forked from mirrors/amnezia-wg-easy
		
	Revert "import & export configuration"
This commit is contained in:
		
							parent
							
								
									8b2706e3c2
								
							
						
					
					
						commit
						abdf96011e
					
				
					 7 changed files with 37 additions and 149 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 105 KiB  | 
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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(() => { });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
<head>
 | 
			
		||||
  <title>WireGuard</title>
 | 
			
		||||
  <meta charset="utf-8" />
 | 
			
		||||
  <meta charset="utf-8"/>
 | 
			
		||||
  <link href="./css/app.css" rel="stylesheet">
 | 
			
		||||
  <link rel="manifest" href="./manifest.json">
 | 
			
		||||
  <link rel="icon" type="image/png" href="./img/favicon.png">
 | 
			
		||||
| 
						 | 
				
			
			@ -23,50 +23,45 @@
 | 
			
		|||
      <div v-if="authenticated === true">
 | 
			
		||||
        <div class="flex flex-col-reverse xxs:flex-row flex-auto items-center items-end gap-3">
 | 
			
		||||
          <h1 class="text-4xl dark:text-neutral-200 font-medium flex-grow self-start mb-4">
 | 
			
		||||
            <img src="./img/logo.png" width="32" class="inline align-middle dark:bg mr-2" /><span
 | 
			
		||||
              class="align-middle">WireGuard</span>
 | 
			
		||||
            <img src="./img/logo.png" width="32" class="inline align-middle dark:bg mr-2" /><span class="align-middle">WireGuard</span>
 | 
			
		||||
          </h1>
 | 
			
		||||
          <div class="flex items-center grow-0 gap-3 items-end self-end xxs:self-center">
 | 
			
		||||
            <!-- Dark / light theme -->
 | 
			
		||||
            <button @click="toggleTheme"
 | 
			
		||||
              class="flex items-center justify-center w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 transition"
 | 
			
		||||
              :title="$t(`theme.${uiTheme}`)">
 | 
			
		||||
              <svg v-if="uiTheme === 'light'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
                stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
 | 
			
		||||
              class="flex items-center justify-center w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 transition" :title="$t(`theme.${uiTheme}`)">
 | 
			
		||||
              <svg v-if="uiTheme === 'light'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
 | 
			
		||||
                class="w-5 h-5">
 | 
			
		||||
                <path stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                  d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" />
 | 
			
		||||
              </svg>
 | 
			
		||||
              <svg v-else-if="uiTheme === 'dark'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
                stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-neutral-400">
 | 
			
		||||
              <svg v-else-if="uiTheme === 'dark'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
 | 
			
		||||
                class="w-5 h-5 text-neutral-400">
 | 
			
		||||
                <path stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                  d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z" />
 | 
			
		||||
              </svg>
 | 
			
		||||
              <svg v-else xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"
 | 
			
		||||
              <svg v-else xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" 
 | 
			
		||||
                class="w-5 h-5 fill-gray-600 dark:fill-neutral-400">
 | 
			
		||||
                <path
 | 
			
		||||
                  d="M12,2.2c-5.4,0-9.8,4.4-9.8,9.8s4.4,9.8,9.8,9.8s9.8-4.4,9.8-9.8S17.4,2.2,12,2.2z M3.8,12c0-4.5,3.7-8.2,8.2-8.2v16.5C7.5,20.2,3.8,16.5,3.8,12z" />
 | 
			
		||||
              </svg>
 | 
			
		||||
              <path stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" />
 | 
			
		||||
                <path stroke-linecap="round" stroke-linejoin="round"
 | 
			
		||||
                  d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" />
 | 
			
		||||
              </svg>
 | 
			
		||||
            </button>
 | 
			
		||||
            <!-- Show / hide charts -->
 | 
			
		||||
            <label v-if="uiChartType > 0"
 | 
			
		||||
              class="inline-flex items-center justify-center cursor-pointer w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 whitespace-nowrap transition group"
 | 
			
		||||
              :title="$t('toggleCharts')">
 | 
			
		||||
            <label v-if="uiChartType > 0" class="inline-flex items-center justify-center cursor-pointer w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 whitespace-nowrap transition group" :title="$t('toggleCharts')">
 | 
			
		||||
              <input type="checkbox" value="" class="sr-only peer" v-model="uiShowCharts" @change="toggleCharts">
 | 
			
		||||
              <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
 | 
			
		||||
                fill="currentColor"
 | 
			
		||||
              <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" fill="currentColor"
 | 
			
		||||
                class="w-5 h-5 peer fill-gray-400 peer-checked:fill-gray-600 dark:fill-neutral-600 peer-checked:dark:fill-neutral-400 group-hover:dark:fill-neutral-500 transition">
 | 
			
		||||
                <path
 | 
			
		||||
                  d="M18.375 2.25c-1.035 0-1.875.84-1.875 1.875v15.75c0 1.035.84 1.875 1.875 1.875h.75c1.035 0 1.875-.84 1.875-1.875V4.125c0-1.036-.84-1.875-1.875-1.875h-.75ZM9.75 8.625c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-.75a1.875 1.875 0 0 1-1.875-1.875V8.625ZM3 13.125c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v6.75c0 1.035-.84 1.875-1.875 1.875h-.75A1.875 1.875 0 0 1 3 19.875v-6.75Z" />
 | 
			
		||||
                  <path
 | 
			
		||||
                    d="M18.375 2.25c-1.035 0-1.875.84-1.875 1.875v15.75c0 1.035.84 1.875 1.875 1.875h.75c1.035 0 1.875-.84 1.875-1.875V4.125c0-1.036-.84-1.875-1.875-1.875h-.75ZM9.75 8.625c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-.75a1.875 1.875 0 0 1-1.875-1.875V8.625ZM3 13.125c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v6.75c0 1.035-.84 1.875-1.875 1.875h-.75A1.875 1.875 0 0 1 3 19.875v-6.75Z" />
 | 
			
		||||
              </svg>
 | 
			
		||||
            </label>
 | 
			
		||||
            <span v-if="requiresPassword"
 | 
			
		||||
              class="text-sm text-gray-400 dark:text-neutral-400 cursor-pointer hover:underline" @click="logout">
 | 
			
		||||
              class="text-sm text-gray-400 dark:text-neutral-400 cursor-pointer hover:underline"
 | 
			
		||||
              @click="logout">
 | 
			
		||||
              {{$t("logout")}}
 | 
			
		||||
              <svg class="h-3 inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
                stroke="currentColor">
 | 
			
		||||
              <svg class="h-3 inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
 | 
			
		||||
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
 | 
			
		||||
                  d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
 | 
			
		||||
              </svg>
 | 
			
		||||
| 
						 | 
				
			
			@ -96,32 +91,6 @@
 | 
			
		|||
              <p class="text-2xl font-medium dark:text-neutral-200">{{$t("clients")}}</p>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="flex-shrink-0">
 | 
			
		||||
              <!-- Restore configuration -->
 | 
			
		||||
              <label for="inputRC" :title="$t('titleRestoreConfig')"
 | 
			
		||||
                class="hover:bg-red-800 hover:border-red-800 hover:text-white text-gray-700 dark:text-neutral-200 border-2 border-gray-100 dark:border-neutral-600 py-2 px-4 rounded inline-flex items-center transition">
 | 
			
		||||
                <svg inline class="w-4 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"
 | 
			
		||||
                  stroke="currentColor">
 | 
			
		||||
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
 | 
			
		||||
                    d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41m-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9" />
 | 
			
		||||
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill-rule="evenodd"
 | 
			
		||||
                    d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5 5 0 0 0 8 3M3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9z" />
 | 
			
		||||
                </svg>
 | 
			
		||||
                <span class="text-sm">{{$t("restore")}}</span>
 | 
			
		||||
                <input id="inputRC" type="file" name="configurationfile" accept="text/*,.json" @change="restoreConfig"
 | 
			
		||||
                  class="hidden -z-[1]" />
 | 
			
		||||
              </label>
 | 
			
		||||
              <!-- Backup configuration -->
 | 
			
		||||
              <a href="./api/wireguard/backup" :title="$t('titleBackupConfig')"
 | 
			
		||||
                class="hover:bg-red-800 hover:border-red-800 hover:text-white text-gray-700 dark:text-neutral-200 border-2 border-gray-100 dark:border-neutral-600 py-2 px-4 rounded inline-flex items-center transition">
 | 
			
		||||
                <svg inline class="w-4 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"
 | 
			
		||||
                  stroke="currentColor">
 | 
			
		||||
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 2H9v3h2z" />
 | 
			
		||||
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
 | 
			
		||||
                    d="M1.5 0h11.586a1.5 1.5 0 0 1 1.06.44l1.415 1.414A1.5 1.5 0 0 1 16 2.914V14.5a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 14.5v-13A1.5 1.5 0 0 1 1.5 0M1 1.5v13a.5.5 0 0 0 .5.5H2v-4.5A1.5 1.5 0 0 1 3.5 9h9a1.5 1.5 0 0 1 1.5 1.5V15h.5a.5.5 0 0 0 .5-.5V2.914a.5.5 0 0 0-.146-.353l-1.415-1.415A.5.5 0 0 0 13.086 1H13v4.5A1.5 1.5 0 0 1 11.5 7h-7A1.5 1.5 0 0 1 3 5.5V1H1.5a.5.5 0 0 0-.5.5m3 4a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5V1H4zM3 15h10v-4.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5z" />
 | 
			
		||||
                </svg>
 | 
			
		||||
                <span class="text-sm">{{$t("backup")}}</span>
 | 
			
		||||
              </a>
 | 
			
		||||
              <!-- New client -->
 | 
			
		||||
              <button @click="clientCreate = true; clientCreateName = '';"
 | 
			
		||||
                class="hover:bg-red-800 hover:border-red-800 hover:text-white text-gray-700 dark:text-neutral-200 border-2 border-gray-100 dark:border-neutral-600 py-2 px-4 rounded inline-flex items-center transition">
 | 
			
		||||
                <svg class="w-4 mr-2" inline xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
| 
						 | 
				
			
			@ -140,11 +109,11 @@
 | 
			
		|||
              class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid">
 | 
			
		||||
 | 
			
		||||
              <!-- Chart -->
 | 
			
		||||
              <div v-if="uiChartType" class="absolute z-0 bottom-0 left-0 right-0 h-6">
 | 
			
		||||
              <div v-if="uiChartType" class="absolute z-0 bottom-0 left-0 right-0 h-6" >
 | 
			
		||||
                <apexchart width="100%" height="100%" :options="chartOptionsTX" :series="client.transferTxSeries">
 | 
			
		||||
                </apexchart>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div v-if="uiChartType" class="absolute z-0 top-0 left-0 right-0 h-6">
 | 
			
		||||
              <div v-if="uiChartType" class="absolute z-0 top-0 left-0 right-0 h-6" >
 | 
			
		||||
                <apexchart width="100%" height="100%" :options="chartOptionsRX" :series="client.transferRxSeries"
 | 
			
		||||
                  style="transform: scaleY(-1);">
 | 
			
		||||
                </apexchart>
 | 
			
		||||
| 
						 | 
				
			
			@ -225,24 +194,20 @@
 | 
			
		|||
                          </span>
 | 
			
		||||
                        </span>
 | 
			
		||||
                        <!-- Inline Transfer TX -->
 | 
			
		||||
                        <span v-if="!uiTrafficStats && client.transferTx" class="whitespace-nowrap"
 | 
			
		||||
                          :title="$t('totalDownload') + bytes(client.transferTx)">
 | 
			
		||||
                        <span v-if="!uiTrafficStats && client.transferTx" class="whitespace-nowrap" :title="$t('totalDownload') + bytes(client.transferTx)">
 | 
			
		||||
                          ·
 | 
			
		||||
                          <svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
 | 
			
		||||
                            fill="currentColor">
 | 
			
		||||
                          <svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
 | 
			
		||||
                            <path fill-rule="evenodd"
 | 
			
		||||
                              d="M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z"
 | 
			
		||||
                              clip-rule="evenodd" />
 | 
			
		||||
                          </svg>
 | 
			
		||||
                          {{client.transferTxCurrent | bytes}}/s
 | 
			
		||||
                        </span>
 | 
			
		||||
 | 
			
		||||
                        
 | 
			
		||||
                        <!-- Inline Transfer RX -->
 | 
			
		||||
                        <span v-if="!uiTrafficStats && client.transferRx" class="whitespace-nowrap"
 | 
			
		||||
                          :title="$t('totalUpload') + bytes(client.transferRx)">
 | 
			
		||||
                        <span v-if="!uiTrafficStats && client.transferRx" class="whitespace-nowrap" :title="$t('totalUpload') + bytes(client.transferRx)">
 | 
			
		||||
                          ·
 | 
			
		||||
                          <svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
 | 
			
		||||
                            fill="currentColor">
 | 
			
		||||
                          <svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
 | 
			
		||||
                            <path fill-rule="evenodd"
 | 
			
		||||
                              d="M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z"
 | 
			
		||||
                              clip-rule="evenodd" />
 | 
			
		||||
| 
						 | 
				
			
			@ -250,8 +215,7 @@
 | 
			
		|||
                          {{client.transferRxCurrent | bytes}}/s
 | 
			
		||||
                        </span>
 | 
			
		||||
                        <!-- Last seen -->
 | 
			
		||||
                        <span class="text-gray-400 dark:text-neutral-500 whitespace-nowrap"
 | 
			
		||||
                          v-if="client.latestHandshakeAt"
 | 
			
		||||
                        <span class="text-gray-400 dark:text-neutral-500 whitespace-nowrap" v-if="client.latestHandshakeAt"
 | 
			
		||||
                          :title="$t('lastSeen') + dateTime(new Date(client.latestHandshakeAt))">
 | 
			
		||||
                          {{!uiTrafficStats ? " · " : ""}}{{new Date(client.latestHandshakeAt) | timeago}}
 | 
			
		||||
                        </span>
 | 
			
		||||
| 
						 | 
				
			
			@ -327,7 +291,8 @@
 | 
			
		|||
                      :class="{
 | 
			
		||||
                        'hover:bg-red-800 dark:hover:bg-red-800 hover:text-white dark:hover:text-white': client.downloadableConfig,
 | 
			
		||||
                        'is-disabled': !client.downloadableConfig
 | 
			
		||||
                      }" :title="!client.downloadableConfig ? $t('noPrivKey') : $t('showQR')"
 | 
			
		||||
                      }"
 | 
			
		||||
                      :title="!client.downloadableConfig ? $t('noPrivKey') : $t('showQR')"
 | 
			
		||||
                      @click="qrcode = `./api/wireguard/client/${client.id}/qrcode.svg`">
 | 
			
		||||
                      <svg class="w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
                        stroke="currentColor">
 | 
			
		||||
| 
						 | 
				
			
			@ -344,7 +309,8 @@
 | 
			
		|||
                      :class="{
 | 
			
		||||
                        'hover:bg-red-800 dark:hover:bg-red-800 hover:text-white dark:hover:text-white': client.downloadableConfig,
 | 
			
		||||
                        'is-disabled': !client.downloadableConfig
 | 
			
		||||
                      }" :title="!client.downloadableConfig ? $t('noPrivKey') : $t('downloadConfig')"
 | 
			
		||||
                      }"
 | 
			
		||||
                      :title="!client.downloadableConfig ? $t('noPrivKey') : $t('downloadConfig')"
 | 
			
		||||
                      @click="if(!client.downloadableConfig) { $event.preventDefault(); }">
 | 
			
		||||
                      <svg class="w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
 | 
			
		||||
                        stroke="currentColor">
 | 
			
		||||
| 
						 | 
				
			
			@ -448,8 +414,8 @@
 | 
			
		|||
                <div class="sm:flex sm:items-start">
 | 
			
		||||
                  <div
 | 
			
		||||
                    class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-800 sm:mx-0 sm:h-10 sm:w-10">
 | 
			
		||||
                    <svg class="h-6 w-6 text-white" inline xmlns="http://www.w3.org/2000/svg" fill="none"
 | 
			
		||||
                      viewBox="0 0 24 24" stroke="currentColor">
 | 
			
		||||
                    <svg class="h-6 w-6 text-white" inline xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
                      fill="none" viewBox="0 0 24 24" stroke="currentColor">
 | 
			
		||||
                      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
 | 
			
		||||
                        d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
 | 
			
		||||
                    </svg>
 | 
			
		||||
| 
						 | 
				
			
			@ -566,8 +532,8 @@
 | 
			
		|||
          class="shadow rounded-md bg-white dark:bg-neutral-700 mx-auto w-64 p-5 overflow-hidden mt-10">
 | 
			
		||||
          <!-- Avatar -->
 | 
			
		||||
          <div class="h-20 w-20 mb-10 mt-5 mx-auto rounded-full bg-red-800 dark:bg-red-800 relative overflow-hidden">
 | 
			
		||||
            <svg class="w-10 h-10 m-5 text-white dark:text-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
 | 
			
		||||
              fill="currentColor">
 | 
			
		||||
            <svg class="w-10 h-10 m-5 text-white dark:text-white" xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
              viewBox="0 0 20 20" fill="currentColor">
 | 
			
		||||
              <path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd" />
 | 
			
		||||
            </svg>
 | 
			
		||||
          </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -608,10 +574,9 @@
 | 
			
		|||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <p v-cloak class="text-center m-10 text-gray-300 dark:text-neutral-600 text-xs"> <a class="hover:underline"
 | 
			
		||||
        target="_blank" href="https://github.com/wg-easy/wg-easy">WireGuard Easy</a> © 2021-2024 by <a
 | 
			
		||||
        class="hover:underline" target="_blank" href="https://emilenijssen.nl/?ref=wg-easy">Emile Nijssen</a> is
 | 
			
		||||
      licensed under <a class="hover:underline" target="_blank"
 | 
			
		||||
    <p v-cloak class="text-center m-10 text-gray-300 dark:text-neutral-600 text-xs"> <a class="hover:underline" target="_blank"
 | 
			
		||||
        href="https://github.com/wg-easy/wg-easy">WireGuard Easy</a> © 2021-2024 by <a class="hover:underline" target="_blank"
 | 
			
		||||
        href="https://emilenijssen.nl/?ref=wg-easy">Emile Nijssen</a> is licensed under <a class="hover:underline" target="_blank"
 | 
			
		||||
        href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> · <a class="hover:underline"
 | 
			
		||||
        href="https://github.com/sponsors/WeeJeWel" target="_blank">{{$t("donate")}}</a></p>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,12 +138,4 @@ class API {
 | 
			
		|||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async restoreConfiguration(file) {
 | 
			
		||||
    return this.call({
 | 
			
		||||
      method: 'put',
 | 
			
		||||
      path: '/wireguard/restore',
 | 
			
		||||
      body: { file },
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -299,22 +299,6 @@ new Vue({
 | 
			
		|||
        .catch((err) => alert(err.message || err.toString()))
 | 
			
		||||
        .finally(() => this.refresh().catch(console.error));
 | 
			
		||||
    },
 | 
			
		||||
    restoreConfig(e) {
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      const file = e.currentTarget.files.item(0);
 | 
			
		||||
      if (file) {
 | 
			
		||||
        file.text()
 | 
			
		||||
          .then((content) => {
 | 
			
		||||
            this.api.restoreConfiguration(content)
 | 
			
		||||
              .then((_result) => alert('The configuration was updated.'))
 | 
			
		||||
              .catch((err) => alert(err.message || err.toString()))
 | 
			
		||||
              .finally(() => this.refresh().catch(console.error));
 | 
			
		||||
          })
 | 
			
		||||
          .catch((err) => alert(err.message || err.toString()));
 | 
			
		||||
      } else {
 | 
			
		||||
        alert('Failed to load your file!');
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    toggleTheme() {
 | 
			
		||||
      const themes = ['light', 'dark', 'auto'];
 | 
			
		||||
      const currentIndex = themes.indexOf(this.uiTheme);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,10 +30,6 @@ const messages = { // eslint-disable-line no-unused-vars
 | 
			
		|||
    donate: 'Donate',
 | 
			
		||||
    toggleCharts: 'Show/hide Charts',
 | 
			
		||||
    theme: { dark: 'Dark theme', light: 'Light theme', auto: 'Auto theme' },
 | 
			
		||||
    restore: 'Restore',
 | 
			
		||||
    backup: 'Backup',
 | 
			
		||||
    titleRestoreConfig: 'Restore your configuration',
 | 
			
		||||
    titleBackupConfig: 'Backup your configuration',
 | 
			
		||||
  },
 | 
			
		||||
  ua: {
 | 
			
		||||
    name: 'Ім`я',
 | 
			
		||||
| 
						 | 
				
			
			@ -197,10 +193,6 @@ const messages = { // eslint-disable-line no-unused-vars
 | 
			
		|||
    downloadConfig: 'Télécharger la configuration',
 | 
			
		||||
    madeBy: 'Développé par',
 | 
			
		||||
    donate: 'Soutenir',
 | 
			
		||||
    restore: 'Restaurer',
 | 
			
		||||
    backup: 'Sauvegarder',
 | 
			
		||||
    titleRestoreConfig: 'Restaurer votre configuration',
 | 
			
		||||
    titleBackupConfig: 'Sauvegarder votre configuration',
 | 
			
		||||
  },
 | 
			
		||||
  de: { // github.com/florian-asche
 | 
			
		||||
    name: 'Name',
 | 
			
		||||
| 
						 | 
				
			
			@ -229,10 +221,6 @@ const messages = { // eslint-disable-line no-unused-vars
 | 
			
		|||
    downloadConfig: 'Konfiguration herunterladen',
 | 
			
		||||
    madeBy: 'Erstellt von',
 | 
			
		||||
    donate: 'Spenden',
 | 
			
		||||
    restore: 'Wiederherstellen',
 | 
			
		||||
    backup: 'Sichern',
 | 
			
		||||
    titleRestoreConfig: 'Stelle deine Konfiguration wieder her',
 | 
			
		||||
    titleBackupConfig: 'Sichere deine Konfiguraion',
 | 
			
		||||
  },
 | 
			
		||||
  ca: { // github.com/guillembonet
 | 
			
		||||
    name: 'Nom',
 | 
			
		||||
| 
						 | 
				
			
			@ -289,10 +277,6 @@ const messages = { // eslint-disable-line no-unused-vars
 | 
			
		|||
    donate: 'Donar',
 | 
			
		||||
    toggleCharts: 'Mostrar/Ocultar gráficos',
 | 
			
		||||
    theme: { dark: 'Modo oscuro', light: 'Modo claro', auto: 'Modo automático' },
 | 
			
		||||
    restore: 'Restaurar',
 | 
			
		||||
    backup: 'Realizar copia de seguridad',
 | 
			
		||||
    titleRestoreConfig: 'Restaurar su configuración',
 | 
			
		||||
    titleBackupConfig: 'Realizar copia de seguridad de su configuración',
 | 
			
		||||
  },
 | 
			
		||||
  ko: {
 | 
			
		||||
    name: '이름',
 | 
			
		||||
| 
						 | 
				
			
			@ -509,10 +493,6 @@ const messages = { // eslint-disable-line no-unused-vars
 | 
			
		|||
    downloadConfig: 'Scarica configurazione',
 | 
			
		||||
    madeBy: 'Realizzato da',
 | 
			
		||||
    donate: 'Donazione',
 | 
			
		||||
    restore: 'Ripristina',
 | 
			
		||||
    backup: 'Backup',
 | 
			
		||||
    titleRestoreConfig: 'Ripristina la tua configurazione',
 | 
			
		||||
    titleBackupConfig: 'Esegui il backup della tua configurazione',
 | 
			
		||||
  },
 | 
			
		||||
  th: {
 | 
			
		||||
    name: 'ชื่อ',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue