feat: update external-ui

This commit is contained in:
Larvan2
2023-09-18 19:21:30 +08:00
parent 6a5a94f48f
commit 7c21768e99
6 changed files with 75 additions and 53 deletions

View File

@ -49,7 +49,6 @@ type Memory struct {
func SetUIPath(path string) {
uiPath = C.Path.Resolve(path)
C.UIPath = uiPath
}
func Start(addr string, tlsAddr string, secret string,

View File

@ -16,7 +16,7 @@ import (
func upgradeRouter() http.Handler {
r := chi.NewRouter()
r.Post("/", upgrade)
r.Post("/xd", updateXD)
r.Post("/ui", updateUI)
return r
}
@ -46,8 +46,8 @@ func upgrade(w http.ResponseWriter, r *http.Request) {
go restartExecutable(execPath)
}
func updateXD(w http.ResponseWriter, r *http.Request) {
err := config.UpdateXD()
func updateUI(w http.ResponseWriter, r *http.Request) {
err := config.UpdateUI()
if err != nil {
log.Warnln("%s", err)
render.Status(r, http.StatusInternalServerError)