small fixes

This commit is contained in:
Laptop
2025-01-01 12:36:56 +02:00
parent 47fb96fdda
commit c71b890143
5 changed files with 9 additions and 11 deletions

View File

@@ -93,7 +93,7 @@ type Export struct {
Preferences *cfg.Preferences `json:",omitempty"` Preferences *cfg.Preferences `json:",omitempty"`
} }
func Load(r fiber.Router) { func Load(r *fiber.App) {
r.Get("/_/preferences", func(c fiber.Ctx) error { r.Get("/_/preferences", func(c fiber.Ctx) error {
p, err := Get(c) p, err := Get(c)
if err != nil { if err != nil {

View File

@@ -13,7 +13,7 @@ import (
var httpc *fasthttp.HostClient var httpc *fasthttp.HostClient
var al_httpc *fasthttp.HostClient var al_httpc *fasthttp.HostClient
func Load(r fiber.Router) { func Load(r *fiber.App) {
httpc = &fasthttp.HostClient{ httpc = &fasthttp.HostClient{
Addr: cfg.ImageCDN + ":443", Addr: cfg.ImageCDN + ":443",
IsTLS: true, IsTLS: true,

View File

@@ -14,7 +14,7 @@ import (
var httpc *fasthttp.HostClient var httpc *fasthttp.HostClient
var httpc_aac *fasthttp.HostClient var httpc_aac *fasthttp.HostClient
func Load(r fiber.Router) { func Load(r *fiber.App) {
httpc = &fasthttp.HostClient{ httpc = &fasthttp.HostClient{
Addr: cfg.HLSCDN + ":443", Addr: cfg.HLSCDN + ":443",
IsTLS: true, IsTLS: true,

View File

@@ -194,7 +194,7 @@ func (c *collector) Write(data []byte) (n int, err error) {
return len(data), nil return len(data), nil
} }
func Load(r fiber.Router) { func Load(r *fiber.App) {
httpc = &fasthttp.HostClient{ httpc = &fasthttp.HostClient{
Addr: cfg.HLSCDN + ":443", Addr: cfg.HLSCDN + ":443",
IsTLS: true, IsTLS: true,

View File

@@ -66,7 +66,7 @@ func (staticfs) Open(name string) (fs.File, error) {
// stubby implementation of static middleware // stubby implementation of static middleware
// why? mainly because of the pathrewrite // why? mainly because of the pathrewrite
// i hate seeing it trying to get root directory // i hate seeing it trying to get root directory
func ServeFromFS(r fiber.Router, filesystem fs.FS) { func ServeFromFS(r *fiber.App, filesystem fs.FS) {
const path = "/_/static" const path = "/_/static"
const l = len(path) const l = len(path)
fs := fasthttp.FS{ fs := fasthttp.FS{
@@ -161,12 +161,10 @@ func main() {
// why? because when you load a page without link rel="icon" the browser will // why? because when you load a page without link rel="icon" the browser will
// try to load favicon from default location, // try to load favicon from default location,
// and this path loads the user "favicon.ico" by default // and this path loads the user "favicon" by default
if cfg.Debug {
app.Get("favicon.ico", func(c fiber.Ctx) error { app.Get("favicon.ico", func(c fiber.Ctx) error {
return c.Redirect().To("/_/static/favicon.ico") return c.Redirect().To("/_/static/favicon.ico")
}) })
}
app.Get("/search", func(c fiber.Ctx) error { app.Get("/search", func(c fiber.Ctx) error {
prefs, err := preferences.Get(c) prefs, err := preferences.Get(c)