forked from midou/invidious
Add support to make invidious API-only via flag (#2363)
This commit is contained in:
parent
3e781b7d13
commit
81b12b8001
@ -312,6 +312,7 @@ before_all do |env|
|
|||||||
env.set "current_page", URI.encode_www_form(current_page)
|
env.set "current_page", URI.encode_www_form(current_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
{% unless flag?(:api_only) %}
|
||||||
Invidious::Routing.get "/", Invidious::Routes::Misc, :home
|
Invidious::Routing.get "/", Invidious::Routes::Misc, :home
|
||||||
Invidious::Routing.get "/privacy", Invidious::Routes::Misc, :privacy
|
Invidious::Routing.get "/privacy", Invidious::Routes::Misc, :privacy
|
||||||
Invidious::Routing.get "/licenses", Invidious::Routes::Misc, :licenses
|
Invidious::Routing.get "/licenses", Invidious::Routes::Misc, :licenses
|
||||||
@ -386,6 +387,7 @@ Invidious::Routing.get "/feeds/videos.xml", Invidious::Routes::Feeds, :rss_video
|
|||||||
# Support push notifications via PubSubHubbub
|
# Support push notifications via PubSubHubbub
|
||||||
Invidious::Routing.get "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_get
|
Invidious::Routing.get "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_get
|
||||||
Invidious::Routing.post "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_post
|
Invidious::Routing.post "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_post
|
||||||
|
{% end %}
|
||||||
|
|
||||||
# API routes (macro)
|
# API routes (macro)
|
||||||
define_v1_api_routes()
|
define_v1_api_routes()
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Channels
|
module Invidious::Routes::Channels
|
||||||
def self.home(env)
|
def self.home(env)
|
||||||
self.videos(env)
|
self.videos(env)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Embed
|
module Invidious::Routes::Embed
|
||||||
def self.redirect(env)
|
def self.redirect(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Feeds
|
module Invidious::Routes::Feeds
|
||||||
def self.view_all_playlists_redirect(env)
|
def self.view_all_playlists_redirect(env)
|
||||||
env.redirect "/feed/playlists"
|
env.redirect "/feed/playlists"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Login
|
module Invidious::Routes::Login
|
||||||
def self.login_page(env)
|
def self.login_page(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Misc
|
module Invidious::Routes::Misc
|
||||||
def self.home(env)
|
def self.home(env)
|
||||||
preferences = env.get("preferences").as(Preferences)
|
preferences = env.get("preferences").as(Preferences)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Playlists
|
module Invidious::Routes::Playlists
|
||||||
def self.new(env)
|
def self.new(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::PreferencesRoute
|
module Invidious::Routes::PreferencesRoute
|
||||||
def self.show(env)
|
def self.show(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Search
|
module Invidious::Routes::Search
|
||||||
def self.opensearch(env)
|
def self.opensearch(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% skip_file if flag?(:api_only) %}
|
||||||
|
|
||||||
module Invidious::Routes::Watch
|
module Invidious::Routes::Watch
|
||||||
def self.handle(env)
|
def self.handle(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
Loading…
Reference in New Issue
Block a user