mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-30 10:42:53 +00:00
Some checks are pending
Build and release container directly from master / release (push) Waiting to run
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.12.1, true) (push) Waiting to run
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.13.2, true) (push) Waiting to run
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.14.0, true) (push) Waiting to run
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.15.0, true) (push) Waiting to run
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (nightly, false) (push) Waiting to run
Invidious CI / build-docker (push) Waiting to run
Invidious CI / build-docker-arm64 (push) Waiting to run
Invidious CI / lint (push) Waiting to run
Closes https://git.nadeko.net/Fijxu/invidious/issues/109 This will allow browsers that by default set the referer to the same page to tracking via the referer header. IceCat browser does this.
17 lines
469 B
Crystal
17 lines
469 B
Crystal
{% skip_file if flag?(:api_only) %}
|
|
|
|
module Invidious::Routes::BackendSwitcher
|
|
def self.switch(env)
|
|
referer = get_referer(env, unroll: false)
|
|
backend_id = env.params.query["backend_id"]?.try &.to_i
|
|
|
|
if backend_id.nil?
|
|
return error_template(400, "Backend ID is required")
|
|
end
|
|
|
|
env.response.cookies[CONFIG.server_id_cookie_name] = Invidious::User::Cookies.server_id(env.request.headers["Host"], backend_id)
|
|
|
|
env.redirect referer
|
|
end
|
|
end
|