Compare commits
1
Commits
email-messenger
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f0561bcc1
|
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
@@ -7,6 +7,7 @@ package web
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
@@ -26,6 +27,8 @@ import (
|
||||
const (
|
||||
// tplHome home page template
|
||||
tplHome templates.TplName = "home"
|
||||
// tplMystery mystery quest page template
|
||||
tplMystery templates.TplName = "mystery"
|
||||
)
|
||||
|
||||
// Home render home page
|
||||
@@ -64,6 +67,13 @@ func Home(ctx *context.Context) {
|
||||
ctx.HTML(http.StatusOK, tplHome)
|
||||
}
|
||||
|
||||
// Mystery renders a small riddle page; the image is only revealed for the correct answer.
|
||||
func Mystery(ctx *context.Context) {
|
||||
ctx.Data["Title"] = "Ответ на загадку:"
|
||||
ctx.Data["Answered"] = strings.EqualFold(strings.TrimSpace(ctx.FormString("answer")), "афродита")
|
||||
ctx.HTML(http.StatusOK, tplMystery)
|
||||
}
|
||||
|
||||
// HomeSitemap renders the main sitemap
|
||||
func HomeSitemap(ctx *context.Context) {
|
||||
m := sitemap.NewSitemapIndex()
|
||||
|
||||
@@ -497,6 +497,7 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
||||
// Especially some AJAX requests, we can reduce middleware number to improve performance.
|
||||
|
||||
m.Get("/", Home)
|
||||
m.Get("/mystery", Mystery)
|
||||
m.Get("/sitemap.xml", sitemapEnabled, optExploreSignIn, HomeSitemap)
|
||||
m.Group("/.well-known", func() {
|
||||
m.Get("/openid-configuration", auth.OIDCWellKnown)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="Mystery" class="page-content home">
|
||||
<div class="tw-max-w-3xl tw-mx-auto tw-px-6 tw-py-16">
|
||||
<div class="tw-mb-8">
|
||||
<h1 style="font-size: 2.5rem; font-weight: 700; letter-spacing: -1px; margin: 0 0 0.5rem;">
|
||||
Ответ на загадку:
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<form method="get" action="{{AppSubUrl}}/mystery" class="tw-mb-12" style="display: flex; gap: 0.5rem; flex-wrap: wrap;">
|
||||
<input type="text" name="answer" placeholder="..." autofocus
|
||||
style="flex: 1; min-width: 200px; padding: 0.75rem 1rem; font-size: 1.1rem; background: var(--color-input-background); border: 1px solid var(--color-border-primary); border-radius: 6px; color: var(--color-text);">
|
||||
<button type="submit"
|
||||
style="padding: 0.75rem 1.5rem; font-size: 1.1rem; background: var(--color-primary); color: var(--color-primary-contrast); border: none; border-radius: 6px; cursor: pointer;">
|
||||
→
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{{if .Answered}}
|
||||
<div style="display: flex; flex-direction: column; align-items: center; gap: 1rem;">
|
||||
<img src="{{AssetUrlPrefix}}/img/afradita.png" alt="Афрадита"
|
||||
style="max-width: 100%; height: auto; border-radius: 8px;">
|
||||
<p style="font-size: 1.15rem; color: var(--color-text-secondary); margin: 0;">
|
||||
Скажи мне ответ и будет приз :D
|
||||
</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
Reference in New Issue
Block a user