Add debug handler for fetching a remote actor
All checks were successful
/ docker (push) Successful in 3m59s

Will be used later to add to internal db
This commit is contained in:
Melody Becker 2025-04-12 11:47:01 +02:00
parent d4f2f66807
commit f8b3a6ff06
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
12 changed files with 313 additions and 156 deletions

View file

@ -27,6 +27,7 @@ func New(addr string) *Server {
handler.HandleFunc("GET /delete", deleteUser)
handler.HandleFunc("POST /post-as", postAs)
handler.HandleFunc("GET /notes-for", notesFrom)
handler.HandleFunc("GET /import", issueUserImport)
web := http.Server{
Addr: addr,
Handler: webutils.ChainMiddlewares(

View file

@ -13,6 +13,7 @@ import (
"git.mstar.dev/mstar/goutils/sliceutils"
"github.com/rs/zerolog/hlog"
"git.mstar.dev/mstar/linstrom/activitypub"
"git.mstar.dev/mstar/linstrom/shared"
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
"git.mstar.dev/mstar/linstrom/storage-new/models"
@ -171,3 +172,19 @@ func deleteUser(w http.ResponseWriter, r *http.Request) {
dbgen.User.Where(dbgen.User.ID.Eq(id)).Delete()
w.WriteHeader(http.StatusOK)
}
func issueUserImport(w http.ResponseWriter, r *http.Request) {
target := r.FormValue("target")
_, err := activitypub.ImportRemoteAccount(target)
hlog.FromRequest(r).Info().Err(err).Msg("Err from import request")
}
func kickoffFollow(w http.ResponseWriter, r *http.Request) {
type Inbound struct {
Id string
Target string
}
var data Inbound
dec := json.NewDecoder(r.Body)
dec.Decode(&data)
}