diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f1147333..ebab384f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -43,6 +43,9 @@ class ApplicationController < ActionController::Base
end
FILE_TYPES = {
+ '.aif' => 'audio/x-aiff',
+ '.aiff'=> 'audio/x-aiff',
+ '.avi' => 'video/x-msvideo',
'.exe' => 'application/octet-stream',
'.gif' => 'image/gif',
'.jpg' => 'image/jpeg',
@@ -50,20 +53,30 @@ class ApplicationController < ActionController::Base
'.png' => 'image/png',
'.oga' => 'audio/ogg',
'.ogg' => 'audio/ogg',
- '.ogv' => 'video/ogg',
+ '.ogv' => 'video/ogg',
+ '.mov' => 'video/quicktime',
+ '.mp3' => 'audio/mpeg',
+ '.mp4' => 'video/mp4',
'.txt' => 'text/plain',
'.tex' => 'text/plain',
+ '.wav' => 'audio/x-wav',
'.zip' => 'application/zip'
} unless defined? FILE_TYPES
DISPOSITION = {
'application/octet-stream' => 'attachment',
+ 'application/pdf' => 'inline',
'image/gif' => 'inline',
'image/jpeg' => 'inline',
- 'application/pdf' => 'inline',
'image/png' => 'inline',
+ 'audio/mpeg' => 'inline',
+ 'audio/x-wav' => 'inline',
+ 'audio/x-aiff' => 'inline',
'audio/ogg' => 'inline',
'video/ogg' => 'inline',
+ 'video/mp4' => 'inline',
+ 'video/quicktime' => 'inline',
+ 'video/x-msvideo' => 'inline',
'text/plain' => 'inline',
'application/zip' => 'attachment'
} unless defined? DISPOSITION
diff --git a/lib/chunks/wiki.rb b/lib/chunks/wiki.rb
index 277829fa..c14af2a7 100644
--- a/lib/chunks/wiki.rb
+++ b/lib/chunks/wiki.rb
@@ -105,7 +105,7 @@ module WikiChunk
unless defined? WIKI_LINK
WIKI_LINK = /(":)?\[\[\s*([^\]\s][^\]]*?)\s*\]\]/
- LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic)|(video)|(delete))$', 0)
+ LINK_TYPE_SEPARATION = Regexp.new('^(.+):((file)|(pic)|(video)|(audio)|(delete))$', 0)
ALIAS_SEPARATION = Regexp.new('^(.+)\|(.+)$', 0)
WEB_SEPARATION = Regexp.new('^(.+):(.+)$', 0)
end
diff --git a/lib/sanitizer.rb b/lib/sanitizer.rb
index 556dc4a6..a793891f 100644
--- a/lib/sanitizer.rb
+++ b/lib/sanitizer.rb
@@ -9,7 +9,7 @@ module Sanitizer
require 'node'
require 'stringsupport'
- acceptable_elements = %w[a abbr acronym address area b big blockquote br
+ acceptable_elements = %w[a abbr acronym address area audio b big blockquote br
button caption center cite code col colgroup dd del dfn dir div dl dt
em fieldset font form h1 h2 h3 h4 h5 h6 hr i img input ins kbd label
legend li map menu ol optgroup option p pre q s samp select small span
@@ -31,8 +31,8 @@ module Sanitizer
align alt axis border cellpadding cellspacing char charoff charset
checked cite class clear cols colspan color compact controls coords datetime
dir disabled enctype for frame headers height href hreflang hspace id
- ismap label lang longdesc maxlength media method multiple name nohref
- noshade nowrap prompt readonly rel rev rows rowspan rules scope
+ ismap label lang longdesc loop maxlength media method multiple name nohref
+ noshade nowrap poster prompt readonly rel rev rows rowspan rules scope
selected shape size span src start style summary tabindex target title
type usemap valign value vspace width xml:lang]
diff --git a/lib/url_generator.rb b/lib/url_generator.rb
index b7cac5f6..1a2a357d 100644
--- a/lib/url_generator.rb
+++ b/lib/url_generator.rb
@@ -35,8 +35,10 @@ class AbstractUrlGenerator
file_link(mode, name, text, web.address, known_page, description)
when :pic
pic_link(mode, name, text, web.address, known_page)
+ when :audio
+ media_link(mode, name, text, web.address, known_page, 'audio')
when :video
- video_link(mode, name, text, web.address, known_page)
+ media_link(mode, name, text, web.address, known_page, 'video')
when :delete
delete_link(mode, name, web.address, known_page)
else
@@ -143,25 +145,25 @@ class UrlGenerator < AbstractUrlGenerator
end
end
- def video_link(mode, name, text, web_address, known_vid)
+ def media_link(mode, name, text, web_address, known_media, media_type)
href = @controller.url_for :controller => 'file', :web => web_address, :action => 'file',
:id => name
case mode
when :export
- if known_vid
- %{}
+ if known_media
+ %{<#{media_type} src="#{CGI.escape(name)}" controls="controls">#{text}#{media_type}>}
else
text
end
when :publish
- if known_vid
- %{}
+ if known_media
+ %{<#{media_type} src="#{href}" controls="controls">#{text}#{media_type}>}
else
%{#{text}}
end
else
- if known_vid
- %{}
+ if known_media
+ %{<#{media_type} src="#{href}" controls="controls">#{text}#{media_type}>}
else
%{#{text}?}
end
diff --git a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb
index 6a9bf81f..e470207c 100644
--- a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb
+++ b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb
@@ -19,7 +19,7 @@ module HTML5
module HTMLSanitizeModule
- ACCEPTABLE_ELEMENTS = %w[a abbr acronym address area b big blockquote br
+ ACCEPTABLE_ELEMENTS = %w[a abbr acronym address area audio b big blockquote br
button caption center cite code col colgroup dd del dfn dir div dl dt
em fieldset font form h1 h2 h3 h4 h5 h6 hr i img input ins kbd label
legend li map menu ol optgroup option p pre q s samp select small span
@@ -41,8 +41,8 @@ module HTML5
align alt axis border cellpadding cellspacing char charoff charset
checked cite class clear cols colspan color compact controls coords datetime
dir disabled enctype for frame headers height href hreflang hspace id
- ismap label lang longdesc maxlength media method multiple name nohref
- noshade nowrap prompt readonly rel rev rows rowspan rules scope
+ ismap label lang longdesc loop maxlength media method multiple name nohref
+ noshade nowrap poster prompt readonly rel rev rows rowspan rules scope
selected shape size span src start style summary tabindex target title
type usemap valign value vspace width xml:lang]