mirror of
https://github.com/neocities/neocities.git
synced 2025-08-04 00:31:59 +02:00
cache purge improvements, index path flusher
This commit is contained in:
parent
3a6ca6c12b
commit
4b87c818e7
6 changed files with 107 additions and 49 deletions
|
@ -574,10 +574,15 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
def purge_cache(path)
|
||||
relative_path = path.gsub(base_files_path, '')
|
||||
payload = {site: username, path: relative_path}
|
||||
payload[:domain] = domain if !domain.empty?
|
||||
PurgeCacheWorker.perform_async payload
|
||||
relative_path = path.gsub base_files_path, ''
|
||||
|
||||
# We gotta flush the dirname too if it's an index file.
|
||||
if relative_path != '' && relative_path.match(/\/$|index\.html?$/i)
|
||||
PurgeCacheOrderWorker.perform_async username, relative_path
|
||||
PurgeCacheOrderWorker.perform_async username, Pathname(relative_path).dirname.to_s
|
||||
else
|
||||
PurgeCacheOrderWorker.perform_async username, relative_path
|
||||
end
|
||||
end
|
||||
|
||||
Rye::Cmd.add_command :ipfs, nil, 'add', :r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue