update
parent
b36c7b79ff
commit
025861446b
|
@ -1,6 +1,6 @@
|
|||
# Config UI
|
||||
|
||||
a web app to edit and action on update
|
||||
a web app to edit and action on update powered by [ACE](https://ace.c9.io/#nav=howto&api=edit_session)
|
||||
|
||||
```
|
||||
Usage: configui [options]
|
||||
|
|
4
api.go
4
api.go
|
@ -92,6 +92,10 @@ func Download(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func LoadConfig(w http.ResponseWriter, r *http.Request) {
|
||||
if flagNoReconfig {
|
||||
AbortError(w, "system reconfig is disabled")
|
||||
return
|
||||
}
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
r.Body.Close()
|
||||
if err != nil {
|
||||
|
|
10
main.go
10
main.go
|
@ -25,10 +25,11 @@ var (
|
|||
flagAlias string
|
||||
flagConfigPath string
|
||||
|
||||
flagBind string
|
||||
flagLogFile string
|
||||
flagAllow string
|
||||
flagVer bool
|
||||
flagBind string
|
||||
flagNoReconfig bool
|
||||
flagLogFile string
|
||||
flagAllow string
|
||||
flagVer bool
|
||||
)
|
||||
|
||||
var Version = "0.0.0"
|
||||
|
@ -45,6 +46,7 @@ func init() {
|
|||
flag.StringVar(&flagLogFile, "log", "", "log to file")
|
||||
flag.StringVar(&flagAllow, "allow", "", "IPs to allow, blank to allow all")
|
||||
flag.StringVar(&flagBind, "bind", "localhost:8000", "address to bind")
|
||||
flag.BoolVar(&flagNoReconfig, "static", false, "disable config api")
|
||||
flag.BoolVar(&flagVer, "v", false, "show version")
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: configui [options]\n")
|
||||
|
|
|
@ -26,6 +26,7 @@ async function FileSave(){
|
|||
'Content-Type': 'application/json'
|
||||
})
|
||||
})
|
||||
if (res.ok) window.location.reload();
|
||||
}
|
||||
else {
|
||||
const res = await fetch('/api/file', {
|
||||
|
|
2
route.go
2
route.go
|
@ -26,6 +26,7 @@ type Page struct {
|
|||
Error string
|
||||
File OnPageFile
|
||||
Editor Editor
|
||||
Static bool
|
||||
}
|
||||
|
||||
func setRoutes(mux *http.ServeMux) {
|
||||
|
@ -54,6 +55,7 @@ func setRoutes(mux *http.ServeMux) {
|
|||
Editor: Editor{
|
||||
Platform: plat,
|
||||
},
|
||||
Static: flagNoReconfig,
|
||||
}
|
||||
|
||||
content := ""
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
{{define "components/error"}}
|
||||
|
||||
<div class="notification is-danger is-light" id="error_view">
|
||||
<button class="delete"></button>
|
||||
<p id="err_msg"></p>
|
||||
</div>
|
||||
<script>
|
||||
function ErrorTog(){
|
||||
let el = document.getElementById('error_view');
|
||||
el.classList.toggle('is-active');
|
||||
}
|
||||
function ShowError(msg){
|
||||
let el = document.getElementById('err_msg');
|
||||
el.innerHTML = msg;
|
||||
ErrorTog();
|
||||
}
|
||||
</script>
|
||||
{{end}}
|
Loading…
Reference in New Issue