mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 22:56:21 +00:00
Merge branch 'usar-sutty-editor' into panel.sutty.nl
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
commit
504bbfd357
4 changed files with 26 additions and 5 deletions
|
@ -21,11 +21,26 @@ module ActiveStorage
|
||||||
def update
|
def update
|
||||||
if (token = decode_verified_token)
|
if (token = decode_verified_token)
|
||||||
if acceptable_content?(token)
|
if acceptable_content?(token)
|
||||||
named_disk_service(token[:service_name]).upload token[:key], request.body, checksum: token[:checksum]
|
|
||||||
|
|
||||||
blob = ActiveStorage::Blob.find_by_key token[:key]
|
blob = ActiveStorage::Blob.find_by_key token[:key]
|
||||||
site = Site.find_by_name token[:service_name]
|
site = Site.find_by_name token[:service_name]
|
||||||
|
|
||||||
|
if remote_file?(token)
|
||||||
|
begin
|
||||||
|
url = request.body.read
|
||||||
|
body = Down.download(url, max_size: 111.megabytes)
|
||||||
|
checksum = nil
|
||||||
|
rescue StandardError => e
|
||||||
|
ExceptionNotifier.notify_exception(e, data: { key: token[:key], url: url, site: site.name })
|
||||||
|
|
||||||
|
head :content_too_large
|
||||||
|
end
|
||||||
|
else
|
||||||
|
body = request.body
|
||||||
|
checksum = token[:checksum]
|
||||||
|
end
|
||||||
|
|
||||||
|
named_disk_service(token[:service_name]).upload token[:key], body, checksum: checksum
|
||||||
|
|
||||||
site.static_files.attach(blob)
|
site.static_files.attach(blob)
|
||||||
else
|
else
|
||||||
head :unprocessable_entity
|
head :unprocessable_entity
|
||||||
|
@ -36,6 +51,12 @@ module ActiveStorage
|
||||||
rescue ActiveStorage::IntegrityError
|
rescue ActiveStorage::IntegrityError
|
||||||
head :unprocessable_entity
|
head :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def remote_file?(token)
|
||||||
|
token[:content_type] == 'sutty/download-from-url'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -207,7 +207,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
||||||
|
|
||||||
def allowed_tags
|
def allowed_tags
|
||||||
@allowed_tags ||= %w[strong em del u mark p h1 h2 h3 h4 h5 h6 ul ol li img iframe audio video div figure blockquote
|
@allowed_tags ||= %w[strong em del u mark p h1 h2 h3 h4 h5 h6 ul ol li img iframe audio video div figure blockquote
|
||||||
figcaption a sub sup small table thead tbody tfoot tr th td br code].freeze
|
figcaption a sub sup small table thead tbody tfoot tr th td br code start type reversed].freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# Decifra el valor
|
# Decifra el valor
|
||||||
|
|
|
@ -127,4 +127,4 @@
|
||||||
%p= t('editor.word')
|
%p= t('editor.word')
|
||||||
|
|
||||||
.editor-content.form-control.h-auto.mt-1{ contenteditable: 'true' }
|
.editor-content.form-control.h-auto.mt-1{ contenteditable: 'true' }
|
||||||
= metadata.value.html_safe
|
= metadata.to_s.html_safe
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"@rails/activestorage": "^6.1.3-1",
|
"@rails/activestorage": "^6.1.3-1",
|
||||||
"@rails/ujs": "^6.1.3-1",
|
"@rails/ujs": "^6.1.3-1",
|
||||||
"@rails/webpacker": "5.2.1",
|
"@rails/webpacker": "5.2.1",
|
||||||
"@suttyweb/editor": "^0.1.14",
|
"@suttyweb/editor": "^0.1.15",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
"chart.js": "^3.5.1",
|
"chart.js": "^3.5.1",
|
||||||
"chartkick": "^4.0.5",
|
"chartkick": "^4.0.5",
|
||||||
|
|
Loading…
Reference in a new issue