mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add port number to host URL
This commit is contained in:
parent
2a1befb41a
commit
1435516a9c
3 changed files with 30 additions and 18 deletions
|
@ -197,7 +197,7 @@ def subscribe_pubsub(ucid, key, config)
|
|||
nonce = Random::Secure.hex(4)
|
||||
signature = "#{time}:#{nonce}"
|
||||
|
||||
host_url = make_host_url(Kemal.config.ssl || config.https_only, config.domain)
|
||||
host_url = make_host_url(config, Kemal.config)
|
||||
|
||||
body = {
|
||||
"hub.callback" => "#{host_url}/feed/webhook/v1:#{time}:#{nonce}:#{OpenSSL::HMAC.hexdigest(:sha1, key, signature)}",
|
||||
|
|
|
@ -193,19 +193,28 @@ def arg_array(array, start = 1)
|
|||
return args
|
||||
end
|
||||
|
||||
def make_host_url(ssl, host)
|
||||
def make_host_url(config, kemal_config)
|
||||
ssl = config.https_only || kemal_config.ssl
|
||||
|
||||
if ssl
|
||||
scheme = "https://"
|
||||
else
|
||||
scheme = "http://"
|
||||
end
|
||||
|
||||
if host
|
||||
host = host.lchop(".")
|
||||
return "#{scheme}#{host}"
|
||||
if kemal_config.port != 80 && kemal_config.port != 443
|
||||
port = ":#{kemal_config.port}"
|
||||
else
|
||||
port = ""
|
||||
end
|
||||
|
||||
if !config.domain
|
||||
return ""
|
||||
end
|
||||
|
||||
host = config.domain.not_nil!.lchop(".")
|
||||
|
||||
return "#{scheme}#{host}#{port}"
|
||||
end
|
||||
|
||||
def get_referer(env, fallback = "/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue