fix missing link calls
This commit is contained in:
parent
89a78993b5
commit
8c110e845b
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,4 +6,5 @@
|
||||
__debug_bin
|
||||
|
||||
bin/
|
||||
static/
|
||||
homeservice.tar.gz
|
||||
|
2
go.mod
2
go.mod
@ -6,6 +6,6 @@ require github.com/eclipse/paho.mqtt.golang v1.4.2
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect
|
||||
golang.org/x/net v0.4.0 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
)
|
||||
|
3
go.sum
3
go.sum
@ -3,8 +3,9 @@ github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U=
|
||||
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
|
||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -4,7 +4,7 @@ After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=idle
|
||||
ExecStart=/usr/bin/homeservice -c /etc/homeservice/config.json
|
||||
ExecStart=/usr/bin/homeservice -d /var/lib/home/
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
10
main.go
10
main.go
@ -2,8 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"log"
|
||||
"mime"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
@ -73,6 +73,10 @@ func http_endpoint_sauna(w http.ResponseWriter, r *http.Request) {
|
||||
func main() {
|
||||
logger.Println("starting")
|
||||
|
||||
var webui_path string
|
||||
flag.StringVar(&webui_path, "d", "./static", "Specify path to serve the web ui. Default is ./static")
|
||||
flag.Parse()
|
||||
|
||||
// MQTT connection
|
||||
opts := mqtt.NewClientOptions()
|
||||
opts.AddBroker("tcp://nuc:1883")
|
||||
@ -91,11 +95,9 @@ func main() {
|
||||
token.Wait()
|
||||
logger.Printf("Subscribed to topic %s", topic)
|
||||
|
||||
mime.AddExtensionType(".js", "text/javascript; charset=utf-8")
|
||||
mime.AddExtensionType(".css", "text/css; charset=utf-8")
|
||||
// API routes
|
||||
// Serve files from static folder
|
||||
http.Handle("/", http.FileServer(http.Dir("/var/lib/home/")))
|
||||
http.Handle("/", http.FileServer(http.Dir(webui_path)))
|
||||
|
||||
http.HandleFunc("/sauna/sample", http_endpoint_sauna)
|
||||
|
||||
|
11
webui/Dockerfile
Normal file
11
webui/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM node:latest AS build
|
||||
WORKDIR /app
|
||||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
RUN npm install
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.19-alpine
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
|
35
webui/package-lock.json
generated
35
webui/package-lock.json
generated
@ -8,7 +8,8 @@
|
||||
"name": "my-app",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@fontsource/fira-mono": "^4.5.0"
|
||||
"@fontsource/fira-mono": "^4.5.0",
|
||||
"svelte-spa-router": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-static": "next",
|
||||
@ -821,6 +822,14 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/regexparam": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.1.tgz",
|
||||
"integrity": "sha512-zRgSaYemnNYxUv+/5SeoHI0eJIgTL/A2pUtXUPLHQxUldagouJ9p+K6IbIZ/JiQuCEv2E2B1O11SjVQy3aMCkw==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
@ -933,6 +942,17 @@
|
||||
"svelte": ">=3.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-spa-router": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.3.0.tgz",
|
||||
"integrity": "sha512-cwRNe7cxD43sCvSfEeaKiNZg3FCizGxeMcf7CPiWRP3jKXjEma3vxyyuDtPOam6nWbVxl9TNM3hlE/i87ZlqcQ==",
|
||||
"dependencies": {
|
||||
"regexparam": "2.0.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ItalyPaleAle"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-glob": {
|
||||
"version": "0.2.9",
|
||||
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
|
||||
@ -1470,6 +1490,11 @@
|
||||
"source-map-js": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"regexparam": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.1.tgz",
|
||||
"integrity": "sha512-zRgSaYemnNYxUv+/5SeoHI0eJIgTL/A2pUtXUPLHQxUldagouJ9p+K6IbIZ/JiQuCEv2E2B1O11SjVQy3aMCkw=="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
@ -1547,6 +1572,14 @@
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"svelte-spa-router": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.3.0.tgz",
|
||||
"integrity": "sha512-cwRNe7cxD43sCvSfEeaKiNZg3FCizGxeMcf7CPiWRP3jKXjEma3vxyyuDtPOam6nWbVxl9TNM3hlE/i87ZlqcQ==",
|
||||
"requires": {
|
||||
"regexparam": "2.0.1"
|
||||
}
|
||||
},
|
||||
"tiny-glob": {
|
||||
"version": "0.2.9",
|
||||
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
|
||||
|
@ -14,6 +14,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@fontsource/fira-mono": "^4.5.0"
|
||||
"@fontsource/fira-mono": "^4.5.0",
|
||||
"svelte-spa-router": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import perinetLogo from '../../static/perinet-logo.png'
|
||||
import favicon from '../../static/favicon.png'
|
||||
// import perinetLogo from '../../static/perinet-logo.png'
|
||||
// import favicon from '../../static/favicon.png'
|
||||
</script>
|
||||
|
||||
<header class="header">
|
||||
|
@ -4,8 +4,12 @@ import adapter from '@sveltejs/adapter-static';
|
||||
const config = {
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
fallback: "200.html"
|
||||
})
|
||||
pages: '../static',
|
||||
assets: '../static',
|
||||
// fallback: '200.html',
|
||||
precompress: false,
|
||||
}),
|
||||
trailingSlash: 'always'
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user