parent
e3ac9e9b41
commit
1f81d48aad
@ -357,7 +357,7 @@ class App {
|
||||
const aside = document.createElement("div");
|
||||
aside.classList.add("sec-aside");
|
||||
|
||||
aside.appendChild(this.generateTextElement("h3", this.tls.parser));
|
||||
aside.appendChild(this.generateTextElement("h3", this.tls.parser + ": " + parser.title));
|
||||
const div = document.createElement("div");
|
||||
div.classList.add("parser-desc");
|
||||
|
||||
|
@ -4,12 +4,35 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"gitea.armuli.eu/museum-digital/museum-digital-webdav-uploader/src/configloader"
|
||||
)
|
||||
|
||||
var config configloader.MDWebDavUploaderConfig
|
||||
var setupRequired bool
|
||||
|
||||
// Opens the application in the default browser.
|
||||
func openInBrowser(port string) {
|
||||
|
||||
var err error
|
||||
target := "localhost:" + port
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
err = exec.Command("xdg-open", target).Start()
|
||||
case "windows":
|
||||
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", target).Start()
|
||||
case "darwin":
|
||||
err = exec.Command("open", target).Start()
|
||||
default:
|
||||
err = fmt.Errorf("unsupported platform")
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sets up the server and manages routing.
|
||||
func Run() {
|
||||
|
||||
@ -29,12 +52,19 @@ func Run() {
|
||||
http.HandleFunc("/logo.svg", serveLogo) // Logo.
|
||||
|
||||
port := "8080"
|
||||
go func() {
|
||||
|
||||
// Set port to listen on
|
||||
fmt.Println("Server started at port " + string(port))
|
||||
err := http.ListenAndServe(":"+port, nil)
|
||||
if err != nil {
|
||||
log.Fatal("ListenAndServe: ", err)
|
||||
}
|
||||
// Set port to listen on
|
||||
fmt.Println("Server started at port " + string(port))
|
||||
err := http.ListenAndServe(":"+port, nil)
|
||||
if err != nil {
|
||||
log.Fatal("ListenAndServe: ", err)
|
||||
}
|
||||
|
||||
}();
|
||||
go func() {
|
||||
openInBrowser(port)
|
||||
}();
|
||||
select {}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user