mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-06 21:28:30 +02:00
Added plugin dir parameter
- Added plugin dir parameter - Fixed critical architectural bug that effects plugin UI in production mode - Updated implementation of embed FS routing - Minor dark theme update - Fixed ztnc UI bug for msgbox and confirm box
This commit is contained in:
16
src/api.go
16
src/api.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
|
||||
@@ -315,13 +316,20 @@ func initAPIs(targetMux *http.ServeMux) {
|
||||
},
|
||||
})
|
||||
|
||||
//Register the standard web services urls
|
||||
fs := http.FileServer(http.FS(webres))
|
||||
// Register the standard web services URLs
|
||||
var staticWebRes http.Handler
|
||||
if DEVELOPMENT_BUILD {
|
||||
fs = http.FileServer(http.Dir("web/"))
|
||||
staticWebRes = http.FileServer(http.Dir("web/"))
|
||||
} else {
|
||||
subFS, err := fs.Sub(webres, "web")
|
||||
if err != nil {
|
||||
panic("Failed to strip 'web/' from embedded resources: " + err.Error())
|
||||
}
|
||||
staticWebRes = http.FileServer(http.FS(subFS))
|
||||
}
|
||||
|
||||
//Add a layer of middleware for advance control
|
||||
advHandler := FSHandler(fs)
|
||||
advHandler := FSHandler(staticWebRes)
|
||||
targetMux.Handle("/", advHandler)
|
||||
|
||||
//Register the APIs
|
||||
|
Reference in New Issue
Block a user