diff --git a/data/static/admin.js b/data/static/admin.js
index a428f6b..66316e4 100644
--- a/data/static/admin.js
+++ b/data/static/admin.js
@@ -1120,7 +1120,10 @@ document.getElementById('settingsSave').onclick = function() {
}
if (restart_setting_changed) {
document.getElementById('applyRestarts').onclick = function(){ sendConfig('restartModal'); };
- document.getElementById('applyAndRestart').onclick = function(){ sendConfig('restartModal', restart=true); };
+ let restartButton = document.getElementById('applyAndRestart')
+ if (restartButton) {
+ restartButton.onclick = function(){ sendConfig('restartModal', restart=true); };
+ }
settingsModal.hide();
restartModal.show();
} else if (settings_changed) {
diff --git a/data/templates/admin.html b/data/templates/admin.html
index 344f3e4..0b32df8 100644
--- a/data/templates/admin.html
+++ b/data/templates/admin.html
@@ -269,6 +269,15 @@
+ {{ if .windows }}
+
+
A restart is needed to apply some settings. Self-restarts aren't possible on Windows, so you must restart manually.
+
+
+ {{ else }}
A restart is needed to apply some settings. Restart now, later, or cancel?
@@ -277,6 +286,7 @@
Finished!
+ {{ if .windows }}
+ Press the button below to submit your settings. Unfortunately you're running on Windows, so jfa-go cannot restart itself. You will manually have to restart.
+ {{ else }}
Press the button below to submit your settings. The program will restart. Once it's done, refresh this page.
+ {{ end }}
Submit
diff --git a/main.go b/main.go
index de7f771..d1c053c 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,7 @@ import (
"os"
"os/signal"
"path/filepath"
+ "runtime"
"time"
"github.com/gin-contrib/pprof"
@@ -95,6 +96,8 @@ func setGinLogger(router *gin.Engine, debugMode bool) {
}
}
+var PLATFORM string = runtime.GOOS
+
func main() {
fmt.Printf("jfa-go version: %s (%s)\n", VERSION, COMMIT)
// app encompasses essentially all useful functions.
@@ -362,8 +365,14 @@ func main() {
}
app.info.Printf("Starting router @ %s", address)
} else {
+ windows := false
+ if PLATFORM == "windows" {
+ windows = true
+ }
router.GET("/", func(gc *gin.Context) {
- gc.HTML(200, "setup.html", gin.H{})
+ gc.HTML(200, "setup.html", gin.H{
+ "windows": windows,
+ })
})
router.POST("/testJF", app.TestJF)
router.POST("/modifyConfig", app.ModifyConfig)
diff --git a/views.go b/views.go
index a184fda..0379b5e 100644
--- a/views.go
+++ b/views.go
@@ -11,6 +11,10 @@ func (app *appContext) AdminPage(gc *gin.Context) {
emailEnabled, _ := app.config.Section("invite_emails").Key("enabled").Bool()
notificationsEnabled, _ := app.config.Section("notifications").Key("enabled").Bool()
ombiEnabled := app.config.Section("ombi").Key("enabled").MustBool(false)
+ windows := false
+ if PLATFORM == "windows" {
+ windows = true
+ }
gc.HTML(http.StatusOK, "admin.html", gin.H{
"bs5": bs5,
"cssFile": app.cssFile,
@@ -20,6 +24,7 @@ func (app *appContext) AdminPage(gc *gin.Context) {
"version": VERSION,
"commit": COMMIT,
"ombiEnabled": ombiEnabled,
+ "windows": windows,
})
}