[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:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user