33 lines
860 B
Go
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()
|
|
}
|
|
}
|