mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-10-30 20:22:00 +00:00 
			
		
		
		
	Combine notifications endpoints and move them
This commit is contained in:
		| @@ -405,8 +405,6 @@ Invidious::Routing.get "/vi/:id/:name", Invidious::Routes::Images, :thumbnails | ||||
|  | ||||
| # API routes (macro) | ||||
| define_v1_api_routes() | ||||
| Invidious::Routing.get "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_get | ||||
| Invidious::Routing.post "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_post | ||||
|  | ||||
| # Video playback (macros) | ||||
| define_api_manifest_routes() | ||||
|   | ||||
| @@ -398,19 +398,11 @@ module Invidious::Routes::API::V1::Authenticated | ||||
|     env.response.status_code = 204 | ||||
|   end | ||||
|  | ||||
|   def self.notifications_get(env) | ||||
|   def self.notifications(env) | ||||
|     env.response.content_type = "text/event-stream" | ||||
|  | ||||
|     topics = env.params.query["topics"]?.try &.split(",").uniq.first(1000) | ||||
|     topics ||= [] of String | ||||
|  | ||||
|     create_notification_stream(env, topics, CONNECTION_CHANNEL) | ||||
|   end | ||||
|  | ||||
|   def self.notifications_post(env) | ||||
|     env.response.content_type = "text/event-stream" | ||||
|  | ||||
|     topics = env.params.body["topics"]?.try &.split(",").uniq.first(1000) | ||||
|     raw_topics = env.params.body["topics"]? || env.params.query["topics"]? | ||||
|     topics = raw_topics.try &.split(",").uniq.first(1000) | ||||
|     topics ||= [] of String | ||||
|  | ||||
|     create_notification_stream(env, topics, CONNECTION_CHANNEL) | ||||
|   | ||||
| @@ -96,6 +96,9 @@ macro define_v1_api_routes | ||||
|   Invidious::Routing.post "/api/v1/auth/tokens/register", {{namespace}}::Authenticated, :register_token | ||||
|   Invidious::Routing.post "/api/v1/auth/tokens/unregister", {{namespace}}::Authenticated, :unregister_token | ||||
|  | ||||
|   Invidious::Routing.get "/api/v1/auth/notifications", {{namespace}}::Authenticated, :notifications | ||||
|   Invidious::Routing.post "/api/v1/auth/notifications", {{namespace}}::Authenticated, :notifications | ||||
|  | ||||
|   # Misc | ||||
|   Invidious::Routing.get "/api/v1/stats", {{namespace}}::Misc, :stats | ||||
|   Invidious::Routing.get "/api/v1/playlists/:plid", {{namespace}}::Misc, :get_playlist | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 matthewmcgarvey
					matthewmcgarvey