diff --git a/micropub.go b/micropub.go index ff3a85e..afe4efc 100644 --- a/micropub.go +++ b/micropub.go @@ -7,13 +7,19 @@ import ( "time" ) +type MicropubConfig struct { + SyndicateTo []SyndicationTarget `json:"syndicate-to,omitempty"` +} + func HandleMicroPub(w http.ResponseWriter, r *http.Request) { // a handler for GET requests, used for troubleshooting if r.Method == "GET" { - if q := r.URL.Query().Get("q"); q == "syndicate-to" { + if q := r.URL.Query().Get("q"); q == "config" || q == "syndicate-to" { w.Header().Add("Content-type", "application/json") w.WriteHeader(http.StatusOK) - jsonBytes, err := json.Marshal(SyndicationTargets) + jsonBytes, err := json.Marshal(&MicropubConfig{ + SyndicateTo: SyndicationTargets, + }) if err != nil { w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(err.Error()))