Skip to content

Commit

Permalink
[R] release 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
lordbecvold committed May 24, 2024
1 parent 6061d38 commit fb7cc2a
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 58 deletions.
Binary file added .github/images/browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/gallery-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

# setup PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

# install composer dependencies
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest
working-directory: ./backend

# test PSR-12 coding standard
- name: Run PHP CodeSniffer
run: vendor/bin/phpcs
working-directory: ./backend
15 changes: 7 additions & 8 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Engal
Self-hosted media cloud storage.

## TODOS: version 4.5
- [ ] Dynamic gallery loading timeout calculator
- [ ] Split frontend into multiple components
- [ ] Validate inputs with symfony validator (DTO)
## Gallery list
![Gallery list](.github/images/gallery-list.png)

## Gallery browser
![Gallery browser](.github/images/browser.png)

## TODOS: version 5.0
- [ ] Browse all galleries
- [ ] All gallery browser
- [ ] Sorting (by: default(by database id), name, upload_time, edit_time, random)
- [ ] Gallery info (show gallery data: count, owner, time data)
- [ ] Gallery share (configurate in gallery info), (use owner_id in databse [json/array])
- [ ] Media info (get media data, name, gallery_name, size, type, time data, use getID3 lib)
- [ ] Media delete function
- [ ] Media edit (name, replace file with reupload)
- [ ] Media move (move to gallery), single or multiple
- [ ] Favorite gallery

## TODOS: version 6.0
- [ ] Data wipe command (drop all users, logs, storage data)
- [ ] Backup command (extract all media to tar.gz archive)
- [ ] Implement account profile images
- [ ] separated profile images storage
- [ ] Default image static asset
- [ ] Edit navigation
- [ ] Recode navigation
- [ ] Change username for profile image
- [ ] Mini user panel (under profile photo click)
- [ ] Role info
Expand All @@ -40,7 +40,6 @@ Self-hosted media cloud storage.
- [ ] Port frontend to electron
- [ ] Port frontend to react-native
- [ ] Deploy system
- [ ] User manual

## License
The framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
5 changes: 3 additions & 2 deletions backend/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
APP_SECRET=300699e1276c6dd4dcf42357f766ae48

# app version config for frontend check
APP_VERSION=4.0
APP_VERSION=4.5

# check if session running on ssl (security middleware)
SSL_ONLY=false
Expand Down Expand Up @@ -38,10 +38,11 @@ STORAGE_ENCRYPTION=false
STORAGE_ENCRYPTION_KEY=5ebe2294ecd0e0f08eab7690d2a6ee69 # 32 CHARACTERS
ENCRYPTION_VECTOR=A9C8teBnF9LdBH5H # 16 CHARACTERS

# lexik/jwt-authentication-bundle
# jwt authentication
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=2b756e50285aace9049b36491ec8ceec2a65b32c4dabc57420e0c5c12473dcf5
JWT_TOKEN_TTL=604800

# symfony messenger
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
7 changes: 4 additions & 3 deletions backend/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
APP_SECRET=300699e1276c6dd4dcf42357f766ae48

# app version config for frontend check
APP_VERSION=4.0
APP_VERSION=4.5

# check if session running on ssl (security middleware)
SSL_ONLY=false
Expand Down Expand Up @@ -38,10 +38,11 @@ STORAGE_ENCRYPTION=false
STORAGE_ENCRYPTION_KEY=5ebe2294ecd0e0f08eab7690d2a6ee69 # 32 CHARACTERS
ENCRYPTION_VECTOR=A9C8teBnF9LdBH5H # 16 CHARACTERS

# lexik/jwt-authentication-bundle
# jwt authentication
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=2b756e50285aace9049b36491ec8ceec2a65b32c4dabc57420e0c5c12473dcf5
JWT_TOKEN_TTL=604800

# symfony - messenger
# symfony messenger
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
2 changes: 0 additions & 2 deletions backend/config/packages/debug.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
when@dev:
debug:
# forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# see the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
2 changes: 0 additions & 2 deletions backend/config/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
doctrine_migrations:
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'
1 change: 0 additions & 1 deletion backend/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
session: false
Expand Down
2 changes: 1 addition & 1 deletion backend/config/packages/lexik_jwt_authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
token_ttl: 604800 # 7d
token_ttl: '%env(JWT_TOKEN_TTL)%'
2 changes: 1 addition & 1 deletion backend/config/packages/messenger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
framework:
messenger:
# transports process settings get from config
# transports list
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
Expand Down
14 changes: 7 additions & 7 deletions backend/config/packages/nelmio_api_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ nelmio_api_doc:
tags: ['Auth']
summary: User login action.
description: User login JWT provider return JWT token
responses:
200:
description: Successful login (return token)
401:
description: Invalid credentials
400:
description: Bad request body data
requestBody:
required: true
content:
Expand All @@ -46,10 +53,3 @@ nelmio_api_doc:
password:
type: string
default: test
responses:
200:
description: Successful login (return token)
401:
description: Invalid credentials
400:
description: Bad request body data
7 changes: 4 additions & 3 deletions backend/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ security:

# app firewalls
firewalls:

content:
pattern: ^/api/media/content
stateless: true


login:
pattern: ^/api/login
stateless: true
Expand All @@ -40,9 +37,13 @@ security:

# app access manager
access_control:
# exclude media content from main firewall
- { path: ^/api/media/content, roles: PUBLIC_ACCESS }

# public access routes
- { path: ^/api/register, roles: PUBLIC_ACCESS }
- { path: ^/api/login, roles: PUBLIC_ACCESS }
- { path: ^/api/doc, roles: PUBLIC_ACCESS }

# user access routes
- { path: ^/api, roles: ROLE_USER }
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240523204946 extends AbstractMigration
final class Version20240524103828 extends AbstractMigration
{
public function getDescription(): string
{
Expand Down
2 changes: 0 additions & 2 deletions backend/src/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public function getContent(Request $request, StorageManager $storageManager, Aut
return $response;
}



/**
* Retrieve the media information associated with the provided token.
*
Expand Down
6 changes: 3 additions & 3 deletions backend/src/Manager/StorageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public function getMediaEntityRepository(array $search): ?object
}

/**
* Store media entity.
* Store media entity to database.
*
* @param array<string> $data
* @param array<string> $data The data to store in the media entity.
*
* @return string|null
* @return string|null The token of the stored media entity, or null if an error occurred.
*/
public function storeMediaEntity(array $data): ?string
{
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/Controller/Auth/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Tests\Auth;

use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

Expand All @@ -15,9 +16,9 @@
class LoginTest extends WebTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
* Instance for making requests.
*/
private object $client;
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/Controller/Auth/LogoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Tests\Auth;

use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

Expand All @@ -15,9 +16,9 @@
class LogoutTest extends WebTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
* Instance for making requests.
*/
private object $client;
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/Controller/Auth/RegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Tests\Auth;

use Symfony\Component\String\ByteString;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

Expand All @@ -14,9 +15,9 @@
class RegisterTest extends WebTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
* Instance for making requests.
*/
private object $client;
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
7 changes: 4 additions & 3 deletions backend/tests/Controller/GalleryControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Tests\Controller;

use App\Tests\CustomCase;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
Expand All @@ -15,9 +16,9 @@
class GalleryControllerTest extends CustomCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
*/
private object $client;
* Instance for making requests.
*/
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
7 changes: 4 additions & 3 deletions backend/tests/Controller/MediaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Tests\CustomCase;
use App\Repository\UserRepository;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
Expand All @@ -16,9 +17,9 @@
class MediaControllerTest extends CustomCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
*/
private object $client;
* Instance for making requests.
*/
private KernelBrowser $client;

/**
* @var string testing user token
Expand Down
7 changes: 4 additions & 3 deletions backend/tests/Controller/ThumbnailControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Tests\Controller;

use App\Tests\CustomCase;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
Expand All @@ -15,9 +16,9 @@
class ThumbnailControllerTest extends CustomCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
*/
private object $client;
* Instance for making requests.
*/
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
7 changes: 4 additions & 3 deletions backend/tests/Controller/UploadControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Tests\Controller;

use App\Tests\CustomCase;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
Expand All @@ -15,9 +16,9 @@
class UploadControllerTest extends CustomCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
*/
private object $client;
* Instance for making requests.
*/
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/Controller/UserStatusControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Tests\Controller;

use App\Tests\CustomCase;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
Expand All @@ -15,9 +16,9 @@
class UserStatusControllerTest extends CustomCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\KernelBrowser Instance for making requests.
* Instance for making requests.
*/
private object $client;
private KernelBrowser $client;

/**
* Set up before each test.
Expand Down
Loading

0 comments on commit fb7cc2a

Please sign in to comment.