diff --git a/public/js/routes.js b/public/js/routes.js
index 1a425986..33c7e9b9 100644
--- a/public/js/routes.js
+++ b/public/js/routes.js
@@ -19,7 +19,6 @@ import OauthApps from './components/pages/oauth/OauthApps.js';
import OauthAppEdit from './components/pages/oauth/OauthAppEdit.js';
import MinetestConfig from './components/pages/administration/MinetestConfig.js';
import UISettings from './components/pages/administration/UISettings.js';
-import Maintenance from './components/pages/administration/Maintenance.js';
import Filebrowser from './components/pages/filebrowser/Filebrowser.js';
import FileEditPage from './components/pages/filebrowser/FileEditPage.js';
import Signup from './components/pages/Signup.js';
@@ -40,13 +39,11 @@ import Mesecons from './components/pages/Mesecons.js';
import Luacontroller from './components/pages/Luacontroller.js';
import Play from './components/pages/Play.js';
import RestartConditions from './components/pages/administration/RestartConditions.js';
+import BackupRestore from './components/pages/administration/BackupRestore.js';
export default [{
path: "/", component: Start,
meta: { maintenance_page: true }
-}, {
- path: "/maintenance", component: Maintenance,
- meta: { requiredPriv: "server", maintenance_page: true }
}, {
path: "/restart-conditions", component: RestartConditions,
meta: { requiredPriv: "server" }
@@ -100,6 +97,9 @@ export default [{
}, {
path: "/mods", component: Mods,
meta: { requiredPriv: "server" }
+}, {
+ path: "/backup", component: BackupRestore,
+ meta: { requiredPriv: "server", maintenance_page: true }
}, {
path: "/cdb/browse", component: ContentBrowse,
meta: { requiredPriv: "server" }
diff --git a/public/js/service/stats.js b/public/js/service/stats.js
index 302b12e6..fadde270 100644
--- a/public/js/service/stats.js
+++ b/public/js/service/stats.js
@@ -19,4 +19,3 @@ export const stop_polling = () => clearInterval(handle);
export const get_player_count = () => store.player_count;
export const get_players = () => store.players;
export const get_maintenance = () => store.maintenance;
-export const get_filebrowser_enabled = () => store.filebrowser_enabled;
\ No newline at end of file
diff --git a/public/js/service/uploader.js b/public/js/service/uploader.js
index 192ae515..24f74679 100644
--- a/public/js/service/uploader.js
+++ b/public/js/service/uploader.js
@@ -1,6 +1,6 @@
import { append, browse, remove, rename } from "../api/filebrowser.js";
-export async function upload_chunked(dir, filename, data) {
+export async function upload_chunked(dir, filename, data, progress_callback) {
// temp filename to upload to
const tmpfilename = filename + ".part";
@@ -12,9 +12,13 @@ export async function upload_chunked(dir, filename, data) {
let offset = 0;
do {
- const chunksize = Math.min(data.size - offset, 1000*1000); // 1 mb chunks
+ const chunksize = Math.min(data.size - offset, 1000*1000*2); // 2 mb chunks
await append(dir + "/" + tmpfilename, data.slice(offset, offset + chunksize));
offset += chunksize;
+
+ if (typeof(progress_callback) == "function") {
+ progress_callback(offset / data.size); // 0...1
+ }
} while (offset < data.size);
await rename(dir + "/" + tmpfilename, dir + "/" + filename);
diff --git a/types/config.go b/types/config.go
index 3bb4a62b..a64e85de 100644
--- a/types/config.go
+++ b/types/config.go
@@ -18,10 +18,9 @@ type Config struct {
Webdev bool
Servername string
EnabledFeatures []string
- FilebrowserURL string
- FilebrowserProxyPath string
InstallMtuiMod bool
AutoReconfigureMods bool
+ LogRetention string
LogStreamURL string
LogStreamAuthorization string
MinetestConfig string
@@ -50,10 +49,9 @@ func NewConfig(world_dir string) *Config {
Webdev: os.Getenv("WEBDEV") == "true",
Servername: os.Getenv("SERVER_NAME"),
EnabledFeatures: strings.Split(os.Getenv("ENABLE_FEATURES"), ","),
- FilebrowserURL: os.Getenv("FILEBROWSER_URL"),
- FilebrowserProxyPath: os.Getenv("FILEBROWSER_PROXY_PATH"),
InstallMtuiMod: os.Getenv("INSTALL_MTUI_MOD") == "true",
AutoReconfigureMods: os.Getenv("AUTORECONFIGURE_MODS") == "true",
+ LogRetention: os.Getenv("LOG_RETENTION"),
LogStreamURL: os.Getenv("LOG_STREAM_URL"),
LogStreamAuthorization: os.Getenv("LOG_STREAM_AUTHORIZATION"),
MinetestConfig: os.Getenv("MINETEST_CONFIG"),
diff --git a/types/services.go b/types/services.go
index b124fafd..46cbdbb5 100644
--- a/types/services.go
+++ b/types/services.go
@@ -1,14 +1,15 @@
package types
var EngineServiceImages = map[string]string{
- "5.6.0": "registry.gitlab.com/minetest/minetest/server:5.6.0",
- "5.7.0": "registry.gitlab.com/minetest/minetest/server:5.7.0",
- "5.8.0": "ghcr.io/minetest-hosting/minetest-docker:5.8.0",
- "5.9.0": "ghcr.io/minetest/minetest:5.9.0",
+ "5.6.0": "registry.gitlab.com/minetest/minetest/server:5.6.0",
+ "5.7.0": "registry.gitlab.com/minetest/minetest/server:5.7.0",
+ "5.8.0": "ghcr.io/minetest-hosting/minetest-docker:5.8.0",
+ "5.9.0": "ghcr.io/minetest/minetest:5.9.0",
+ "5.10.0": "ghcr.io/minetest/minetest:5.10.0",
}
// for auto install
-var EngineServiceLatest = "5.9.0"
+var EngineServiceLatest = "5.10.0"
var MatterbridgeServiceImages = map[string]string{
"1.26.0": "42wim/matterbridge:1.26.0",
diff --git a/web/filebrowser_download.go b/web/filebrowser_download.go
index 5a705788..dd84e66a 100644
--- a/web/filebrowser_download.go
+++ b/web/filebrowser_download.go
@@ -1,7 +1,6 @@
package web
import (
- "archive/zip"
"fmt"
"io"
"mtui/app"
@@ -82,9 +81,6 @@ func (a *Api) DownloadZip(w http.ResponseWriter, r *http.Request, claims *types.
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.zip\"", zipfilename))
w.Header().Set("Content-Type", "application/zip")
- zw := zip.NewWriter(w)
- defer zw.Close()
-
count, err := a.app.StreamZip(absdir, w, nil)
if err != nil {
SendError(w, 500, err)
diff --git a/web/maintenance.go b/web/maintenance.go
index ad019f85..a08e73f5 100644
--- a/web/maintenance.go
+++ b/web/maintenance.go
@@ -18,7 +18,6 @@ func (a *Api) EnableMaintenanceMode(w http.ResponseWriter, r *http.Request, c *t
if a.app.MaintenanceMode.Load() {
SendError(w, 500, fmt.Errorf("already in maintenance mode"))
}
- a.app.MaintenanceMode.Store(true)
// create log entry
a.app.CreateUILogEntry(&types.Log{
@@ -27,6 +26,8 @@ func (a *Api) EnableMaintenanceMode(w http.ResponseWriter, r *http.Request, c *t
Message: fmt.Sprintf("User '%s' enables the maintenance mode", c.Username),
}, r)
+ a.app.MaintenanceMode.Store(true)
+
// clear current stats
current_stats.Store(nil)
// detach database
diff --git a/web/setup.go b/web/setup.go
index f3e59a41..601c5e9f 100644
--- a/web/setup.go
+++ b/web/setup.go
@@ -1,13 +1,10 @@
package web
import (
- "fmt"
"mtui/app"
"mtui/public"
"mtui/types"
"net/http"
- "net/http/httputil"
- "net/url"
"os"
"time"
@@ -31,26 +28,6 @@ func Setup(a *app.App) error {
return err
}
- if a.Config.FilebrowserURL != "" {
- // enable filebrowser access with "server" priv
- remote, err := url.Parse(a.Config.FilebrowserURL)
- if err != nil {
- return err
- }
-
- handler := func(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request) {
- return api.SecurePriv("server", func(w http.ResponseWriter, r *http.Request, c *types.Claims) {
- r.Host = remote.Host
- // prepend proxy path
- r.URL.Path = fmt.Sprintf("%s%s", a.Config.FilebrowserProxyPath, r.URL.Path)
- p.ServeHTTP(w, r)
- })
- }
-
- proxy := httputil.NewSingleHostReverseProxy(remote)
- r.PathPrefix("/filebrowser/").HandlerFunc(handler(proxy))
- }
-
// always on api
r.HandleFunc("/api/maintenance", api.SecurePriv(types.PRIV_SERVER, api.GetMaintenanceMode)).Methods(http.MethodGet)
r.HandleFunc("/api/maintenance", api.SecurePriv(types.PRIV_SERVER, api.EnableMaintenanceMode)).Methods(http.MethodPut)
diff --git a/web/stats.go b/web/stats.go
index 2b40c830..7c6eae3a 100644
--- a/web/stats.go
+++ b/web/stats.go
@@ -30,15 +30,13 @@ func (a *Api) StatsEventListener(c chan *bridge.CommandResponse) {
type StatResponse struct {
*command.StatsCommand
- Maintenance bool `json:"maintenance"`
- FilebrowserEnabled bool `json:"filebrowser_enabled"`
+ Maintenance bool `json:"maintenance"`
}
func (a *Api) GetStats(w http.ResponseWriter, r *http.Request, claims *types.Claims) {
sc := &StatResponse{
- StatsCommand: &command.StatsCommand{},
- FilebrowserEnabled: a.app.Config.FilebrowserURL != "",
+ StatsCommand: &command.StatsCommand{},
}
sc.Maintenance = a.app.MaintenanceMode.Load()
|