Live video on the AT Protocol
at eli/feed-error-handling 26 lines 668 B view raw
1package api 2 3import ( 4 "context" 5 _ "embed" 6 "net/http" 7 "strings" 8 9 "github.com/julienschmidt/httprouter" 10 apierrors "stream.place/streamplace/pkg/errors" 11) 12 13//go:embed app-return.html 14var appReturnHTML string 15 16func (a *StreamplaceAPI) HandleAppReturn(ctx context.Context) httprouter.Handle { 17 return func(w http.ResponseWriter, r *http.Request, params httprouter.Params) { 18 if a.CLI.AppBundleID == "" { 19 apierrors.WriteHTTPNotImplemented(w, "server has no --app-bundle-id set", nil) 20 return 21 } 22 html := strings.Replace(appReturnHTML, "APP_BUNDLE_ID_REPLACE_ME", a.CLI.AppBundleID, 1) 23 w.Header().Set("Content-Type", "text/html") 24 w.Write([]byte(html)) 25 } 26}