Files
hadrian/handlers/outline.go
2023-12-08 09:26:26 +01:00

33 lines
860 B
Go

package handlers
import (
rx "github.com/everywall/ladder/proxychain/requestmodifiers"
tx "github.com/everywall/ladder/proxychain/responsemodifiers"
"github.com/everywall/ladder/proxychain"
"github.com/gofiber/fiber/v2"
)
func NewOutlineHandler(path string, opts *ProxyOptions) fiber.Handler {
return func(c *fiber.Ctx) error {
return proxychain.
NewProxyChain().
WithAPIPath(path).
SetDebugLogging(opts.Verbose).
SetRequestModifications(
rx.MasqueradeAsGoogleBot(),
rx.ForwardRequestHeaders(),
rx.SpoofReferrerFromGoogleSearch(),
).
AddResponseModifications(
tx.SetResponseHeader("content-type", "text/html"),
tx.DeleteIncomingCookies(),
tx.RewriteHTMLResourceURLs(),
tx.GenerateReadableOutline(), // <-- this response modification does the outline rendering
).
SetFiberCtx(c).
Execute()
}
}