mirror of
https://github.com/w0rng/amnezia-wg-easy.git
synced 2025-04-26 13:20:11 +03:00
feat: load configuration from file
* import json config file & update the config (restore) * export the config and save it to json file (backup)
This commit is contained in:
parent
94d87681c3
commit
03b7d8e537
6 changed files with 134 additions and 39 deletions
|
@ -299,6 +299,22 @@ new Vue({
|
|||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
importConfig(e) {
|
||||
e.preventDefault();
|
||||
const file = e.currentTarget.files.item(0);
|
||||
file.text()
|
||||
.then(content => {
|
||||
this.api.uploadConfiguration(content)
|
||||
.then((_result) => {
|
||||
alert("The configuration was updated.");
|
||||
document.location.reload();
|
||||
})
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
})
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
toggleTheme() {
|
||||
const themes = ['light', 'dark', 'auto'];
|
||||
const currentIndex = themes.indexOf(this.uiTheme);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue