Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
573 changes: 352 additions & 221 deletions composer.lock

Large diffs are not rendered by default.

1,306 changes: 864 additions & 442 deletions frontend/bun.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@
"prepare:test": "nuxt prepare --envName=development"
},
"dependencies": {
"@iconify-json/lucide": "^1.2.104",
"@iconify-json/lucide": "^1.2.111",
"@microsoft/fetch-event-source": "^2.0.1",
"@noble/hashes": "^2.2.0",
"@nuxt/eslint": "^1.15.2",
"@nuxt/eslint-config": "^1.15.2",
"@nuxt/ui": "^4.7.1",
"@nuxt/ui": "^4.8.1",
"@pinia/nuxt": "^0.11.3",
"@vueuse/core": "^14.2.1",
"@vueuse/nuxt": "^14.2.1",
"@vueuse/core": "^14.3.0",
"@vueuse/nuxt": "^14.3.0",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"assjs": "^0.1.6",
"assjs": "^0.1.7",
"cronstrue": "^3.14.0",
"hls.js": "^1.6.16",
"marked": "^18.0.2",
"marked": "^18.0.4",
"marked-alert": "^2.1.2",
"marked-base-url": "^1.1.9",
"marked-gfm-heading-id": "^4.1.4",
"moment": "^2.30.1",
"nuxt": "^4.4.2",
"nuxt": "^4.4.6",
"pinia": "^3.0.4",
"tailwindcss": "^4.2.4",
"vue": "^3.5.33",
"vue-router": "^5.0.6",
"tailwindcss": "^4.3.0",
"vue": "^3.5.35",
"vue-router": "^5.1.0",
"vuedraggable": "^4.1.0"
},
"overrides": {
Expand All @@ -55,14 +55,14 @@
"@parcel/watcher"
],
"devDependencies": {
"@types/bun": "^1.3.13",
"@types/bun": "^1.3.14",
"@types/node": "25.6.0",
"@typescript-eslint/parser": "^8.59.1",
"eslint": "^10.2.1",
"@typescript-eslint/parser": "^8.60.0",
"eslint": "^10.4.1",
"oxfmt": "^0.47.0",
"typescript": "^6.0.3",
"vue-eslint-parser": "^10.4.0",
"vue-tsc": "^3.2.7"
"vue-tsc": "^3.3.3"
},
"eslintIgnore": [
".gitignore"
Expand Down
2 changes: 1 addition & 1 deletion mago.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ php-version = "8.4.0"

[source]
workspace = "."
paths = ["src/", "test/"]
paths = ["src/", "tests/"]
includes = ["vendor"]
excludes = []

Expand Down
122 changes: 68 additions & 54 deletions tests/API/Backend/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,53 @@ protected function setUp(): void
$this->initTempApp();
Config::save('supported.fake', FakeBackendClient::class);

file_put_contents((string) Config::get('backends_file'), Yaml::dump([
'backend1' => [
'type' => 'fake',
'url' => 'http://backend1.example.invalid',
'token' => 'token1',
'user' => 'user-1',
'uuid' => 'uuid-1',
'webhook' => [],
'options' => [
'IMPORT_METADATA_ONLY' => true,
'use_old_progress_endpoint' => true,
'keep' => 'value1',
],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
],
],
'backend2' => [
'type' => 'fake',
'url' => 'http://backend2.example.invalid',
'token' => 'token2',
'user' => 'user-2',
'uuid' => 'uuid-2',
'webhook' => [],
'options' => [
'IMPORT_METADATA_ONLY' => true,
'use_old_progress_endpoint' => true,
'keep' => 'value2',
],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
file_put_contents(
(string) Config::get('backends_file'),
Yaml::dump(
[
'backend1' => [
'type' => 'fake',
'url' => 'http://backend1.example.invalid',
'token' => 'token1',
'user' => 'user-1',
'uuid' => 'uuid-1',
'webhook' => [],
'options' => [
'IMPORT_METADATA_ONLY' => true,
'use_old_progress_endpoint' => true,
'keep' => 'value1',
],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
],
],
'backend2' => [
'type' => 'fake',
'url' => 'http://backend2.example.invalid',
'token' => 'token2',
'user' => 'user-2',
'uuid' => 'uuid-2',
'webhook' => [],
'options' => [
'IMPORT_METADATA_ONLY' => true,
'use_old_progress_endpoint' => true,
'keep' => 'value2',
],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
],
],
],
],
], 8, 2));
8,
2,
),
);
}

public function test_update_strips_deprecated_keys(): void
Expand Down Expand Up @@ -148,22 +155,29 @@ public function test_accepts_recovered_token(): void
{
Config::save('supported.fake', TokenAwareBackendClient::class);

file_put_contents((string) Config::get('backends_file'), Yaml::dump([
'backend1' => [
'type' => 'fake',
'url' => 'http://backend1.example.invalid',
'token' => 'bad-token',
'user' => 'user-1',
'uuid' => 'uuid-1',
'options' => [],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
file_put_contents(
(string) Config::get('backends_file'),
Yaml::dump(
[
'backend1' => [
'type' => 'fake',
'url' => 'http://backend1.example.invalid',
'token' => 'bad-token',
'user' => 'user-1',
'uuid' => 'uuid-1',
'options' => [],
'import' => [
'enabled' => true,
],
'export' => [
'enabled' => true,
],
],
],
],
], 8, 2));
8,
2,
),
);

$handler = new Update($this->createStub(iImport::class), new Logger('test'));

Expand Down
2 changes: 1 addition & 1 deletion tests/API/Identities/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function test_add_runs_migrations(): void
self::assertFileExists($configFile);
self::assertFileExists($dbFile);

$tables = (new PDO('sqlite:' . $dbFile))
$tables = new PDO('sqlite:' . $dbFile)
->query("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name")
->fetchAll(PDO::FETCH_COLUMN);

Expand Down
8 changes: 6 additions & 2 deletions tests/API/Logs/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ public function test_formatLog_no_whitelist(): void
$this->assertSame(
"NOTICE: Processing 'main@emby_main' - '#123: IppSec' item.",
$parsed['text'],
'Log formatter should strip the timestamp prefix from the display text.'
'Log formatter should strip the timestamp prefix from the display text.',
);
}

public function test_formatLog_stringifies(): void
{
$parsed = Index::formatLog(['message' => 'boom', 'code' => 1]);

$this->assertSame('{"message":"boom","code":1}', $parsed['text'], 'Non-string log payloads should be stringified for API consumers.');
$this->assertSame(
'{"message":"boom","code":1}',
$parsed['text'],
'Non-string log payloads should be stringified for API consumers.',
);
$this->assertNull($parsed['date'], 'Stringified payloads should not invent timestamps.');
$this->assertNull($parsed['item_id'], 'Stringified payloads should not invent item ids.');
$this->assertNull($parsed['user'], 'Stringified payloads should not invent users.');
Expand Down
8 changes: 4 additions & 4 deletions tests/API/Player/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use App\API\Player\Stream;
use App\API\System\Sign;
use App\Libs\Enums\Http\Status;
use App\Libs\Emitter;
use App\Libs\Enums\Http\Status;
use App\Libs\TestCase;
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
Expand All @@ -31,13 +31,13 @@ public function test_stream_range(): void
'version' => get_app_version(),
], cache: $cache);

$request = (new ServerRequest('GET', new Uri('http://localhost/v1/api/player/stream/' . $token)))
$request = new ServerRequest('GET', new Uri('http://localhost/v1/api/player/stream/' . $token))
->withHeader('Range', 'bytes=1-3');

$response = (new Stream($cache))($request, $token);
$out = '';

(new Emitter())
new Emitter()
->withHeaderFunc(static fn() => null)
->withHeadersSentFunc(static fn() => false)
->withBodyFunc(static function (string $data) use (&$out): void {
Expand Down Expand Up @@ -67,7 +67,7 @@ public function test_stream_bad_range(): void
'version' => get_app_version(),
], cache: $cache);

$request = (new ServerRequest('GET', new Uri('http://localhost/v1/api/player/stream/' . $token)))
$request = new ServerRequest('GET', new Uri('http://localhost/v1/api/player/stream/' . $token))
->withHeader('Range', 'bytes=10-20');

$response = (new Stream($cache))($request, $token);
Expand Down
6 changes: 3 additions & 3 deletions tests/API/Player/SubtitleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function test_m3u8_ass(): void
]);

$request = new ServerRequest('GET', new Uri('http://localhost/v1/api/player/subtitle/' . $token . '/ass.x0.m3u8'));
$response = (new Subtitle($cache, $logger))->m3u8($request, $token, 'ass', 'x', '0');
$response = new Subtitle($cache, $logger)->m3u8($request, $token, 'ass', 'x', '0');

$this->assertSame(Status::OK, Status::from($response->getStatusCode()));
$this->assertStringContainsString('/' . $token . '/x0.ass', (string) $response->getBody());
Expand All @@ -48,7 +48,7 @@ public function test_convert_bad_ext(): void
]);

$request = new ServerRequest('GET', new Uri('http://localhost/v1/api/player/subtitle/' . $token . '/x0.txt'));
$response = (new Subtitle($cache, $logger))->convert($request, $token, 'x', '0', 'txt');
$response = new Subtitle($cache, $logger)->convert($request, $token, 'x', '0', 'txt');

$this->assertSame(Status::BAD_REQUEST, Status::from($response->getStatusCode()));
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public function test_m3u8_rejects_foreign_ext(): void
]);

$request = new ServerRequest('GET', new Uri('http://localhost/v1/api/player/subtitle/' . $token . '/webvtt.x1.m3u8'));
$response = (new Subtitle($cache, $logger))->m3u8($request, $token, 'webvtt', 'x', '1');
$response = new Subtitle($cache, $logger)->m3u8($request, $token, 'webvtt', 'x', '1');

$this->assertSame(Status::BAD_REQUEST, Status::from($response->getStatusCode()));
}
Expand Down
1 change: 0 additions & 1 deletion tests/API/System/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,4 @@ public function test_cancel_run(): void
$this->assertSame('Command cancellation requested.', ag($cancelPayload, 'message'));
$this->assertFileExists($sessionPath . '/cancel.flag');
}

}
8 changes: 5 additions & 3 deletions tests/API/TasksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use App\API\Tasks;
use App\Commands\System\TasksCommand;
use App\Libs\Enums\Http\Status;
use App\Libs\Database\PDO\PDOAdapter;
use App\Libs\Enums\Http\Status;
use App\Libs\TestCase;
use App\Model\Events\EventsRepository;
use App\Model\Events\EventStatus;
Expand Down Expand Up @@ -61,7 +61,10 @@ public function test_prev_run_event(): void

$payload = json_decode((string) $response->getBody(), true, flags: JSON_THROW_ON_ERROR);
$indexPayload = json_decode((string) $index->getBody(), true, flags: JSON_THROW_ON_ERROR);
$items = array_values(array_filter((array) ag($indexPayload, 'tasks', []), static fn(array $item): bool => 'backup' === ($item['name'] ?? null)));
$items = array_values(array_filter(
(array) ag($indexPayload, 'tasks', []),
static fn(array $item): bool => 'backup' === ($item['name'] ?? null),
));

self::assertSame('2024-01-02T00:10:00+00:00', ag($payload, 'prev_run'));
self::assertSame($queuedId, ag($payload, 'prev_run_event_id'));
Expand All @@ -85,5 +88,4 @@ public function test_prev_run_estimate(): void
self::assertNotNull(ag($payload, 'next_run'));
self::assertNotSame(ag($payload, 'prev_run'), ag($payload, 'next_run'));
}

}
Loading
Loading