[add] pwa manifest
This commit is contained in:
parent
f2163c8fd9
commit
c54d1689df
@ -72,6 +72,7 @@ func (api *API) registerWebAppRoutes() {
|
|||||||
|
|
||||||
api.Router.HTMLRender = render
|
api.Router.HTMLRender = render
|
||||||
|
|
||||||
|
api.Router.GET("/manifest.json", api.webManifest)
|
||||||
api.Router.GET("/login", api.createAppResourcesRoute("login"))
|
api.Router.GET("/login", api.createAppResourcesRoute("login"))
|
||||||
api.Router.GET("/register", api.createAppResourcesRoute("login", gin.H{"Register": true}))
|
api.Router.GET("/register", api.createAppResourcesRoute("login", gin.H{"Register": true}))
|
||||||
api.Router.GET("/logout", api.authWebAppMiddleware, api.authLogout)
|
api.Router.GET("/logout", api.authWebAppMiddleware, api.authLogout)
|
||||||
|
@ -25,6 +25,11 @@ func baseResourceRoute(template string, args ...map[string]any) func(c *gin.Cont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *API) webManifest(c *gin.Context) {
|
||||||
|
c.Header("Content-Type", "application/manifest+json")
|
||||||
|
c.File("./assets/manifest.json")
|
||||||
|
}
|
||||||
|
|
||||||
func (api *API) createAppResourcesRoute(routeName string, args ...map[string]any) func(*gin.Context) {
|
func (api *API) createAppResourcesRoute(routeName string, args ...map[string]any) func(*gin.Context) {
|
||||||
// Merge Optional Template Data
|
// Merge Optional Template Data
|
||||||
var templateVarsBase = gin.H{}
|
var templateVarsBase = gin.H{}
|
||||||
|
7
assets/manifest.json
Normal file
7
assets/manifest.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"short_name": "Book Manager",
|
||||||
|
"name": "Book Manager",
|
||||||
|
"theme_color": "#1F2937",
|
||||||
|
"background_color": "#1F2937",
|
||||||
|
"display": "standalone"
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<link rel="manifest" href="./manifest.json" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<link rel="manifest" href="./manifest.json" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user