feat: show status of the instance with a colored dot
Some checks failed
Build and release container directly from master / release (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.12.1, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.13.2, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.14.0, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.15.0, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (nightly, false) (push) Has been cancelled
Invidious CI / build-docker (push) Has been cancelled
Invidious CI / build-docker-arm64 (push) Has been cancelled
Invidious CI / lint (push) Has been cancelled

This commit is contained in:
Fijxu
2025-03-02 16:35:44 -03:00
parent e5c0f15398
commit 1001a72297
3 changed files with 58 additions and 7 deletions

View File

@@ -1,16 +1,55 @@
module BackendInfo
extend self
@@exvpp_url : String = ""
@@status : Int32 = 0
def get_videoplayback_proxy
def check_backends
check_videoplayback_proxy()
check_companion()
end
def check_companion
begin
response = HTTP::Client.get "#{CONFIG.invidious_companion.sample.private_url}/info"
exvpp_url = JSON.parse(response.body)["external_videoplayback_proxy"].to_s
response = HTTP::Client.get "#{CONFIG.invidious_companion.sample.private_url}/healthz"
if response.status_code == 200
@@status = 1
check_videoplayback_proxy()
else
@@status = 0
end
rescue
@@status = 0
end
end
def check_videoplayback_proxy
begin
info = HTTP::Client.get "#{CONFIG.invidious_companion.sample.private_url}/info"
exvpp_url = JSON.parse(info.body)["external_videoplayback_proxy"]?.try &.to_s
exvpp_url = "" if exvpp_url.nil?
@@exvpp_url = exvpp_url
if exvpp_url.empty?
@@status = 2
return
else
begin
exvpp_health = HTTP::Client.get "#{exvpp_url}/health"
if exvpp_health.status_code == 200
@@status = 2
return
end
rescue
@@status = 1
end
end
rescue
end
end
def get_status
return @@status
end
def get_exvpp
return @@exvpp_url
end