Add frontpage
This commit is contained in:
parent
326ef86415
commit
a737f5a773
1
main.go
1
main.go
|
@ -43,6 +43,7 @@ func main() {
|
||||||
Root: http.FS(static.GetFiles()),
|
Root: http.FS(static.GetFiles()),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
app.Get("/", pages.FrontpageHandler)
|
||||||
app.Get("/:baseName.:extension", pages.HandleMedia)
|
app.Get("/:baseName.:extension", pages.HandleMedia)
|
||||||
app.Get("/a/:albumID", pages.HandleAlbum)
|
app.Get("/a/:albumID", pages.HandleAlbum)
|
||||||
app.Get("/t/:tagID", pages.HandleAlbum)
|
app.Get("/t/:tagID", pages.HandleAlbum)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package pages
|
||||||
|
|
||||||
|
import "github.com/gofiber/fiber/v2"
|
||||||
|
|
||||||
|
func FrontpageHandler(c *fiber.Ctx) error {
|
||||||
|
c.Set("Cache-Control", "public,max-age=1800")
|
||||||
|
c.Set("X-Frame-Options", "DENY")
|
||||||
|
c.Set("Referrer-Policy", "no-referrer")
|
||||||
|
c.Set("X-Content-Type-Options", "nosniff")
|
||||||
|
c.Set("X-Robots-Tag", "noindex, noimageindex, nofollow")
|
||||||
|
c.Set("Strict-Transport-Security", "max-age=31557600")
|
||||||
|
c.Set("Permissions-Policy", "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()")
|
||||||
|
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self'; font-src 'self'; form-action 'self'; block-all-mixed-content; manifest-src 'self'")
|
||||||
|
|
||||||
|
return c.Render("frontpage", fiber.Map{})
|
||||||
|
}
|
|
@ -1,7 +1,12 @@
|
||||||
a {
|
a {
|
||||||
|
color: #1e88e5;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
{{> partials/head }}
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/static/css/frontpage.css" />
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{{> partials/header }}
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<p>An alternative frontend for Imgur. Based on <a href="https://codeberg.org/3np/rimgu">rimgu</a> and rewritten in Go.</p>
|
||||||
|
|
||||||
|
<p>It's read-only and works without JavaScript. Images and albums can be viewed without wasting resources from downloading and running tracking scripts. No sign-up nags.</p>
|
||||||
|
|
||||||
|
<h3>Try it!</h3>
|
||||||
|
|
||||||
|
<a href="/a/H8M4rcp">Album</a>
|
||||||
|
|
||||||
|
<h2>Features</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>URL-compatible with i.imgur.com - just replace the domain in the URL</li>
|
||||||
|
<li>Images and videos (gifv, mp4)</li>
|
||||||
|
<li>Albums</li>
|
||||||
|
<li>Streaming</li>
|
||||||
|
<li>Pretty CSS styling (responsive?)</li>
|
||||||
|
<li>Logo</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Usage</h2>
|
||||||
|
|
||||||
|
<p>Just replace imgur.com with the domain of this instance! You can setup automatic redirects using <a href="https://github.com/einaregilsson/Redirector">Redirector</a>.</p>
|
||||||
|
|
||||||
|
<h3>Redirector configuration</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Description: Imgur -> rimgo</li>
|
||||||
|
<li>Example URL: https://imgur.com/a/H8M4rcp</li>
|
||||||
|
<li>Include pattern: <code>^https?://(i|).?imgur.com(/.*)?$</code></li>
|
||||||
|
<li>Redirect to: <code>https://[INSTANCE DOMAIN]$2</code></li>
|
||||||
|
<li>Pattern type: Regular Expression</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{{> partials/footer }}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -14,4 +14,5 @@
|
||||||
<meta name="msapplication-config" content="/static/favicon/browserconfig.xml">
|
<meta name="msapplication-config" content="/static/favicon/browserconfig.xml">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/static/fonts/Material-Icons-Outlined.css" />
|
||||||
<link rel="stylesheet" href="/static/css/base.css"/>
|
<link rel="stylesheet" href="/static/css/base.css"/>
|
Loading…
Reference in New Issue