htmlui: added experimental HTML-based UI

This is enabled by `kopia server --ui` and can be viewed in a browser
at http://localhost:51515/

Right now it can only list snapshots and policies (barely).
This commit is contained in:
Jarek Kowalski committed 2019-11-20 14:41:38 -08:00
1 parent 945708c5c5
commit e8a1eaa9ee
33 files changed
+15128 -51

No files matched your search

+3
View File
@@ -16,6 +16,7 @@ var (
serverStartCommand = serverCommands.Command("start", "Start Kopia server").Default()
serverStartHTMLPath = serverStartCommand.Flag("html", "Server the provided HTML at the root URL").ExistingDir()
serverStartUI = serverStartCommand.Flag("ui", "Start the server with HTML UI (EXPERIMENTAL)").Bool()
)
func init() {
@@ -36,6 +37,8 @@ func runServer(ctx context.Context, rep *repo.Repository) error {
if *serverStartHTMLPath != "" {
fileServer := http.FileServer(http.Dir(*serverStartHTMLPath))
http.Handle("/", fileServer)
} else if *serverStartUI {
http.Handle("/", http.FileServer(server.AssetFile()))
}
return http.ListenAndServe(*serverAddress, nil)
}