cloudflare: fix purging of cached urls.

* Switch CloudflareService from HttpartyCache to Danbooru::Http.

* Purge cached urls from Cloudflare when a post is replaced and the md5
  doesn't change. This happens when a corrupted image is replaced or
  thumbnails are regenerated. Before we purged urls when a post was
  expunged, which was unneeded because those urls can expire naturally.
  It was also wrong because the subdomains were hardcoded, the urls used
  http:// instead of https://, and we didn't account for tagged urls.
This commit is contained in:
evazion
2019-12-15 14:03:15 -06:00
parent 15d737d68b
commit 518de2fdec
4 changed files with 37 additions and 39 deletions

View File

@@ -77,10 +77,6 @@ class Post < ApplicationRecord
Danbooru.config.backup_storage_manager.delete_file(post_id, md5, file_ext, :original)
Danbooru.config.backup_storage_manager.delete_file(post_id, md5, file_ext, :large)
Danbooru.config.backup_storage_manager.delete_file(post_id, md5, file_ext, :preview)
if Danbooru.config.cloudflare_key
CloudflareService.new.delete(md5, file_ext)
end
end
end