move manifest in controller

This commit is contained in:
Simon Vieille 2023-11-20 14:40:10 +01:00
parent a9601c479d
commit 233d1a4d96
Signed by: deblan
GPG key ID: 579388D585F70417
6 changed files with 91 additions and 61 deletions

View file

@ -59,6 +59,7 @@ func main() {
actions = createActions()
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
e.GET("/manifest.json", manifestController)
e.GET("/", homeController)
e.GET("/ws", wsController)

46
manifest_controller.go Normal file
View 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, " ")
}

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@
<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/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">
<title>Remote i3-wm</title>
</head>

View file

@ -62,19 +62,19 @@
{{if eq $value.Type "shortcuts"}}
<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">
ctrl
</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">
shift
</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">
alt
</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">
win
</label>

View file

@ -1,10 +1,12 @@
{
"short_name": "RWM",
"name": "Remote i3-wm",
"name": "Remote i3WM",
"theme_color": "#1e3650",
"background_color": "#ffffff",
"display": "fullscreen",
"Scope": "/",
"display": "standalone",
"orientation": "portrait-primary",
"scope": "/",
"start_url": "/"
"orientation": "portrait",
"icons": [
{
@ -12,6 +14,5 @@
"type": "image/png",
"sizes": "96x96"
}
],
"start_url": "/"
]
}