mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
fix removal of well-known acme challenge on letsencrypt
This commit is contained in:
parent
abc5a4cf56
commit
dded5d130a
1 changed files with 13 additions and 4 deletions
|
@ -32,7 +32,7 @@ class LetsEncryptWorker
|
||||||
end
|
end
|
||||||
|
|
||||||
site = Site[site_id]
|
site = Site[site_id]
|
||||||
return if site.domain.blank? || site.is_deleted || site.is_banned
|
return if site.domain.blank? || site.is_deleted
|
||||||
|
|
||||||
return if site.values[:domain].match /\.neocities\.org$/i
|
return if site.values[:domain].match /\.neocities\.org$/i
|
||||||
|
|
||||||
|
@ -187,10 +187,19 @@ class LetsEncryptWorker
|
||||||
end
|
end
|
||||||
|
|
||||||
def clean_wellknown_turds(site)
|
def clean_wellknown_turds(site)
|
||||||
wellknown_path = File.join(site.base_files_path, '.well-known', 'acme-challenge')
|
wellknown_path = File.join site.base_files_path, '.well-known'
|
||||||
|
acme_challenge_path = File.join wellknown_path, 'acme-challenge'
|
||||||
|
|
||||||
if File.exist?(wellknown_path)
|
if File.exist?(acme_challenge_path)
|
||||||
FileUtils.rm_rf wellknown_path
|
FileUtils.rm acme_challenge_path
|
||||||
|
site.site_files_dataset.where(path: '.well-known/acme-challenge').destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
if site.site_files_dataset.where(path: '.well-known').count == 0
|
||||||
|
begin
|
||||||
|
Dir.rmdir wellknown_path
|
||||||
|
rescue Errno::ENOTEMPTY, Errno::ENOENT
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue