This commit is contained in:
aceberg 2023-01-07 01:29:47 +07:00
parent 0e15f81758
commit 4c8a008151
5 changed files with 33 additions and 8 deletions

View file

@ -8,12 +8,14 @@ import (
)
const configPath = "/data/config"
const bootPath = "https://cdn.jsdelivr.net/npm/bootswatch@5.2.3/dist"
// const bootPath = "file://data/node_modules/bootswatch/dist"
// const bootPath = ""
const bootPath = "/data/node_modules/bootswatch/dist/sketchy"
func main() {
confPtr := flag.String("c", configPath, "Path to config file")
bootPtr := flag.String("b", bootPath, "Path to Bootswatch")
bootPtr := flag.String("b", bootPath, "Path to local Bootswatch")
flag.Parse()
check.Path(*confPtr)

File diff suppressed because one or more lines are too long

12
internal/web/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -5,10 +5,15 @@
<meta charset="utf-8">
<!--Favicon-->
<link href="data:image/x-icon;base64,{{ .Config.Icon }}" rel="icon" type="image/x-icon" />
<!-- Bootstrap and theme -->
<link href="{{ .Config.BootPath }}/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<!-- Font for icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
{{ if eq .Config.BootPath "" }}
<!-- Bootstrap and theme -->
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.3/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
<!-- Font for icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
{{ else }}
<!-- Bootstrap and theme -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
{{ end }}
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-dark bg-primary">

View file

@ -28,6 +28,12 @@ func Gui(configPath, bootPath string) {
AllHosts = db.Select(AppConfig.DbPath)
if AppConfig.BootPath != "" {
fs := http.FileServer(http.Dir(AppConfig.BootPath))
http.Handle("/css/", http.StripPrefix("/css", fs))
// http.Handle("/css/", http.FileServer(http.Dir(AppConfig.BootPath)))
}
log.Println("=================================== ")
log.Printf("Web GUI at http://%s", address)
log.Println("=================================== ")