move auth and favicon form main to handlers, linting
This commit is contained in:
25
handlers/auth.go
Normal file
25
handlers/auth.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/basicauth"
|
||||
)
|
||||
|
||||
func Auth() fiber.Handler {
|
||||
userpass := os.Getenv("USERPASS")
|
||||
if userpass != "" {
|
||||
userpass := strings.Split(userpass, ":")
|
||||
return basicauth.New(basicauth.Config{
|
||||
Users: map[string]string{
|
||||
userpass[0]: userpass[1],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return func(c *fiber.Ctx) error {
|
||||
return c.Next()
|
||||
}
|
||||
}
|
||||
18
handlers/favicon.go
Normal file
18
handlers/favicon.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/favicon"
|
||||
)
|
||||
|
||||
//go:embed favicon.ico
|
||||
var faviconData string
|
||||
|
||||
func Favicon() fiber.Handler {
|
||||
return favicon.New(favicon.Config{
|
||||
Data: []byte(faviconData),
|
||||
URL: "/favicon.ico",
|
||||
})
|
||||
}
|
||||
BIN
handlers/favicon.ico
Normal file
BIN
handlers/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -33,13 +33,13 @@ func NewProxySiteHandler(opts *ProxyOptions) fiber.Handler {
|
||||
SetRequestModifications(
|
||||
// rx.SpoofJA3fingerprint(ja3, "Googlebot"),
|
||||
// rx.MasqueradeAsFacebookBot(),
|
||||
//rx.MasqueradeAsGoogleBot(),
|
||||
// rx.MasqueradeAsGoogleBot(),
|
||||
rx.DeleteOutgoingCookies(),
|
||||
rx.ForwardRequestHeaders(),
|
||||
//rx.SpoofReferrerFromGoogleSearch(),
|
||||
// rx.SpoofReferrerFromGoogleSearch(),
|
||||
rx.SpoofReferrerFromLinkedInPost(),
|
||||
//rx.RequestWaybackMachine(),
|
||||
//rx.RequestArchiveIs(),
|
||||
// rx.RequestWaybackMachine(),
|
||||
// rx.RequestArchiveIs(),
|
||||
).
|
||||
AddResponseModifications(
|
||||
tx.ForwardResponseHeaders(),
|
||||
|
||||
Reference in New Issue
Block a user