kopia lustrzana https://codeberg.org/nmkj/audon
support opengraph images
rodzic
dfde5d1664
commit
98f50c813d
|
@ -1,13 +1,47 @@
|
|||
{% define "tmpl" %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/src/assets/favicon.svg">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Audon</title>
|
||||
<meta name="description" content="Audon: audio conversation, radio talk room for Mastodon (and Pleroma)">
|
||||
|
||||
<!-- Facebook Meta Tags -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content='{% printf "https://%s/static/opengraph.c05d412c.png" .Config.LocalDomain %}'>
|
||||
{% if .Room %}
|
||||
<meta property="og:title" content='{% printf "%.60s" .Room.Title %}'>
|
||||
{% if .Room.Description %}
|
||||
<meta property="og:description" content='{% printf "%.150s" .Room.Description %}'>
|
||||
{% else %}
|
||||
<meta property="og:description" content='Audon: audio conversation, radio talk room for Mastodon (and Pleroma)'>
|
||||
{% end %}
|
||||
{% else %}
|
||||
<meta property="og:title" content='Audon'>
|
||||
<meta property="og:description" content='Audio conversation, radio talk room for Mastodon (and Pleroma)'>
|
||||
{% end %}
|
||||
|
||||
<!-- Twitter Meta Tags -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content='{% printf "https://%s/static/opengraph.c05d412c.png" .Config.LocalDomain %}'>
|
||||
{% if .Room %}
|
||||
<meta name="twitter:title" content='{% printf "%.60s" .Room.Title %}'>
|
||||
{% if .Room.Description %}
|
||||
<meta property="twitter:description" content='{% printf "%.150s" .Room.Description %}'>
|
||||
{% else %}
|
||||
<meta property="twitter:description" content='Audon: audio conversation, radio talk room for Mastodon (and Pleroma)'>
|
||||
{% end %}
|
||||
{% else %}
|
||||
<meta property="twitter:title" content='Audon'>
|
||||
<meta property="twitter:description" content='Audio conversation, radio talk room for Mastodon (and Pleroma)'>
|
||||
{% end %}
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-version='%%VERSION%%'></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
{% end %}
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 38 KiB |
|
@ -23,7 +23,10 @@ export default {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<v-app class="fill-height">
|
||||
<v-app style="min-height: 100%">
|
||||
<div id="mascot" class="pa-3">
|
||||
<img :draggable="false" src="./assets/img/mascot.png" />
|
||||
</div>
|
||||
<v-system-bar window>
|
||||
<div class="d-flex justify-center align-center w-100">
|
||||
<RouterLink :to="{ name: 'home' }" class="d-flex align-center">
|
||||
|
@ -36,9 +39,6 @@ export default {
|
|||
</div>
|
||||
</v-system-bar>
|
||||
<v-main>
|
||||
<div id="mascot" class="pa-3">
|
||||
<img :draggable="false" src="./assets/img/mascot.png" />
|
||||
</div>
|
||||
<v-container class="fill-height">
|
||||
<v-row
|
||||
align="center"
|
||||
|
@ -86,7 +86,7 @@ export default {
|
|||
|
||||
<style>
|
||||
#mascot {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Po Szerokość: | Wysokość: | Rozmiar: 6.2 KiB |
|
@ -28,6 +28,7 @@ html,
|
|||
body,
|
||||
#app {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans CJK JP", "Original Yu Gothic", "Yu Gothic", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Sans Emoji";
|
||||
}
|
||||
|
||||
|
@ -35,3 +36,7 @@ a.plain {
|
|||
text-decoration: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.v-card {
|
||||
background-color: rgba(33, 33, 33, 0.95);
|
||||
}
|
||||
|
|
|
@ -893,7 +893,4 @@ export default {
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-card {
|
||||
background-color: rgba(33, 33, 33, 0.9);
|
||||
}
|
||||
</style>
|
16
room.go
16
room.go
|
@ -152,6 +152,22 @@ func updateRoomHandler(c echo.Context) (err error) {
|
|||
return c.JSON(http.StatusOK, room)
|
||||
}
|
||||
|
||||
// handler for GET to /r/:id
|
||||
func renderRoomHandler(c echo.Context) error {
|
||||
roomID := c.Param("id")
|
||||
if err := mainValidator.Var(&roomID, "required,printascii"); err != nil {
|
||||
return wrapValidationError(err)
|
||||
}
|
||||
|
||||
room, err := findRoomByID(c.Request().Context(), roomID)
|
||||
if err != nil {
|
||||
return echo.NotFoundHandler(c)
|
||||
}
|
||||
|
||||
return c.Render(http.StatusOK, "tmpl", &TemplateData{Config: &mainConfig.AppConfigBase, Room: room})
|
||||
}
|
||||
|
||||
// for preview, this bypasses authentication
|
||||
func previewRoomHandler(c echo.Context) (err error) {
|
||||
roomID := c.Param("id")
|
||||
if err := mainValidator.Var(&roomID, "required,printascii"); err != nil {
|
||||
|
|
15
server.go
15
server.go
|
@ -32,6 +32,11 @@ type (
|
|||
templates *template.Template
|
||||
}
|
||||
|
||||
TemplateData struct {
|
||||
Config *AppConfigBase
|
||||
Room *Room
|
||||
}
|
||||
|
||||
CustomValidator struct {
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
@ -100,6 +105,9 @@ func main() {
|
|||
defer e.Close()
|
||||
|
||||
e.Validator = &CustomValidator{validator: mainValidator}
|
||||
e.Renderer = &Template{
|
||||
templates: template.Must(template.New("tmpl").Delims("{%", "%}").ParseGlob("audon-fe/dist/index.html")),
|
||||
}
|
||||
|
||||
// Setup session middleware (currently Audon stores all client data in cookie)
|
||||
log.Println("Connecting to Redis")
|
||||
|
@ -151,7 +159,12 @@ func main() {
|
|||
api.PUT("/room/:room/:user", updatePermissionHandler)
|
||||
|
||||
e.Static("/assets", "audon-fe/dist/assets")
|
||||
e.File("/*", "audon-fe/dist/index.html")
|
||||
e.Static("/static", "audon-fe/dist/static")
|
||||
e.GET("/r/:id", renderRoomHandler)
|
||||
e.GET("/*", func(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "tmpl", &TemplateData{Config: &mainConfig.AppConfigBase})
|
||||
})
|
||||
// e.File("/*", "audon-fe/dist/index.html")
|
||||
|
||||
// use anonymous func to support graceful shutdown
|
||||
go func() {
|
||||
|
|
Ładowanie…
Reference in New Issue