mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 02:42:24 -05:00
add code comment
This commit is contained in:
parent
832902dd8e
commit
fcc6af163c
1 changed files with 10 additions and 0 deletions
|
|
@ -38,7 +38,17 @@ import (
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NoLLaMas returns a piece of HTTP middleware that provides a deterrence
|
||||||
|
// on routes it is applied to against bots and scrapers. It generates a
|
||||||
|
// unique but deterministic challenge for each HTTP client within an hour
|
||||||
|
// TTL time that requires a proof-of-work solution to pass onto the next
|
||||||
|
// handler in the chain. The outcome of this is that hopefully this should
|
||||||
|
// make scraping our software economically unfeasible, only when enabled
|
||||||
|
// though of course.
|
||||||
|
//
|
||||||
|
// Heavily inspired by: https://github.com/TecharoHQ/anubis
|
||||||
func NoLLaMas(getInstanceV1 func(context.Context) (*apimodel.InstanceV1, gtserror.WithCode)) gin.HandlerFunc {
|
func NoLLaMas(getInstanceV1 func(context.Context) (*apimodel.InstanceV1, gtserror.WithCode)) gin.HandlerFunc {
|
||||||
|
|
||||||
if !config.GetAdvancedScraperDeterrence() {
|
if !config.GetAdvancedScraperDeterrence() {
|
||||||
// NoLLaMas middleware disabled.
|
// NoLLaMas middleware disabled.
|
||||||
return func(*gin.Context) {}
|
return func(*gin.Context) {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue