feat: golem15.feedback plugin with the widget config route
- plugin golem15.feedback (requires golem15.user), its config, lang (en, pl), models and migrations
- typed settings singleton golem15_feedback_settings with the WinterCMS defaults and a widget key generated on first creation
- GET /_feedback/api/v1/{key}/config behind the constant-time key check and the fail-closed Origin allow-list, with the feedback-config and feedback-submit buckets
This commit is contained in:
18
routes.go
Normal file
18
routes.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package feedback
|
||||
|
||||
import (
|
||||
"git.golem15.com/golem15/sm-feedback-plugin/controllers/api"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
)
|
||||
|
||||
// Routes mounts the widget API. The public group has no auth: the widget
|
||||
// key in the path and the Origin allow-list are its gate, backed by the
|
||||
// per-IP buckets. CORS preflights (OPTIONS) on _feedback/api/* are answered
|
||||
// by surf's path-scoped CORS layer, which the application's http.cors.paths
|
||||
// must list, so no OPTIONS route is registered.
|
||||
func (p *Plugin) Routes(r pact.Router) error {
|
||||
r.Group("/_feedback/api/v1", nil, func(g pact.Router) {
|
||||
g.Get("/{key}/config", api.Config(p.app), "throttle:"+BucketConfig)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user