mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
default https for cache purging and URIs
This commit is contained in:
parent
f92d6c6139
commit
f796fdf9a8
3 changed files with 5 additions and 5 deletions
|
@ -1201,7 +1201,7 @@ class Site < Sequel::Model
|
||||||
|
|
||||||
def default_schema
|
def default_schema
|
||||||
# Switch-over for when SSL defaulting is ready
|
# Switch-over for when SSL defaulting is ready
|
||||||
'http'
|
'https'
|
||||||
end
|
end
|
||||||
|
|
||||||
def uri
|
def uri
|
||||||
|
|
|
@ -20,11 +20,11 @@ class DeleteCacheWorker
|
||||||
path = '/' + path if path[0] != '/'
|
path = '/' + path if path[0] != '/'
|
||||||
|
|
||||||
url = Addressable::URI.encode_component(
|
url = Addressable::URI.encode_component(
|
||||||
"http://#{proxy_ip}/:cache/purge#{path}",
|
"https://#{proxy_ip}/:cache/purge#{path}",
|
||||||
Addressable::URI::CharacterClasses::QUERY
|
Addressable::URI::CharacterClasses::QUERY
|
||||||
)
|
)
|
||||||
|
|
||||||
HTTP.follow.timeout(read: 10, write: 10, connect: 2).
|
HTTP.timeout(read: 10, write: 10, connect: 2).
|
||||||
headers(host: URI::encode("#{username}.neocities.org")).
|
headers(host: URI::encode("#{username}.neocities.org")).
|
||||||
get(url)
|
get(url)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,14 +15,14 @@ class PurgeCacheWorker
|
||||||
path = '/' + path if path[0] != '/'
|
path = '/' + path if path[0] != '/'
|
||||||
|
|
||||||
url = Addressable::URI.encode_component(
|
url = Addressable::URI.encode_component(
|
||||||
"http://#{proxy_ip}#{path}",
|
"https://#{proxy_ip}#{path}",
|
||||||
Addressable::URI::CharacterClasses::QUERY
|
Addressable::URI::CharacterClasses::QUERY
|
||||||
)
|
)
|
||||||
|
|
||||||
retry_encoded = false
|
retry_encoded = false
|
||||||
|
|
||||||
begin
|
begin
|
||||||
HTTP.follow.timeout(read: 10, write: 10, connect: 2).
|
HTTP.timeout(read: 10, write: 10, connect: 2).
|
||||||
headers(host: URI::encode("#{username}.neocities.org"), cache_purge: '1').
|
headers(host: URI::encode("#{username}.neocities.org"), cache_purge: '1').
|
||||||
head(url)
|
head(url)
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError
|
||||||
|
|
Loading…
Add table
Reference in a new issue