forked from GNUsocial/gnu-social
[COMPONENT][Attachment] Do not show download links for non-local attachments
This commit is contained in:
parent
ff5f346fec
commit
582519e13e
|
@ -2,8 +2,12 @@
|
||||||
<figure>
|
<figure>
|
||||||
<audio class="u-audio" src="{{ attachment.getUrl() }}" controls>
|
<audio class="u-audio" src="{{ attachment.getUrl() }}" controls>
|
||||||
</audio>
|
</audio>
|
||||||
<figcaption><a
|
<figcaption>
|
||||||
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
{% if attachment.getFilename() is not null %}
|
||||||
|
<a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ attachment.getBestTitle(note) }}
|
||||||
|
{% endif %}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
src="{{ attachment.getThumbnailUrl() }}"
|
src="{{ attachment.getThumbnailUrl() }}"
|
||||||
width="{{ thumbnail.getWidth() }}"
|
width="{{ thumbnail.getWidth() }}"
|
||||||
height="{{ thumbnail.getHeight() }}">
|
height="{{ thumbnail.getHeight() }}">
|
||||||
<figcaption><a
|
<figcaption>
|
||||||
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
{% if attachment.getFilename() is not null %}
|
||||||
</figcaption>
|
<a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ attachment.getBestTitle(note) }}
|
||||||
|
{% endif %}
|
||||||
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
@ -78,7 +78,7 @@ class StoreRemoteMedia extends Plugin
|
||||||
|
|
||||||
private function getStoreOriginal(): bool
|
private function getStoreOriginal(): bool
|
||||||
{
|
{
|
||||||
return $this->store_original;
|
return $this->store_original ?? Common::config('plugin_store_remote_media', 'store_original');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getThumbnailWidth(): int
|
private function getThumbnailWidth(): int
|
||||||
|
@ -93,12 +93,12 @@ class StoreRemoteMedia extends Plugin
|
||||||
|
|
||||||
private function getMaxSize(): int
|
private function getMaxSize(): int
|
||||||
{
|
{
|
||||||
return $this->max_size ?? Common::config('attachments', 'file_quota');
|
return $this->max_size ?? Common::config('plugin_store_remote_media', 'max_file_size');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSmartCrop(): bool
|
private function getSmartCrop(): bool
|
||||||
{
|
{
|
||||||
return $this->smart_crop ?? Common::config('thumbnail', 'smart_crop');
|
return $this->smart_crop ?? Common::config('plugin_store_remote_media', 'smart_crop');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +127,7 @@ class StoreRemoteMedia extends Plugin
|
||||||
);
|
);
|
||||||
|
|
||||||
// If it was handled already
|
// If it was handled already
|
||||||
|
// XXX: Maybe it would be interesting to have retroactive application of $this->getOriginal here
|
||||||
if (!\is_null($attachment_to_link)) {
|
if (!\is_null($attachment_to_link)) {
|
||||||
// Relate the note with the existing attachment
|
// Relate the note with the existing attachment
|
||||||
DB::persist(AttachmentToNote::create([
|
DB::persist(AttachmentToNote::create([
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
<figure>
|
<figure>
|
||||||
<video class="u-video" src="{{ attachment.getUrl() }}" controls poster="{{ attachment.getThumbnailUrl('medium')}}">
|
<video class="u-video" src="{{ attachment.getUrl() }}" controls poster="{{ attachment.getThumbnailUrl('medium')}}">
|
||||||
</video>
|
</video>
|
||||||
<figcaption><a
|
<figcaption>
|
||||||
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
{% if attachment.getFilename() is not null %}
|
||||||
|
<a href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getBestTitle(note) }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ attachment.getBestTitle(note) }}
|
||||||
|
{% endif %}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -129,6 +129,7 @@ parameters:
|
||||||
extension: '.webp'
|
extension: '.webp'
|
||||||
|
|
||||||
plugin_store_remote_media:
|
plugin_store_remote_media:
|
||||||
|
store_original: false
|
||||||
max_file_size: 4000000
|
max_file_size: 4000000
|
||||||
smart_crop: false
|
smart_crop: false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue