-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* overhaul filebrowser upload * uploaded file rows * remove external filebrowser * move log retention var to Config * cleanup * increase chunk size * progress bar * luanti image * fix corrupt zip download * fix mtui database restore * update latest engine image version * nav fix * add backup/restore page stub * backup/restore wip * replace maintenance page with backup --------- Co-authored-by: BuckarooBanzay <[email protected]>
- Loading branch information
1 parent
3fa60d8
commit 9698e8f
Showing
17 changed files
with
222 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
public/js/components/pages/administration/BackupRestore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { get_maintenance, get_stats } from "../../../service/stats.js"; | ||
import { enable_maintenance, disable_maintenance } from "../../../api/maintenance.js"; | ||
import { engine } from "../../../service/service.js"; | ||
import { upload_chunked } from "../../../service/uploader.js"; | ||
import { unzip, remove } from "../../../api/filebrowser.js"; | ||
|
||
import DefaultLayout from "../../layouts/DefaultLayout.js"; | ||
import { START } from "../../Breadcrumb.js"; | ||
|
||
export default { | ||
components: { | ||
"default-layout": DefaultLayout | ||
}, | ||
data: function() { | ||
return { | ||
breadcrumb: [START, { | ||
name: "Backup/Restore", | ||
icon: "upload", | ||
link: "/backup" | ||
}], | ||
restore_active: false, | ||
restore_message: "", | ||
restore_progress: 0 | ||
}; | ||
}, | ||
computed: { | ||
maintenance: get_maintenance, | ||
is_engine_running: () => engine.is_running() | ||
}, | ||
methods: { | ||
enable_maintenance: async function() { | ||
await enable_maintenance(); | ||
get_stats(); | ||
}, | ||
disable_maintenance: async function() { | ||
await disable_maintenance(); | ||
window.location.reload(); | ||
}, | ||
restore: async function() { | ||
const file = this.$refs.input_upload.files[0]; | ||
if (!file) { | ||
return; | ||
} | ||
|
||
this.restore_message = "Starting to upload archive"; | ||
this.restore_active = true; | ||
|
||
await upload_chunked("/", "restore.zip", file, progress => { | ||
this.restore_progress = progress; | ||
this.restore_message = `Uploading: ${Math.floor(progress*100)}% done`; | ||
}); | ||
|
||
this.restore_message = "Unzipping archive..."; | ||
await unzip("/restore.zip"); | ||
|
||
this.restore_message = "Removing temporary archive"; | ||
await remove("/restore.zip"); | ||
|
||
this.restore_active = false; | ||
|
||
await this.disable_maintenance(); | ||
} | ||
}, | ||
template: /*html*/` | ||
<default-layout title="Backup/Restore" icon="upload" :breadcrumb="breadcrumb"> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
Download backup <i class="fa fa-download"></i> | ||
</div> | ||
<div class="card-body"> | ||
<a class="btn btn-primary" href="api/filebrowser/zip?dir=/"> | ||
<i class="fa fa-file-zipper"></i> | ||
Download world-backup as zip-file | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-6"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
Restore from backup <i class="fa fa-upload"></i> | ||
</div> | ||
<div class="card-body"> | ||
<div class="alert alert-info" v-if="!maintenance"> | ||
<i class="fa-solid fa-info"></i> | ||
The maintenance mode must be enabled and all the services stopped to restore from a backup | ||
</div> | ||
<div class="alert alert-warning" v-if="is_engine_running && !maintenance"> | ||
<i class="fa-solid fa-triangle-exclamation"></i> | ||
The <router-link to="/services/engine">minetest engine</router-link> is still running, please stop it to enable the maintenance mode | ||
</div> | ||
<div class="alert alert-warning" v-if="!is_engine_running && maintenance"> | ||
<i class="fa-solid fa-triangle-exclamation"></i> | ||
<b>Warning:</b> All existing world-data will be overwritten by a backup-restore! | ||
</div> | ||
<div class="input-group" v-if="!restore_active"> | ||
<button class="btn btn-warning" v-if="!maintenance" v-on:click="enable_maintenance" :disabled="is_engine_running"> | ||
<i class="fa-solid fa-triangle-exclamation"></i> | ||
Enable maintenance mode | ||
</button> | ||
<button class="btn btn-success" v-if="maintenance" v-on:click="disable_maintenance"> | ||
Disable maintenance mode | ||
</button> | ||
<input ref="input_upload" type="file" class="form-control" :disabled="!maintenance" accept=".zip"/> | ||
<button class="btn btn-danger" v-on:click="restore" :disabled="!maintenance"> | ||
<i class="fa fa-file-zipper"></i> | ||
Restore from zipfile backup | ||
</button> | ||
</div> | ||
<div class="progress" v-if="restore_active"> | ||
<div class="progress-bar overflow-visible progress-bar-striped progress-bar-animated" v-bind:style="{ width: (restore_progress*100)+'%' }"> | ||
{{restore_message}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</default-layout> | ||
` | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.