mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-17 10:28:51 +00:00
Add CORS to API endpoints
This commit is contained in:
@@ -43,6 +43,18 @@ class FilteredCompressHandler < Kemal::Handler
|
||||
end
|
||||
end
|
||||
|
||||
class APIHandler < Kemal::Handler
|
||||
only ["/api/v1/*"]
|
||||
|
||||
def call(env)
|
||||
return call_next env unless only_match? env
|
||||
|
||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
|
||||
call_next env
|
||||
end
|
||||
end
|
||||
|
||||
class DenyFrame < Kemal::Handler
|
||||
exclude ["/embed/*"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user