mirror of
https://github.com/neocities/neocities.git
synced 2025-07-26 04:18:22 +02:00
cache manifest, otf fonts
This commit is contained in:
parent
0de126d6b1
commit
fe5b47ce53
4 changed files with 22 additions and 8 deletions
|
@ -17,6 +17,7 @@ class Site < Sequel::Model
|
||||||
image/svg+xml
|
image/svg+xml
|
||||||
application/vnd.ms-fontobject
|
application/vnd.ms-fontobject
|
||||||
application/x-font-ttf
|
application/x-font-ttf
|
||||||
|
application/vnd.ms-opentype
|
||||||
application/octet-stream
|
application/octet-stream
|
||||||
text/csv
|
text/csv
|
||||||
text/tsv
|
text/tsv
|
||||||
|
@ -28,10 +29,11 @@ class Site < Sequel::Model
|
||||||
text/xml
|
text/xml
|
||||||
application/xml
|
application/xml
|
||||||
audio/midi
|
audio/midi
|
||||||
|
text/cache-manifest
|
||||||
}
|
}
|
||||||
|
|
||||||
VALID_EXTENSIONS = %w{
|
VALID_EXTENSIONS = %w{
|
||||||
html htm txt text css js jpg jpeg png gif svg md markdown eot ttf woff woff2 json
|
html htm txt text css js jpg jpeg png gif svg md markdown eot ttf woff woff2 json geojson csv tsv mf ico pdf asc key pgp xml mid midi manifest otf
|
||||||
geojson csv tsv mf ico pdf asc key pgp xml mid midi manifest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MINIMUM_PASSWORD_LENGTH = 5
|
MINIMUM_PASSWORD_LENGTH = 5
|
||||||
|
@ -464,9 +466,10 @@ class Site < Sequel::Model
|
||||||
mime_type = Magic.guess_file_mime_type uploaded_file[:tempfile].path
|
mime_type = Magic.guess_file_mime_type uploaded_file[:tempfile].path
|
||||||
extname = File.extname uploaded_file[:filename]
|
extname = File.extname uploaded_file[:filename]
|
||||||
|
|
||||||
if extname == ''
|
# Possibly needed logic for .dotfiles
|
||||||
extname = uploaded_file[:filename]
|
#if extname == ''
|
||||||
end
|
# extname = uploaded_file[:filename]
|
||||||
|
#end
|
||||||
|
|
||||||
unless (Site::VALID_MIME_TYPES.include?(mime_type) || mime_type =~ /text/) &&
|
unless (Site::VALID_MIME_TYPES.include?(mime_type) || mime_type =~ /text/) &&
|
||||||
Site::VALID_EXTENSIONS.include?(extname.sub(/^./, '').downcase)
|
Site::VALID_EXTENSIONS.include?(extname.sub(/^./, '').downcase)
|
||||||
|
|
7
tests/files/cache.manifest
Normal file
7
tests/files/cache.manifest
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
CACHE MANIFEST
|
||||||
|
NETWORK:
|
||||||
|
/test.html
|
||||||
|
CACHE:
|
||||||
|
/test.css
|
||||||
|
/test.js
|
||||||
|
/test.png
|
BIN
tests/files/chunkfive.otf
Normal file
BIN
tests/files/chunkfive.otf
Normal file
Binary file not shown.
|
@ -40,9 +40,13 @@ describe 'site_files' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'works with manifest files' do
|
it 'works with manifest files' do
|
||||||
$debug = true
|
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/cache.manifest', 'text/cache-manifest')
|
||||||
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/.manifest', 'text/plain')
|
File.exists?(@site.files_path('cache.manifest')).must_equal true
|
||||||
File.exists?(@site.files_path('.manifest')).must_equal true
|
end
|
||||||
|
|
||||||
|
it 'works with otf fonts' do
|
||||||
|
upload 'files[]' => Rack::Test::UploadedFile.new('./tests/files/chunkfive.otf', 'application/vnd.ms-opentype')
|
||||||
|
File.exists?(@site.files_path('chunkfive.otf')).must_equal true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'succeeds with index.html file' do
|
it 'succeeds with index.html file' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue