Merge remote-tracking branch 'refs/remotes/origin/master' into 1.5.3-dev

This commit is contained in:
Liang Ding 2017-03-29 21:06:23 +08:00
commit 2b790ce300
1 changed files with 16 additions and 1 deletions

View File

@ -67,6 +67,14 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
user := conf.GetUser(username)
if "GET" == r.Method {
tmpLinux := user.GoBuildArgsForLinux
tmpWindows := user.GoBuildArgsForWindows
tmpDarwin := user.GoBuildArgsForDarwin
user.GoBuildArgsForLinux = strings.Replace(user.GoBuildArgsForLinux, `"`, `"`, -1)
user.GoBuildArgsForWindows = strings.Replace(user.GoBuildArgsForWindows, `"`, `"`, -1)
user.GoBuildArgsForDarwin = strings.Replace(user.GoBuildArgsForDarwin, `"`, `"`, -1)
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(user.Locale), "user": user,
"ver": conf.WideVersion, "goos": runtime.GOOS, "goarch": runtime.GOARCH, "gover": runtime.Version(),
"locales": i18n.GetLocalesNames(), "gofmts": util.Go.GetGoFormats(),
@ -78,11 +86,18 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
logger.Error(err)
http.Error(w, err.Error(), 500)
user.GoBuildArgsForLinux = tmpLinux
user.GoBuildArgsForWindows = tmpWindows
user.GoBuildArgsForDarwin = tmpDarwin
return
}
t.Execute(w, model)
user.GoBuildArgsForLinux = tmpLinux
user.GoBuildArgsForWindows = tmpWindows
user.GoBuildArgsForDarwin = tmpDarwin
return
}