A factory spec's personal flags come from Scout. For a factory-generated plugin, names, sample shapes, visitor form fields and migration columns now mark personal data too, and the stricter result applies. A public route that reads a site data table, or personal plugin settings, fails check 33. frontend.go, plugin_egress.go, plugin_html.go and plugin_routes.go carry the lint autofixes check 3 applies to this repo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1014 B
Go
42 lines
1014 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"git.dev.alexdunmow.com/block/pluginsdk/plugin"
|
|
"git.dev.alexdunmow.com/block/pluginsdk/route"
|
|
)
|
|
|
|
const pluginName = "signups-3f2a10"
|
|
|
|
// Registration is the plugin entry registration.
|
|
var Registration = plugin.PluginRegistration{
|
|
Name: pluginName,
|
|
Version: "1.0.0",
|
|
HTTPHandler: newHTTPHandler,
|
|
}
|
|
|
|
var current plugin.CoreServices
|
|
|
|
func newHTTPHandler(deps plugin.CoreServices) http.Handler {
|
|
current = deps
|
|
r := route.New(pluginName)
|
|
r.Handle(http.MethodGet, "/signups", route.Public, handleSignups)
|
|
return r
|
|
}
|
|
|
|
func handleSignups(w http.ResponseWriter, r *http.Request) {
|
|
table, err := current.DataTables.GetTableByKey(r.Context(), "signups")
|
|
if err != nil {
|
|
http.Error(w, "not found", http.StatusNotFound)
|
|
return
|
|
}
|
|
rows, err := current.DataTables.ListRows(r.Context(), table.ID, 100, 0)
|
|
if err != nil {
|
|
http.Error(w, "could not load sign-ups", http.StatusInternalServerError)
|
|
return
|
|
}
|
|
_ = json.NewEncoder(w).Encode(rows)
|
|
}
|