Switch to go:embed
This commit is contained in:
parent
7fc46bf38c
commit
41c3e0b10d
8 changed files with 21 additions and 396 deletions
File diff suppressed because one or more lines are too long
10
bindata.go
10
bindata.go
|
|
@ -1,10 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
//go:generate go-bindata -nometadata -o ./bindata.generated.go webdata/...
|
|
||||||
//go:generate gofmt -w ./bindata.generated.go
|
|
||||||
|
|
||||||
import "github.com/elazarl/go-bindata-assetfs"
|
|
||||||
|
|
||||||
func assetFS() *assetfs.AssetFS {
|
|
||||||
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "webdata"}
|
|
||||||
}
|
|
||||||
|
|
@ -13,11 +13,6 @@ modules:
|
||||||
- name: remote-touchpad
|
- name: remote-touchpad
|
||||||
sources:
|
sources:
|
||||||
# Vendor dependencies: go mod vendor -v
|
# Vendor dependencies: go mod vendor -v
|
||||||
- type: git
|
|
||||||
url: https://github.com/elazarl/go-bindata-assetfs
|
|
||||||
tag: v1.0.1
|
|
||||||
commit: 234c15e7648ff35458026de92b34c637bae5e6f7
|
|
||||||
dest: vendor/github.com/elazarl/go-bindata-assetfs
|
|
||||||
- type: git
|
- type: git
|
||||||
url: https://github.com/godbus/dbus
|
url: https://github.com/godbus/dbus
|
||||||
tag: v5.0.6
|
tag: v5.0.6
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
# github.com/elazarl/go-bindata-assetfs v1.0.1
|
|
||||||
## explicit
|
|
||||||
github.com/elazarl/go-bindata-assetfs
|
|
||||||
# github.com/godbus/dbus/v5 v5.0.6
|
# github.com/godbus/dbus/v5 v5.0.6
|
||||||
## explicit
|
## explicit
|
||||||
github.com/godbus/dbus/v5
|
github.com/godbus/dbus/v5
|
||||||
|
|
|
||||||
3
go.mod
3
go.mod
|
|
@ -1,9 +1,8 @@
|
||||||
module github.com/unrud/remote-touchpad
|
module github.com/unrud/remote-touchpad
|
||||||
|
|
||||||
go 1.15
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.1
|
|
||||||
github.com/godbus/dbus/v5 v5.0.6
|
github.com/godbus/dbus/v5 v5.0.6
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
|
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -1,5 +1,3 @@
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
|
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
|
||||||
github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
|
github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
|
||||||
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||||
|
|
|
||||||
2
main.go
2
main.go
|
|
@ -205,7 +205,7 @@ func main() {
|
||||||
}
|
}
|
||||||
port := addr.Port
|
port := addr.Port
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/", http.FileServer(assetFS()))
|
mux.Handle("/", http.FileServer(http.FS(webdata)))
|
||||||
mux.Handle("/ws", websocket.Handler(func(ws *websocket.Conn) {
|
mux.Handle("/ws", websocket.Handler(func(ws *websocket.Conn) {
|
||||||
var message string
|
var message string
|
||||||
challenge := <-authenticationChallenges
|
challenge := <-authenticationChallenges
|
||||||
|
|
|
||||||
19
webdata.go
Normal file
19
webdata.go
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"io/fs"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed webdata/*
|
||||||
|
var webdataWithPrefix embed.FS
|
||||||
|
var webdata fs.FS
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
var err error
|
||||||
|
webdata, err = fs.Sub(webdataWithPrefix, "webdata")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue