[SLOYD] add status OPTIONS

This commit is contained in:
Milovann Yanatchkov 2024-04-06 11:28:21 +02:00
parent e366251b50
commit cd82973775
2 changed files with 4 additions and 1 deletions

View file

@ -61,5 +61,7 @@ func UserStatus(ctx *context.Context) {
if ctx.IsSigned { if ctx.IsSigned {
ctx.Data["UserName"] = ctx.Doer.DisplayName() ctx.Data["UserName"] = ctx.Doer.DisplayName()
} }
ctx.Resp.Header().Add("Access-Control-Allow-Origin", "*")
ctx.HTML(http.StatusOK, tplStatus) ctx.HTML(http.StatusOK, tplStatus)
} }

View file

@ -431,7 +431,8 @@ func registerRoutes(m *web.Route) {
// Especially some AJAX requests, we can reduce middleware number to improve performance. // Especially some AJAX requests, we can reduce middleware number to improve performance.
m.Get("/", Home) m.Get("/", Home)
m.Get("/status", UserStatus) //m.Get("/status", UserStatus)
m.Methods("GET, HEAD, OPTIONS", "/status", UserStatus, optionsCorsHandler())
m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap) m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap)
m.Group("/.well-known", func() { m.Group("/.well-known", func() {
m.Get("/openid-configuration", auth.OIDCWellKnown) m.Get("/openid-configuration", auth.OIDCWellKnown)