diff options
| author | 2025-04-29 13:57:26 +0000 | |
|---|---|---|
| committer | 2025-04-29 13:57:26 +0000 | |
| commit | 31628019fead4489d7a57868bee110f6b6e91d09 (patch) | |
| tree | a540739f3491d23054f455e9a85afd510fbf589f /cmd | |
| parent | [bugfix] don't prevent moved accounts from invalidating their old tokens (#4091) (diff) | |
| download | gotosocial-31628019fead4489d7a57868bee110f6b6e91d09.tar.xz | |
[chore] tweak NoLLaMas proof-of-work algorithm (#4090)
# Description
- tweaks the NoLLaMas proof-of-work algorithm to further granularity on time spent computing solutions
- standardizes GoToSocial cookie security directive setting in a CookiePolicy{} type
## Checklist
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [x] I/we have performed a self-review of added code.
- [x] I/we have written code that is legible and maintainable by others.
- [x] I/we have commented the added code, particularly in hard-to-understand areas.
- [ ] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [ ] I/we have run tests and they pass locally with the changes.
- [x] I/we have run `go fmt ./...` and `golangci-lint run`.
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4090
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gotosocial/action/server/server.go | 23 | ||||
| -rw-r--r-- | cmd/gotosocial/action/testrig/testrig.go | 23 |
2 files changed, 26 insertions, 20 deletions
diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index ad9ef851e..aa04f1f12 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -478,17 +478,20 @@ var Start action.GTSAction = func(ctx context.Context) error { return fmt.Errorf("error generating session name for session middleware: %w", err) } + // Configure our instance cookie policy. + cookiePolicy := apiutil.NewCookiePolicy() + var ( - authModule = api.NewAuth(state, process, idp, routerSession, sessionName) // auth/oauth paths - clientModule = api.NewClient(state, process) // api client endpoints - metricsModule = api.NewMetrics() // Metrics endpoints - healthModule = api.NewHealth(dbService.Ready) // Health check endpoints - fileserverModule = api.NewFileserver(process) // fileserver endpoints - robotsModule = api.NewRobots() // robots.txt endpoint - wellKnownModule = api.NewWellKnown(process) // .well-known endpoints - nodeInfoModule = api.NewNodeInfo(process) // nodeinfo endpoint - activityPubModule = api.NewActivityPub(dbService, process) // ActivityPub endpoints - webModule = web.New(dbService, process) // web pages + user profiles + settings panels etc + authModule = api.NewAuth(state, process, idp, routerSession, sessionName, cookiePolicy) // auth/oauth paths + clientModule = api.NewClient(state, process) // api client endpoints + metricsModule = api.NewMetrics() // Metrics endpoints + healthModule = api.NewHealth(dbService.Ready) // Health check endpoints + fileserverModule = api.NewFileserver(process) // fileserver endpoints + robotsModule = api.NewRobots() // robots.txt endpoint + wellKnownModule = api.NewWellKnown(process) // .well-known endpoints + nodeInfoModule = api.NewNodeInfo(process) // nodeinfo endpoint + activityPubModule = api.NewActivityPub(dbService, process) // ActivityPub endpoints + webModule = web.New(dbService, process, cookiePolicy) // web pages + user profiles + settings panels etc ) // Create per-route / per-grouping middlewares. diff --git a/cmd/gotosocial/action/testrig/testrig.go b/cmd/gotosocial/action/testrig/testrig.go index e96e57b97..89e00521f 100644 --- a/cmd/gotosocial/action/testrig/testrig.go +++ b/cmd/gotosocial/action/testrig/testrig.go @@ -244,17 +244,20 @@ var Start action.GTSAction = func(ctx context.Context) error { return fmt.Errorf("error generating session name for session middleware: %w", err) } + // Configure our instance cookie policy. + cookiePolicy := apiutil.NewCookiePolicy() + var ( - authModule = api.NewAuth(state, processor, idp, routerSession, sessionName) // auth/oauth paths - clientModule = api.NewClient(state, processor) // api client endpoints - metricsModule = api.NewMetrics() // Metrics endpoints - healthModule = api.NewHealth(state.DB.Ready) // Health check endpoints - fileserverModule = api.NewFileserver(processor) // fileserver endpoints - robotsModule = api.NewRobots() // robots.txt endpoint - wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints - nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint - activityPubModule = api.NewActivityPub(state.DB, processor) // ActivityPub endpoints - webModule = web.New(state.DB, processor) // web pages + user profiles + settings panels etc + authModule = api.NewAuth(state, processor, idp, routerSession, sessionName, cookiePolicy) // auth/oauth paths + clientModule = api.NewClient(state, processor) // api client endpoints + metricsModule = api.NewMetrics() // Metrics endpoints + healthModule = api.NewHealth(state.DB.Ready) // Health check endpoints + fileserverModule = api.NewFileserver(processor) // fileserver endpoints + robotsModule = api.NewRobots() // robots.txt endpoint + wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints + nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint + activityPubModule = api.NewActivityPub(state.DB, processor) // ActivityPub endpoints + webModule = web.New(state.DB, processor, cookiePolicy) // web pages + user profiles + settings panels etc ) // these should be routed in order |
