parent
e3ac9e9b41
commit
1f81d48aad
@ -357,7 +357,7 @@ class App {
|
|||||||
const aside = document.createElement("div");
|
const aside = document.createElement("div");
|
||||||
aside.classList.add("sec-aside");
|
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");
|
const div = document.createElement("div");
|
||||||
div.classList.add("parser-desc");
|
div.classList.add("parser-desc");
|
||||||
|
|
||||||
|
@ -4,12 +4,35 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"gitea.armuli.eu/museum-digital/museum-digital-webdav-uploader/src/configloader"
|
"gitea.armuli.eu/museum-digital/museum-digital-webdav-uploader/src/configloader"
|
||||||
)
|
)
|
||||||
|
|
||||||
var config configloader.MDWebDavUploaderConfig
|
var config configloader.MDWebDavUploaderConfig
|
||||||
var setupRequired bool
|
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.
|
// Sets up the server and manages routing.
|
||||||
func Run() {
|
func Run() {
|
||||||
|
|
||||||
@ -29,12 +52,19 @@ func Run() {
|
|||||||
http.HandleFunc("/logo.svg", serveLogo) // Logo.
|
http.HandleFunc("/logo.svg", serveLogo) // Logo.
|
||||||
|
|
||||||
port := "8080"
|
port := "8080"
|
||||||
|
go func() {
|
||||||
|
|
||||||
// Set port to listen on
|
// Set port to listen on
|
||||||
fmt.Println("Server started at port " + string(port))
|
fmt.Println("Server started at port " + string(port))
|
||||||
err := http.ListenAndServe(":"+port, nil)
|
err := http.ListenAndServe(":"+port, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("ListenAndServe: ", err)
|
log.Fatal("ListenAndServe: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}();
|
||||||
|
go func() {
|
||||||
|
openInBrowser(port)
|
||||||
|
}();
|
||||||
|
select {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user