mirror of
https://github.com/neocities/neocities.git
synced 2025-04-26 18:22:38 +02:00
Merge branch 'master' of github.com:neocities/neocities
This commit is contained in:
commit
122c9eeb89
7 changed files with 40 additions and 8 deletions
|
@ -18,6 +18,9 @@ GEM
|
||||||
bcrypt (3.1.7)
|
bcrypt (3.1.7)
|
||||||
blankslate (3.1.3)
|
blankslate (3.1.3)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
|
byebug (2.7.0)
|
||||||
|
columnize (~> 0.3)
|
||||||
|
debugger-linecache (~> 1.2)
|
||||||
capybara (2.4.1)
|
capybara (2.4.1)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
|
@ -35,6 +38,7 @@ GEM
|
||||||
cocaine (0.5.4)
|
cocaine (0.5.4)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
climate_control (>= 0.0.3, < 1.0)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
|
columnize (0.8.9)
|
||||||
connection_pool (2.0.0)
|
connection_pool (2.0.0)
|
||||||
crack (0.4.2)
|
crack (0.4.2)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
|
@ -43,6 +47,7 @@ GEM
|
||||||
nokogiri (>= 1.4.2)
|
nokogiri (>= 1.4.2)
|
||||||
rack (>= 1.1.0)
|
rack (>= 1.1.0)
|
||||||
uuidtools (~> 2.1.1)
|
uuidtools (~> 2.1.1)
|
||||||
|
debugger-linecache (1.2.0)
|
||||||
docile (1.1.3)
|
docile (1.1.3)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
extlib (0.9.16)
|
extlib (0.9.16)
|
||||||
|
@ -118,6 +123,9 @@ GEM
|
||||||
coderay (~> 1.0)
|
coderay (~> 1.0)
|
||||||
method_source (~> 0.8)
|
method_source (~> 0.8)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
|
pry-byebug (1.3.2)
|
||||||
|
byebug (~> 2.7)
|
||||||
|
pry (~> 0.9.12)
|
||||||
puma (2.8.1)
|
puma (2.8.1)
|
||||||
rack (>= 1.1, < 2.0)
|
rack (>= 1.1, < 2.0)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
|
|
|
@ -110,6 +110,17 @@ end
|
||||||
get %r{\/site_files\/text_editor\/(.+)} do
|
get %r{\/site_files\/text_editor\/(.+)} do
|
||||||
require_login
|
require_login
|
||||||
@filename = params[:captures].first
|
@filename = params[:captures].first
|
||||||
|
extname = File.extname @filename
|
||||||
|
|
||||||
|
@ace_mode = case extname
|
||||||
|
when /htm|html/ then 'html'
|
||||||
|
when /js/ then 'javascript'
|
||||||
|
when /md/ then 'markdown'
|
||||||
|
when /css/ then 'css'
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@file_data = current_site.get_file @filename
|
@file_data = current_site.get_file @filename
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
|
@ -148,4 +159,4 @@ end
|
||||||
|
|
||||||
get '/site_files/mount_info' do
|
get '/site_files/mount_info' do
|
||||||
erb :'site_files/mount_info'
|
erb :'site_files/mount_info'
|
||||||
end
|
end
|
||||||
|
|
|
@ -493,7 +493,7 @@ class Site < Sequel::Model
|
||||||
# extname = uploaded_file[:filename]
|
# extname = uploaded_file[:filename]
|
||||||
#end
|
#end
|
||||||
|
|
||||||
unless (Site::VALID_MIME_TYPES.include?(mime_type) || mime_type =~ /text/) &&
|
unless (Site::VALID_MIME_TYPES.include?(mime_type) || mime_type =~ /text/ || mime_type =~ /inode\/x-empty/) &&
|
||||||
Site::VALID_EXTENSIONS.include?(extname.sub(/^./, '').downcase)
|
Site::VALID_EXTENSIONS.include?(extname.sub(/^./, '').downcase)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
0
tests/files/empty.js
Normal file
0
tests/files/empty.js
Normal file
|
@ -48,6 +48,11 @@ describe 'site_files' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'upload' do
|
describe 'upload' do
|
||||||
|
it 'works with empty files' do
|
||||||
|
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/empty.js', 'text/javascript')
|
||||||
|
File.exists?(@site.files_path('empty.js')).must_equal true
|
||||||
|
end
|
||||||
|
|
||||||
it 'manages files with invalid UTF8' do
|
it 'manages files with invalid UTF8' do
|
||||||
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/invalidutf8.html', 'text/html')
|
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/invalidutf8.html', 'text/html')
|
||||||
File.exists?(@site.files_path('invalidutf8.html')).must_equal true
|
File.exists?(@site.files_path('invalidutf8.html')).must_equal true
|
||||||
|
|
|
@ -227,6 +227,8 @@
|
||||||
$('#uploadingOverlay').css('display', 'none')
|
$('#uploadingOverlay').css('display', 'none')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allUploadsComplete = false
|
||||||
|
|
||||||
Dropzone.options.uploads = {
|
Dropzone.options.uploads = {
|
||||||
paramName: 'files',
|
paramName: 'files',
|
||||||
maxFilesize: <%= current_site.remaining_space.to_mb %>,
|
maxFilesize: <%= current_site.remaining_space.to_mb %>,
|
||||||
|
@ -235,8 +237,9 @@
|
||||||
dictDefaultMessage: '',
|
dictDefaultMessage: '',
|
||||||
uploadMultiple: true,
|
uploadMultiple: true,
|
||||||
init: function() {
|
init: function() {
|
||||||
this.on("successmultiple", function(file) {
|
this.on("completemultiple", function(file) {
|
||||||
location.reload()
|
if(allUploadsComplete == true)
|
||||||
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.on("error", function(file, errorMessage) {
|
this.on("error", function(file, errorMessage) {
|
||||||
|
@ -246,6 +249,9 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
this.on("totaluploadprogress", function(progress, totalBytes, totalBytesSent) {
|
this.on("totaluploadprogress", function(progress, totalBytes, totalBytesSent) {
|
||||||
|
if(progress == 100)
|
||||||
|
allUploadsComplete = true
|
||||||
|
|
||||||
showUploadProgress()
|
showUploadProgress()
|
||||||
$('#progressBar').css('display', 'block')
|
$('#progressBar').css('display', 'block')
|
||||||
$('#uploadingProgress').css('width', progress+'%')
|
$('#uploadingProgress').css('width', progress+'%')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
html {
|
html {
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
#editor {
|
#editor {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
@ -133,14 +133,14 @@
|
||||||
$('#editorUpdates').fadeOut(); //.addClass('hidden');
|
$('#editorUpdates').fadeOut(); //.addClass('hidden');
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#saveButton').tooltip('show')
|
$('#saveButton').tooltip('show')
|
||||||
$('#editorUpdates span').text(response)
|
$('#editorUpdates span').text(response)
|
||||||
}
|
}
|
||||||
$('#editorUpdates').fadeIn()
|
$('#editorUpdates').fadeIn()
|
||||||
$('#editorUpdates').removeClass('hidden')
|
$('#editorUpdates').removeClass('hidden')
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,9 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
editor = ace.edit("editor")
|
editor = ace.edit("editor")
|
||||||
setTheme()
|
setTheme()
|
||||||
editor.getSession().setMode("ace/mode/html")
|
<% if @ace_mode %>
|
||||||
|
editor.getSession().setMode("ace/mode/<%= @ace_mode %>")
|
||||||
|
<% end %>
|
||||||
editor.getSession().setTabSize(2)
|
editor.getSession().setTabSize(2)
|
||||||
editor.getSession().setUseWrapMode(true)
|
editor.getSession().setUseWrapMode(true)
|
||||||
editor.setFontSize(14)
|
editor.setFontSize(14)
|
||||||
|
|
Loading…
Add table
Reference in a new issue