Loading .env.example +5 −0 Original line number Diff line number Diff line Loading @@ -41,3 +41,8 @@ cache.handler="file" # cache.redis.password=null # cache.redis.port=6379 # cache.redis.database=0 #REST API configuration #-------------------------------------------------------------------- # 0/1 Disabled/Enabled REST_API_ENABLED=1 No newline at end of file .gitlab-ci.yml +12 −0 Original line number Diff line number Diff line Loading @@ -65,7 +65,19 @@ lint-js: tests: stage: quality services: - mariadb variables: MYSQL_DATABASE: "tests" MYSQL_ROOT_PASSWORD: "R00Tp4ssW0RD" MYSQL_USER: "tests_user" MYSQL_PASSWORD: "password" script: - apt-get install -y mariadb-client libmariadb-dev - echo "SHOW DATABASES;" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE" # run phpunit without code coverage # TODO: add code coverage - vendor/bin/phpunit --no-coverage Loading app/Config/Autoload.php +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ class Autoload extends AutoloadConfig 'Modules\Install' => ROOTPATH . 'modules/Install/', 'Modules\Fediverse' => ROOTPATH . 'modules/Fediverse/', 'Modules\WebSub' => ROOTPATH . 'modules/WebSub/', 'Modules\Api\Rest\V1' => ROOTPATH . 'modules/Api/Rest/V1', 'Config' => APPPATH . 'Config/', 'ViewComponents' => APPPATH . 'Libraries/ViewComponents/', 'ViewThemes' => APPPATH . 'Libraries/ViewThemes/', Loading app/Config/Filters.php +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use CodeIgniter\Filters\DebugToolbar; use CodeIgniter\Filters\Honeypot; use CodeIgniter\Filters\InvalidChars; use CodeIgniter\Filters\SecureHeaders; use Modules\Api\Rest\V1\Filters\ApiFilter; use Modules\Auth\Filters\PermissionFilter; use Modules\Fediverse\Filters\AllowCorsFilter; use Modules\Fediverse\Filters\FediverseFilter; Loading @@ -34,6 +35,7 @@ class Filters extends BaseConfig 'permission' => PermissionFilter::class, 'fediverse' => FediverseFilter::class, 'allow-cors' => AllowCorsFilter::class, 'rest-api' => ApiFilter::class, ]; /** Loading app/Database/Seeds/FakeSinglePodcastApiSeeder.php 0 → 100644 +141 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace App\Database\Seeds; use CodeIgniter\Database\Seeder; class FakeSinglePodcastApiSeeder extends Seeder { /** * @return array<mixed> */ public static function cover(): array { return [ 'id' => 1, 'file_path' => 'podcasts/Handle/cover.jpg', 'file_size' => 400000, 'file_mimetype' => 'image/jpeg', 'file_metadata' => '{"FILE":{"FileName":"cover.jpg","FileDateTime":1654861723,"FileSize":468541,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":"COMMENT"},"COMPUTED":{"html":"width=\"1400\" height=\"1400\"","Height":1400,"Width":1400,"IsColor":1},"COMMENT":["CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90\n"],"sizes":{"tiny":{"width":40,"height":40,"mimetype":"image\/webp","extension":"webp"},"thumbnail":{"width":150,"height":150,"mimetype":"image\/webp","extension":"webp"},"medium":{"width":320,"height":320,"mimetype":"image\/webp","extension":"webp"},"large":{"width":1024,"height":1024,"mimetype":"image\/webp","extension":"webp"},"feed":{"width":1400,"height":1400},"id3":{"width":500,"height":500},"og":{"width":1200,"height":1200},"federation":{"width":400,"height":400},"webmanifest192":{"width":192,"height":192,"mimetype":"image\/png","extension":"png"},"webmanifest512":{"width":512,"height":512,"mimetype":"image\/png","extension":"png"}}}', 'type' => 'image', 'description' => null, 'language_code' => null, 'uploaded_by' => 1, 'updated_by' => 1, 'uploaded_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function banner(): array { return [ 'id' => 2, 'file_path' => 'podcasts/Handle/banner.jpg', 'file_size' => 400000, 'file_mimetype' => 'image/jpeg', 'file_metadata' => '{"FILE":{"FileName":"banner.jpg","FileDateTime":1654861724,"FileSize":98209,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":""},"COMPUTED":{"html":"width=\"1500\" height=\"500\"","Height":500,"Width":1500,"IsColor":1},"sizes":{"small":{"width":320,"height":128,"mimetype":"image\/webp","extension":"webp"},"medium":{"width":960,"height":320,"mimetype":"image\/webp","extension":"webp"},"federation":{"width":1500,"height":500}}}', 'type' => 'image', 'description' => null, 'language_code' => null, 'uploaded_by' => 1, 'updated_by' => 1, 'uploaded_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function actor(): array { return [ 'id' => 1, 'uri' => getenv('app_baseURL') . '@Handle', 'username' => 'Handle', 'domain' => getenv('app_baseURL'), 'private_key' => 'private_key', 'public_key' => 'public_key', 'display_name' => 'Title', 'summary' => '<p>description</p>', 'avatar_image_url' => getenv('app_baseURL') . 'media/podcasts/Handle', 'avatar_image_mimetype' => 'image/webp', 'cover_image_url' => null, 'cover_image_mimetype' => null, 'inbox_url' => getenv('app_baseURL') . '@Handle/inbox', 'outbox_url' => getenv('app_baseURL') . '@Handle/outbox', 'followers_url' => getenv('app_baseURL') . '@Handle/followers', 'followers_count' => 0, 'posts_count' => 0, 'is_blocked' => 0, 'created_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function podcast(): array { return [ 'id' => 1, 'guid' => '0d341200-0234-5de7-99a6-a7d02bea4ce2', 'actor_id' => 1, 'handle' => 'Handle', 'title' => 'Title', 'description_markdown' => 'description', 'description_html' => '<p>description</p>', 'cover_id' => 1, 'banner_id' => 2, 'language_code' => 'en', 'category_id' => 1, 'parental_advisory' => null, 'owner_name' => 'Owner', 'owner_email' => 'Owner@gmail.com', 'publisher' => '', 'type' => 'episodic', 'copyright' => '', 'episode_description_footer_markdown' => null, 'episode_description_footer_html' => null, 'is_blocked' => 0, 'is_completed' => 0, 'is_locked' => 1, 'imported_feed_url' => null, 'new_feed_url' => null, 'payment_pointer' => null, 'location_name' => null, 'location_geo' => null, 'location_osm' => null, 'custom_rss' => null, 'is_published_on_hubs' => 0, 'partner_id' => null, 'partner_link_url' => null, 'partner_image_url' => null, 'created_by' => 1, 'updated_by' => 1, 'created_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } public function run(): void { $this->call(AppSeeder::class); $this->call(TestSeeder::class); $this->db->table('media') ->insert(self::cover()); $this->db->table('media') ->insert(self::banner()); $this->db->table('fediverse_actors') ->insert(self::actor()); $this->db->table('podcasts') ->insert(self::podcast()); } } Loading
.env.example +5 −0 Original line number Diff line number Diff line Loading @@ -41,3 +41,8 @@ cache.handler="file" # cache.redis.password=null # cache.redis.port=6379 # cache.redis.database=0 #REST API configuration #-------------------------------------------------------------------- # 0/1 Disabled/Enabled REST_API_ENABLED=1 No newline at end of file
.gitlab-ci.yml +12 −0 Original line number Diff line number Diff line Loading @@ -65,7 +65,19 @@ lint-js: tests: stage: quality services: - mariadb variables: MYSQL_DATABASE: "tests" MYSQL_ROOT_PASSWORD: "R00Tp4ssW0RD" MYSQL_USER: "tests_user" MYSQL_PASSWORD: "password" script: - apt-get install -y mariadb-client libmariadb-dev - echo "SHOW DATABASES;" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE" # run phpunit without code coverage # TODO: add code coverage - vendor/bin/phpunit --no-coverage Loading
app/Config/Autoload.php +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ class Autoload extends AutoloadConfig 'Modules\Install' => ROOTPATH . 'modules/Install/', 'Modules\Fediverse' => ROOTPATH . 'modules/Fediverse/', 'Modules\WebSub' => ROOTPATH . 'modules/WebSub/', 'Modules\Api\Rest\V1' => ROOTPATH . 'modules/Api/Rest/V1', 'Config' => APPPATH . 'Config/', 'ViewComponents' => APPPATH . 'Libraries/ViewComponents/', 'ViewThemes' => APPPATH . 'Libraries/ViewThemes/', Loading
app/Config/Filters.php +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use CodeIgniter\Filters\DebugToolbar; use CodeIgniter\Filters\Honeypot; use CodeIgniter\Filters\InvalidChars; use CodeIgniter\Filters\SecureHeaders; use Modules\Api\Rest\V1\Filters\ApiFilter; use Modules\Auth\Filters\PermissionFilter; use Modules\Fediverse\Filters\AllowCorsFilter; use Modules\Fediverse\Filters\FediverseFilter; Loading @@ -34,6 +35,7 @@ class Filters extends BaseConfig 'permission' => PermissionFilter::class, 'fediverse' => FediverseFilter::class, 'allow-cors' => AllowCorsFilter::class, 'rest-api' => ApiFilter::class, ]; /** Loading
app/Database/Seeds/FakeSinglePodcastApiSeeder.php 0 → 100644 +141 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace App\Database\Seeds; use CodeIgniter\Database\Seeder; class FakeSinglePodcastApiSeeder extends Seeder { /** * @return array<mixed> */ public static function cover(): array { return [ 'id' => 1, 'file_path' => 'podcasts/Handle/cover.jpg', 'file_size' => 400000, 'file_mimetype' => 'image/jpeg', 'file_metadata' => '{"FILE":{"FileName":"cover.jpg","FileDateTime":1654861723,"FileSize":468541,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":"COMMENT"},"COMPUTED":{"html":"width=\"1400\" height=\"1400\"","Height":1400,"Width":1400,"IsColor":1},"COMMENT":["CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90\n"],"sizes":{"tiny":{"width":40,"height":40,"mimetype":"image\/webp","extension":"webp"},"thumbnail":{"width":150,"height":150,"mimetype":"image\/webp","extension":"webp"},"medium":{"width":320,"height":320,"mimetype":"image\/webp","extension":"webp"},"large":{"width":1024,"height":1024,"mimetype":"image\/webp","extension":"webp"},"feed":{"width":1400,"height":1400},"id3":{"width":500,"height":500},"og":{"width":1200,"height":1200},"federation":{"width":400,"height":400},"webmanifest192":{"width":192,"height":192,"mimetype":"image\/png","extension":"png"},"webmanifest512":{"width":512,"height":512,"mimetype":"image\/png","extension":"png"}}}', 'type' => 'image', 'description' => null, 'language_code' => null, 'uploaded_by' => 1, 'updated_by' => 1, 'uploaded_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function banner(): array { return [ 'id' => 2, 'file_path' => 'podcasts/Handle/banner.jpg', 'file_size' => 400000, 'file_mimetype' => 'image/jpeg', 'file_metadata' => '{"FILE":{"FileName":"banner.jpg","FileDateTime":1654861724,"FileSize":98209,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":""},"COMPUTED":{"html":"width=\"1500\" height=\"500\"","Height":500,"Width":1500,"IsColor":1},"sizes":{"small":{"width":320,"height":128,"mimetype":"image\/webp","extension":"webp"},"medium":{"width":960,"height":320,"mimetype":"image\/webp","extension":"webp"},"federation":{"width":1500,"height":500}}}', 'type' => 'image', 'description' => null, 'language_code' => null, 'uploaded_by' => 1, 'updated_by' => 1, 'uploaded_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function actor(): array { return [ 'id' => 1, 'uri' => getenv('app_baseURL') . '@Handle', 'username' => 'Handle', 'domain' => getenv('app_baseURL'), 'private_key' => 'private_key', 'public_key' => 'public_key', 'display_name' => 'Title', 'summary' => '<p>description</p>', 'avatar_image_url' => getenv('app_baseURL') . 'media/podcasts/Handle', 'avatar_image_mimetype' => 'image/webp', 'cover_image_url' => null, 'cover_image_mimetype' => null, 'inbox_url' => getenv('app_baseURL') . '@Handle/inbox', 'outbox_url' => getenv('app_baseURL') . '@Handle/outbox', 'followers_url' => getenv('app_baseURL') . '@Handle/followers', 'followers_count' => 0, 'posts_count' => 0, 'is_blocked' => 0, 'created_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } /** * @return array<mixed> */ public static function podcast(): array { return [ 'id' => 1, 'guid' => '0d341200-0234-5de7-99a6-a7d02bea4ce2', 'actor_id' => 1, 'handle' => 'Handle', 'title' => 'Title', 'description_markdown' => 'description', 'description_html' => '<p>description</p>', 'cover_id' => 1, 'banner_id' => 2, 'language_code' => 'en', 'category_id' => 1, 'parental_advisory' => null, 'owner_name' => 'Owner', 'owner_email' => 'Owner@gmail.com', 'publisher' => '', 'type' => 'episodic', 'copyright' => '', 'episode_description_footer_markdown' => null, 'episode_description_footer_html' => null, 'is_blocked' => 0, 'is_completed' => 0, 'is_locked' => 1, 'imported_feed_url' => null, 'new_feed_url' => null, 'payment_pointer' => null, 'location_name' => null, 'location_geo' => null, 'location_osm' => null, 'custom_rss' => null, 'is_published_on_hubs' => 0, 'partner_id' => null, 'partner_link_url' => null, 'partner_image_url' => null, 'created_by' => 1, 'updated_by' => 1, 'created_at' => '2022-06-13 8:00:00', 'updated_at' => '2022-06-13 8:00:00', ]; } public function run(): void { $this->call(AppSeeder::class); $this->call(TestSeeder::class); $this->db->table('media') ->insert(self::cover()); $this->db->table('media') ->insert(self::banner()); $this->db->table('fediverse_actors') ->insert(self::actor()); $this->db->table('podcasts') ->insert(self::podcast()); } }