Merge branch 'master' of github.com:neocities/neocities

This commit is contained in:
Kyle Drake 2019-10-07 07:21:24 +00:00
commit 18041d4d28
3 changed files with 7 additions and 13 deletions

View file

@ -125,13 +125,12 @@ post '/site_files/upload' do
unless params[:file_paths].nil? || params[:file_paths].empty? || params[:file_paths].length == 0 unless params[:file_paths].nil? || params[:file_paths].empty? || params[:file_paths].length == 0
file_path = params[:file_paths][i] file_path = params[:file_paths][i]
unless file_path.nil? unless file_path.nil?
dir_name += '/' + Pathname(file_path).dirname.to_s dir_name += '/' + Pathname(file_path).dirname.to_s
end end
end end
file[:filename] = "#{dir_name}/#{file[:filename]}" file[:filename] = "#{dir_name}/#{site.scrubbed_path file[:filename]}"
if current_site.file_size_too_large? file[:tempfile].size if current_site.file_size_too_large? file[:tempfile].size
file_upload_response "#{file[:filename]} is too large, upload cancelled." file_upload_response "#{file[:filename]} is too large, upload cancelled."
end end

View file

@ -1607,23 +1607,17 @@ class Site < Sequel::Model
DB["update sites set space_used=space_used#{new_size < 0 ? new_size.to_s : '+'+new_size.to_s} where id=?", self.id].first DB["update sites set space_used=space_used#{new_size < 0 ? new_size.to_s : '+'+new_size.to_s} where id=?", self.id].first
if opts[:new_install] != true if opts[:new_install] != true
if files.select {|f| f[:filename] =~ /^\/?index.html$/}.length > 0 || site_changed == true if files.select {|f| f[:filename] =~ /^\/?index.html$/}.length > 0 && site_changed != true && !empty_index?
index_changed = true DB[:sites].where(id: self.id).update site_changed: true
else
index_changed = false
end end
index_changed = false if empty_index?
time = Time.now time = Time.now
sql = DB["update sites set site_changed=?, site_updated_at=?, updated_at=?, changed_count=changed_count+1 where id=?", DB["update sites set site_updated_at=?, updated_at=?, changed_count=changed_count+1 where id=?",
index_changed,
time, time,
time, time,
self.id self.id
] ].first
sql.first
if ipfs_archiving_enabled == true if ipfs_archiving_enabled == true
ArchiveWorker.perform_in Archive::ARCHIVE_WAIT_TIME, self.id ArchiveWorker.perform_in Archive::ARCHIVE_WAIT_TIME, self.id

View file

@ -337,6 +337,7 @@
}) })
this.on("sending", function(file) { this.on("sending", function(file) {
if(file.fullPath !== undefined)
$('#uploads').append('<input type="hidden" name="file_paths[]" value="'+file.fullPath+'">') $('#uploads').append('<input type="hidden" name="file_paths[]" value="'+file.fullPath+'">')
}) })
} }