[MODULES] Introduce the concept of abstract modules to V3
Introduce placeholder for abstract upload and thumb modules Temporarily supress some bugs
This commit is contained in:
parent
539f1861a6
commit
ccf3aa990a
@ -19,7 +19,7 @@
|
||||
|
||||
namespace Component\Bridge;
|
||||
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
|
||||
class Bridge extends Module
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ namespace Component\Left;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Log;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Util\Common;
|
||||
use Exception;
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace Component\Media;
|
||||
|
||||
use App\Core\Cache;
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Util\Common;
|
||||
use App\Util\Nickname;
|
||||
|
||||
|
@ -23,7 +23,7 @@ use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Security;
|
||||
use App\Entity\FileToNote;
|
||||
use App\Entity\Note;
|
||||
|
@ -24,7 +24,7 @@ services:
|
||||
App\Core\Router\RouteLoader:
|
||||
tags: ['routing.loader']
|
||||
|
||||
# Wrapper arround Doctrine's StaticPHP metadata driver
|
||||
# Wrapper around Doctrine's StaticPHP metadata driver
|
||||
app.schemadef_driver:
|
||||
class: App\DependencyInjection\Compiler\SchemaDefDriver
|
||||
arguments:
|
||||
|
@ -22,7 +22,7 @@ namespace Plugin\Cover;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Util\Common;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace Plugin\Directory;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Router\RouteLoader;
|
||||
|
||||
class Directory extends Module
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace Plugin\EmailNotifications;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
|
||||
class EmailNotifications extends Module
|
||||
{
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
namespace Plugin\Embed;
|
||||
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
|
||||
/**
|
||||
* Base class for the Embed plugin that does most of the heavy lifting to get
|
||||
|
@ -22,10 +22,10 @@ namespace Plugin\Favourite;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Core\Module;
|
||||
use App\Entity\Favourite as Fave;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use Plugin\Favourite\Entity\Favourite as Fave;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -20,7 +20,7 @@
|
||||
namespace Plugin\Media;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Router\RouteLoader;
|
||||
|
||||
class Media extends Module
|
||||
|
@ -24,7 +24,7 @@ use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Entity\Note;
|
||||
use App\Entity\PollResponse;
|
||||
|
@ -22,7 +22,7 @@ namespace Plugin\ProfileColor;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Util\Common;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace Plugin\Repeat;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\NotFoundException;
|
||||
|
@ -25,7 +25,7 @@ use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exceptiion\InvalidFormException;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace Plugin\StoreRemoteMedia;
|
||||
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
|
||||
/**
|
||||
* The StoreRemoteMedia plugin downloads remotely attached files to local server.
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
namespace Plugin\TreeNotes;
|
||||
|
||||
use App\Core\Modules\Module;
|
||||
use App\Entity\Note;
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use Functional as F;
|
||||
|
||||
class TreeNotes extends Module
|
||||
{
|
||||
@ -31,7 +29,7 @@ class TreeNotes extends Module
|
||||
*/
|
||||
public function onFormatNoteList(array &$notes_in_trees_out)
|
||||
{
|
||||
$roots = array_filter($notes_in_trees_out, function(Note $note) { return $note->getReplyTo() == null; }, ARRAY_FILTER_USE_BOTH);
|
||||
$roots = array_filter($notes_in_trees_out, function (Note $note) { return $note->getReplyTo() == null; }, ARRAY_FILTER_USE_BOTH);
|
||||
$notes_in_trees_out = $this->build_tree($roots, $notes_in_trees_out);
|
||||
}
|
||||
|
||||
@ -46,7 +44,7 @@ class TreeNotes extends Module
|
||||
|
||||
private function build_subtree(Note $parent, array $notes)
|
||||
{
|
||||
$children = array_filter($notes, function(Note $n) use ($parent) { return $parent->getId() == $n->getReplyTo(); }, ARRAY_FILTER_USE_BOTH);
|
||||
$children = array_filter($notes, function (Note $n) use ($parent) { return $parent->getId() == $n->getReplyTo(); }, ARRAY_FILTER_USE_BOTH);
|
||||
return ['note' => $parent, 'replies' => $this->build_tree($children, $notes)];
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
namespace Plugin\FFmpeg;
|
||||
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
use Plugin\Media\Util\ImageFile;
|
||||
|
||||
class FFmpeg extends Module
|
23
plugins/VideoThumbnail/locale/FFmpeg.pot
Normal file
23
plugins/VideoThumbnail/locale/FFmpeg.pot
Normal file
@ -0,0 +1,23 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-08-13 03:09+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FFmpegPlugin.php:104
|
||||
msgid "Use PHP-FFMpeg for resizing animated GIFs"
|
||||
msgstr ""
|
@ -33,7 +33,7 @@
|
||||
namespace Plugin\XMPPNotifications;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Module;
|
||||
use App\Core\Modules\Module;
|
||||
|
||||
class XMPPNotifications extends Module
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Core;
|
||||
namespace App\Core\Modules;
|
||||
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
12
src/Core/Modules/RemoteAttachmentDownload.php
Normal file
12
src/Core/Modules/RemoteAttachmentDownload.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Core\Modules;
|
||||
|
||||
// Remote Download allow to create a file or to download directly as a thumbnail; same plugins as for upload will validate
|
||||
// as validation event will be the same as that of upload - same logic
|
||||
|
||||
abstract class RemoteAttachmentDownload
|
||||
{
|
||||
|
||||
}
|
11
src/Core/Modules/Thumbnail.php
Normal file
11
src/Core/Modules/Thumbnail.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Core\Modules;
|
||||
|
||||
// an interface that specifies how thumbs shall be created, allowing for generation of image, video, pdf, wtv by plugin
|
||||
|
||||
abstract class Thumbnail
|
||||
{
|
||||
|
||||
}
|
11
src/Core/Modules/Upload.php
Normal file
11
src/Core/Modules/Upload.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Core\Modules;
|
||||
|
||||
// used by avatar and attachment in note creation; plugins will be able to validate certain filetypes such as images
|
||||
|
||||
abstract class Upload
|
||||
{
|
||||
|
||||
}
|
@ -154,17 +154,6 @@ class File extends Entity
|
||||
return $this->is_local;
|
||||
}
|
||||
|
||||
public function setIsNsfw(?bool $is_nsfw): self
|
||||
{
|
||||
$this->is_nsfw = $is_nsfw;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsNsfw(): ?bool
|
||||
{
|
||||
return $this->is_nsfw;
|
||||
}
|
||||
|
||||
public function setIsUrlProtected(?bool $is_url_protected): self
|
||||
{
|
||||
$this->is_url_protected = $is_url_protected;
|
||||
@ -233,18 +222,17 @@ class File extends Entity
|
||||
return [
|
||||
'name' => 'file',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'url' => ['type' => 'text', 'description' => 'URL after following possible redirections'],
|
||||
'url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'],
|
||||
'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
|
||||
'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'description' => 'If set, used so each actor can have a version of this file (for avatars, for instance)'],
|
||||
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
|
||||
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
|
||||
'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'title of resource when available'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'],
|
||||
'is_nsfw' => ['type' => 'bool', 'default' => false, 'description' => 'whether the file is NSFW'],
|
||||
'is_url_protected' => ['type' => 'bool', 'default' => false, 'description' => 'true when URL is private (needs login)'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'remote_url' => ['type' => 'text', 'description' => 'URL after following possible redirections'],
|
||||
'remote_url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'],
|
||||
'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
|
||||
'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'description' => 'If set, used so each actor can have a version of this file (for avatars, for instance)'],
|
||||
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
|
||||
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
|
||||
'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'title of resource when available'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'],
|
||||
'source' => ['type' => 'int', 'default' => null, 'description' => 'Source of the Attachment (upload, TFN, embed)'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
|
@ -96,7 +96,7 @@ class Authenticator extends AbstractFormLoginAuthenticator
|
||||
$user = DB::findOneBy('local_user', ['or' => ['nickname' => $nick, 'outgoing_email' => $nick]]);
|
||||
} catch (Exception $e) {
|
||||
throw new CustomUserMessageAuthenticationException(
|
||||
_m('\'{nickname}\' doesn\'t match any registered nickname or email.', ['{nickname}' => $credentials['nickname']]));
|
||||
_m('\'{nickname}\' doesn\'t match any registered nickname or email.', ['nickname' => $credentials['nickname']]));
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
@ -25,9 +25,10 @@
|
||||
{% for attachment in note.getAttachments() %}
|
||||
{% if attachment.mimetype starts with 'image/' %}
|
||||
<div>
|
||||
<img src="{{ path('attachment_inline', {'id': attachment.getId()}) }}" alt="{{ attachment.getTitle() }}">
|
||||
<i> {{ attachment.getTitle() }} </i>
|
||||
</img>
|
||||
<figure>
|
||||
<img src="{{ path('attachment_inline', {'id': attachment.getId()}) }}" alt="{{ attachment.getTitle() }}">
|
||||
<figcaption> {{ attachment.getTitle() }} </figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
{% elseif attachment.mimetype starts with 'video/' %}
|
||||
<div>
|
||||
@ -45,14 +46,16 @@
|
||||
</div>
|
||||
<div class="note-actions">
|
||||
{% if have_user %}
|
||||
{% for act in get_note_actions(note) %}
|
||||
{{ form(act) }}
|
||||
{% endfor %}
|
||||
{#{% for act in get_note_actions(note) %}#}
|
||||
{#{{ form(act) }}#}
|
||||
{#{% endfor %}#}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="replies">
|
||||
{% for conversation in replies %}
|
||||
{% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if replies is defined %}
|
||||
<div class="replies">
|
||||
{% for conversation in replies %}
|
||||
{% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user