forked from mirrors/amnezia-wg-easy
		
	Merge branch 'master' into imexport
This commit is contained in:
		
						commit
						e7d4bbc12c
					
				
					 7 changed files with 53 additions and 141 deletions
				
			
		|  | @ -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( | ||||
|  |  | |||
|  | @ -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(() => { }); | ||||
|  |  | |||
							
								
								
									
										40
									
								
								src/package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										40
									
								
								src/package-lock.json
									
										
									
										generated
									
									
									
								
							|  | @ -358,9 +358,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@jridgewell/sourcemap-codec": { | ||||
|       "version": "1.4.15", | ||||
|       "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", | ||||
|       "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", | ||||
|       "version": "1.5.0", | ||||
|       "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", | ||||
|       "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", | ||||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/@jridgewell/trace-mapping": { | ||||
|  | @ -1917,9 +1917,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/esquery": { | ||||
|       "version": "1.5.0", | ||||
|       "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", | ||||
|       "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", | ||||
|       "version": "1.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", | ||||
|       "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", | ||||
|       "dev": true, | ||||
|       "peer": true, | ||||
|       "dependencies": { | ||||
|  | @ -2827,15 +2827,15 @@ | |||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/jackspeak": { | ||||
|       "version": "3.4.1", | ||||
|       "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.1.tgz", | ||||
|       "integrity": "sha512-U23pQPDnmYybVkYjObcuYMk43VRlMLLqLI+RdZy8s8WV8WsxO9SnqSroKaluuvcNOdCAlauKszDwd+umbot5Mg==", | ||||
|       "version": "3.4.2", | ||||
|       "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.2.tgz", | ||||
|       "integrity": "sha512-qH3nOSj8q/8+Eg8LUPOq3C+6HWkpUioIjDsq1+D4zY91oZvpPttw8GwtF1nReRYKXl+1AORyFqtm2f5Q1SB6/Q==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@isaacs/cliui": "^8.0.2" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=18" | ||||
|         "node": "14 >=14.21 || 16 >=16.20 || >=18" | ||||
|       }, | ||||
|       "funding": { | ||||
|         "url": "https://github.com/sponsors/isaacs" | ||||
|  | @ -2972,13 +2972,10 @@ | |||
|       "peer": true | ||||
|     }, | ||||
|     "node_modules/lru-cache": { | ||||
|       "version": "10.4.0", | ||||
|       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.0.tgz", | ||||
|       "integrity": "sha512-bfJaPTuEiTYBu+ulDaeQ0F+uLmlfFkMgXj4cbwfuMSjgObGMzb55FMMbDvbRU0fAHZ4sLGkz2mKwcMg8Dvm8Ww==", | ||||
|       "dev": true, | ||||
|       "engines": { | ||||
|         "node": ">=18" | ||||
|       } | ||||
|       "version": "10.4.3", | ||||
|       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", | ||||
|       "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", | ||||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/merge2": { | ||||
|       "version": "1.4.1", | ||||
|  | @ -4239,9 +4236,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/sucrase/node_modules/glob": { | ||||
|       "version": "10.4.3", | ||||
|       "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.3.tgz", | ||||
|       "integrity": "sha512-Q38SGlYRpVtDBPSWEylRyctn7uDeTp4NQERTLiCT1FqA9JXPYWqAVmQU6qh4r/zMM5ehxTcbaO8EjhWnvEhmyg==", | ||||
|       "version": "10.4.5", | ||||
|       "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", | ||||
|       "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "foreground-child": "^3.1.0", | ||||
|  | @ -4254,9 +4251,6 @@ | |||
|       "bin": { | ||||
|         "glob": "dist/esm/bin.mjs" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=18" | ||||
|       }, | ||||
|       "funding": { | ||||
|         "url": "https://github.com/sponsors/isaacs" | ||||
|       } | ||||
|  |  | |||
|  | @ -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> | ||||
|  | @ -140,11 +135,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 +220,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 +241,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 +317,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 +335,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 +440,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 +558,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 +600,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', | ||||
|  | @ -285,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: '이름', | ||||
|  | @ -505,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
	
	 tetuaoro
						tetuaoro