mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-14 00:55:10 +00:00
Remove DEPRECATED session tokens
They are not used anymore at all, 100% deprecated as they are not used anymore
This commit is contained in:
@@ -210,12 +210,6 @@ Invidious::Jobs.register Invidious::Jobs::ClearExpiredItemsJob.new
|
||||
|
||||
Invidious::Jobs.register Invidious::Jobs::InstanceListRefreshJob.new
|
||||
|
||||
if !CONFIG.tokens_server.empty?
|
||||
Invidious::Jobs.register Invidious::Jobs::RefreshSessionTokens.new
|
||||
else
|
||||
LOGGER.info("jobs: Disabling RefreshSessionTokens job. Invidious will use the tokens that are on the configuration file")
|
||||
end
|
||||
|
||||
if CONFIG.invidious_companion.present?
|
||||
Invidious::Jobs.register Invidious::Jobs::CheckBackend.new
|
||||
else
|
||||
|
||||
@@ -229,8 +229,6 @@ class Config
|
||||
|
||||
property server_id_cookie_name : String = "COMPANION_ID"
|
||||
|
||||
property tokens_server : String = ""
|
||||
|
||||
property video_cache : VideoCacheConfig = VideoCacheConfig.from_yaml("")
|
||||
|
||||
class VideoCacheConfig
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
module SessionTokens
|
||||
extend self
|
||||
@@po_token : String | Nil
|
||||
@@visitor_data : String | Nil
|
||||
|
||||
def refresh_tokens
|
||||
begin
|
||||
response = HTTP::Client.get "#{CONFIG.tokens_server}/generate"
|
||||
if !response.status_code == 200
|
||||
LOGGER.error("RefreshSessionTokens: Expected response to have status code 200 but got #{response.status_code} from #{CONFIG.tokens_server}")
|
||||
end
|
||||
json = JSON.parse(response.body)
|
||||
@@po_token = json.try &.["potoken"].as_s || nil
|
||||
@@visitor_data = json.try &.["visitorData"].as_s || nil
|
||||
rescue ex
|
||||
LOGGER.error("RefreshSessionTokens: Failed to fetch tokens from #{CONFIG.tokens_server}: #{ex.message}")
|
||||
return
|
||||
end
|
||||
|
||||
if !@@po_token.nil? && !@@visitor_data.nil?
|
||||
set_tokens
|
||||
LOGGER.debug("RefreshSessionTokens: Successfully updated po_token and visitor_data")
|
||||
else
|
||||
LOGGER.warn("RefreshSessionTokens: Tokens are empty!. Invidious will use the tokens that are on the configuration file")
|
||||
end
|
||||
LOGGER.trace("RefreshSessionTokens: Tokens are:")
|
||||
LOGGER.trace("RefreshSessionTokens: po_token: #{CONFIG.po_token}")
|
||||
LOGGER.trace("RefreshSessionTokens: visitor_data: #{CONFIG.visitor_data}")
|
||||
end
|
||||
|
||||
def set_tokens
|
||||
CONFIG.po_token = @@po_token
|
||||
CONFIG.visitor_data = @@visitor_data
|
||||
end
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
class Invidious::Jobs::RefreshSessionTokens < Invidious::Jobs::BaseJob
|
||||
def initialize
|
||||
end
|
||||
|
||||
def begin
|
||||
loop do
|
||||
SessionTokens.refresh_tokens
|
||||
LOGGER.info("RefreshTokens: Done, sleeping for 5 seconds")
|
||||
sleep 5.seconds
|
||||
Fiber.yield
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user