Live video on the AT Protocol
at eli/director-panic 29 lines 793 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 "stream.place/streamplace/pkg/log" 12) 13 14//go:embed app-return.html 15var appReturnHTML string 16 17func (a *StreamplaceAPI) HandleAppReturn(ctx context.Context) httprouter.Handle { 18 return func(w http.ResponseWriter, r *http.Request, params httprouter.Params) { 19 if a.CLI.AppBundleID == "" { 20 apierrors.WriteHTTPNotImplemented(w, "server has no --app-bundle-id set", nil) 21 return 22 } 23 html := strings.Replace(appReturnHTML, "APP_BUNDLE_ID_REPLACE_ME", a.CLI.AppBundleID, 1) 24 w.Header().Set("Content-Type", "text/html") 25 if _, err := w.Write([]byte(html)); err != nil { 26 log.Error(ctx, "error writing response", "error", err) 27 } 28 } 29}