diff --git a/conf/users/admin.json b/conf/users/admin.json index 65a77ce..b4c7063 100644 --- a/conf/users/admin.json +++ b/conf/users/admin.json @@ -18,7 +18,7 @@ "FontFamily": "Consolas, 'Courier New', monospace", "FontSize": "13px", "LineHeight": "17px", - "Theme": "wide", + "Theme": "lesser-dark", "TabSize": "4" }, "LatestSessionContent": { diff --git a/main.go b/main.go index 3835183..abf3e0e 100644 --- a/main.go +++ b/main.go @@ -194,22 +194,22 @@ func main() { // indexHandler handles request of Wide index. func indexHandler(w http.ResponseWriter, r *http.Request) { - if "/" != r.RequestURI { - http.Redirect(w, r, "/", http.StatusFound) + if conf.Wide.Context+"/" != r.RequestURI { + http.Redirect(w, r, conf.Wide.Context+"/", http.StatusFound) return } httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } username := httpSession.Values["username"].(string) if "playground" == username { // reserved user for Playground - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } @@ -224,7 +224,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { if nil == user { logger.Warnf("Not found user [%s]", username) - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } @@ -263,7 +263,7 @@ func serveSingle(pattern string, filename string) { func startHandler(w http.ResponseWriter, r *http.Request) { httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } @@ -303,7 +303,7 @@ func startHandler(w http.ResponseWriter, r *http.Request) { func keyboardShortcutsHandler(w http.ResponseWriter, r *http.Request) { httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } @@ -335,7 +335,7 @@ func keyboardShortcutsHandler(w http.ResponseWriter, r *http.Request) { func aboutHandler(w http.ResponseWriter, r *http.Request) { httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } diff --git a/session/users.go b/session/users.go index 6336670..54f58d4 100644 --- a/session/users.go +++ b/session/users.go @@ -52,7 +52,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { httpSession, _ := HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } diff --git a/shell/shells.go b/shell/shells.go index f946f36..1693eb2 100644 --- a/shell/shells.go +++ b/shell/shells.go @@ -44,7 +44,7 @@ var logger = log.NewLogger(os.Stdout) func IndexHandler(w http.ResponseWriter, r *http.Request) { httpSession, _ := session.HTTPSession.Get(r, "wide-session") if httpSession.IsNew { - http.Redirect(w, r, conf.Wide.Context+"login", http.StatusFound) + http.Redirect(w, r, conf.Wide.Context+"/login", http.StatusFound) return } diff --git a/static/js/menu.js b/static/js/menu.js index 858e311..e93b661 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -165,7 +165,7 @@ var menu = { dataType: "json", success: function (result) { if (result.succ) { - window.location.href = "/login"; + window.location.href = config.context + "/login"; } } }); diff --git a/views/index.html b/views/index.html index 0256c84..e5d12c8 100644 --- a/views/index.html +++ b/views/index.html @@ -312,7 +312,7 @@ {{.i18n.team}}
@@ -64,7 +64,7 @@ $('#loginForm').submit(function () { var options = { - url: '/login', + url: '{{.conf.Context}}/login', type: 'POST', dataType: 'json', beforeSubmit: function () { @@ -87,7 +87,7 @@ return; } - window.location.href = "/"; + window.location.href = "{{.conf.Context}}/"; } }; diff --git a/views/preference.html b/views/preference.html index 3c9dc6a..9615906 100644 --- a/views/preference.html +++ b/views/preference.html @@ -103,7 +103,7 @@