Browse Source

Simplify config request

master
Jan-Lukas Else 1 year ago
parent
commit
442395a83c
  1. 8
      micropub.go

8
micropub.go

@ -17,16 +17,10 @@ func HandleMicroPub(w http.ResponseWriter, r *http.Request) {
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(&MicropubConfig{
_ = json.NewEncoder(w).Encode(&MicropubConfig{
SyndicateTo: SyndicationTargets,
MediaEndpoint: MediaEndpointUrl,
})
if err != nil {
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte(err.Error()))
return
}
_, _ = w.Write(jsonBytes)
return
} else {
w.Header().Add("Content-type", "application/json")