move manifest in controller
This commit is contained in:
parent
a9601c479d
commit
233d1a4d96
1
main.go
1
main.go
|
@ -59,6 +59,7 @@ func main() {
|
||||||
actions = createActions()
|
actions = createActions()
|
||||||
|
|
||||||
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
|
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
|
||||||
|
e.GET("/manifest.json", manifestController)
|
||||||
e.GET("/", homeController)
|
e.GET("/", homeController)
|
||||||
e.GET("/ws", wsController)
|
e.GET("/ws", wsController)
|
||||||
|
|
||||||
|
|
46
manifest_controller.go
Normal file
46
manifest_controller.go
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ManifestIcon struct {
|
||||||
|
Src string `json:"src"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Sizes string `json:"sizes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Manifest struct {
|
||||||
|
ShortName string `json:"short_name"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ThemeColor string `json:"theme_color"`
|
||||||
|
BackgroundColor string `json:"background_color"`
|
||||||
|
Display string `json:"display"`
|
||||||
|
Orientation string `json:"orientation"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
StartUrl string `json:"start_url"`
|
||||||
|
Icons []ManifestIcon `json:"icons"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func manifestController(c echo.Context) error {
|
||||||
|
manifest := &Manifest{
|
||||||
|
ShortName: "RWM",
|
||||||
|
Name: "Remote i3WM",
|
||||||
|
ThemeColor: "#1e3650",
|
||||||
|
BackgroundColor: "#ffffff",
|
||||||
|
Display: "standalone",
|
||||||
|
Orientation: "portrait-primary",
|
||||||
|
Scope: "/",
|
||||||
|
StartUrl: "/",
|
||||||
|
Icons: []ManifestIcon{
|
||||||
|
ManifestIcon{
|
||||||
|
Src: "/static/img/icon.png",
|
||||||
|
Type: "image/png",
|
||||||
|
Sizes: "96x96",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.JSONPretty(http.StatusOK, manifest, " ")
|
||||||
|
}
|
84
rice-box.go
84
rice-box.go
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css">
|
<link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css">
|
||||||
<link rel="stylesheet" href="/static/css/main.css" type="text/css">
|
<link rel="stylesheet" href="/static/css/main.css" type="text/css">
|
||||||
<link rel="manifest" href="/static/manifest.json">
|
<link rel="manifest" href="/manifest.json">
|
||||||
<link rel="icon" type="image/png" href="/static/img/icon.png">
|
<link rel="icon" type="image/png" href="/static/img/icon.png">
|
||||||
<title>Remote i3-wm</title>
|
<title>Remote i3-wm</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -62,19 +62,19 @@
|
||||||
|
|
||||||
{{if eq $value.Type "shortcuts"}}
|
{{if eq $value.Type "shortcuts"}}
|
||||||
<div class="col-9" id="shortcuts_special_keys">
|
<div class="col-9" id="shortcuts_special_keys">
|
||||||
<label class="btn btn-secondary" for="shortcuts_special_key_ctrl">
|
<label class="btn btn-secondary mb-1" for="shortcuts_special_key_ctrl">
|
||||||
<input type="checkbox" value="ctrl" id="shortcuts_special_key_ctrl">
|
<input type="checkbox" value="ctrl" id="shortcuts_special_key_ctrl">
|
||||||
ctrl
|
ctrl
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-secondary" for="shortcuts_special_key_shift">
|
<label class="btn btn-secondary mb-1" for="shortcuts_special_key_shift">
|
||||||
<input type="checkbox" value="shift" id="shortcuts_special_key_shift">
|
<input type="checkbox" value="shift" id="shortcuts_special_key_shift">
|
||||||
shift
|
shift
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-secondary" for="shortcuts_special_key_alt">
|
<label class="btn btn-secondary mb-1" for="shortcuts_special_key_alt">
|
||||||
<input type="checkbox" value="alt" id="shortcuts_special_key_alt">
|
<input type="checkbox" value="alt" id="shortcuts_special_key_alt">
|
||||||
alt
|
alt
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-secondary" for="shortcuts_special_key_win">
|
<label class="btn btn-secondary mb-1" for="shortcuts_special_key_win">
|
||||||
<input type="checkbox" value="win" id="shortcuts_special_key_win">
|
<input type="checkbox" value="win" id="shortcuts_special_key_win">
|
||||||
win
|
win
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
"short_name": "RWM",
|
"short_name": "RWM",
|
||||||
"name": "Remote i3-wm",
|
"name": "Remote i3WM",
|
||||||
"theme_color": "#1e3650",
|
"theme_color": "#1e3650",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
"display": "fullscreen",
|
"display": "standalone",
|
||||||
"Scope": "/",
|
"orientation": "portrait-primary",
|
||||||
|
"scope": "/",
|
||||||
|
"start_url": "/"
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
|
@ -12,6 +14,5 @@
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "96x96"
|
"sizes": "96x96"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"start_url": "/"
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue