Skip to content

Commit 3c35347

Browse files
committed
chore: Add more XAPI config variables
1 parent e1bc2d9 commit 3c35347

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

app/Filament/Pages/Preferences.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function form(Schema $schema): Schema
121121
->persistTabInQueryString()
122122
->columnSpanFull()
123123
->tabs([
124-
Tab::make('Appearance')
124+
Tab::make('General')
125125
->schema([
126126
Section::make('Layout & Display Options')
127127
->schema([
@@ -169,15 +169,31 @@ public function form(Schema $schema): Schema
169169
Width::Full->value => 'Full',
170170
]),
171171
]),
172+
173+
]),
174+
Section::make('Xtream API Panel Settings')
175+
->schema([
172176
Grid::make()
173177
->columnSpanFull()
174-
->columns(1)
178+
->columns(2)
175179
->schema([
180+
TextInput::make('xtream_api_details.http_port')
181+
->label('HTTP Port')
182+
->numeric()
183+
->placeholder(fn () => config('app.port', '80'))
184+
->helperText('Returned as "server_info.http_port" in "player_api.php" responses. Leave empty to use APP_PORT (default).'),
185+
TextInput::make('xtream_api_details.https_port')
186+
->label('HTTPS Port')
187+
->numeric()
188+
->placeholder('443')
189+
->helperText('Returned as "server_info.https_port" in "player_api.php" responses. Leave empty to use 443 (default).'),
176190
Textarea::make('xtream_api_message')
177191
->label('Xtream API panel message')
178-
->helperText('Returned as user_info.message in player_api.php responses.')
192+
->helperText('Returned as "user_info.message" in "player_api.php" responses.')
179193
->rows(3)
194+
->columnSpanFull()
180195
->default(''),
196+
181197
]),
182198
]),
183199
]),

app/Http/Controllers/XtreamApiController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ public function handle(Request $request)
432432
$message = $settings->xtream_api_message ?? '';
433433

434434
$userInfo = [
435-
// 'playlist_id' => (string)$playlist->id, // Debugging
436435
'username' => $username,
437436
'password' => $password,
438437
'message' => (string) $message,
@@ -452,10 +451,13 @@ public function handle(Request $request)
452451
$host = $parsedUrl['host'];
453452
$port = isset($parsedUrl['port']) ? (string) $parsedUrl['port'] : '80';
454453

454+
$port = $settings->xtream_api_details['http_port'] ?? $port;
455+
$httpsPort = $settings->xtream_api_details['https_port'] ?? '443';
456+
455457
$serverInfo = [
456458
'url' => $host,
457459
'port' => (string) $port, // Should be 80 for HTTP, otherwise use the specified port (e.g.: 36400
458-
'https_port' => '443', // Should always be 443 for HTTPS
460+
'https_port' => (string) $httpsPort, // Should always be 443 for HTTPS
459461
'server_protocol' => $scheme,
460462
'rtmp_port' => '8001', // RTMP not available currently, we'll just return the default RTMP port
461463
// Timestamps will use the passed in timezone (server timezone)

app/Settings/GeneralSettings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class GeneralSettings extends Settings
2424

2525
public ?string $xtream_api_message = '';
2626

27+
public ?array $xtream_api_details = null;
28+
2729
// MediaFlow proxy settings
2830
public ?string $mediaflow_proxy_url = null;
2931

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
use Spatie\LaravelSettings\Migrations\SettingsMigration;
4+
5+
return new class extends SettingsMigration
6+
{
7+
public function up(): void
8+
{
9+
// Series NFO generation setting
10+
if (! $this->migrator->exists('general.xtream_api_details')) {
11+
$this->migrator->add('general.xtream_api_details', null);
12+
}
13+
14+
}
15+
};

0 commit comments

Comments
 (0)