mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-15 03:07:53 +02:00
Security: - Replace unsalted SHA-256 password hashing with bcrypt (lazy rehash on login) - Add authenticated /api/xtream-api gateway: Xtream credentials are injected server-side and never sent to the frontend; /api/playlists no longer returns passwords - Redact credentials from all logs (login body, proxy/FFmpeg/scheduler URLs) - Add auth to recordings, EPG, season-passes and streaming routes (HttpOnly session cookie for hls.js; loopback bypass for local FFmpeg) - Lock player postMessage to same-origin in both directions - Vendor and pin hls.js 1.6.7 / mpegts.js 1.7.3 (drop CDN @latest) - Fix rate limiter (client IP was never resolved), add login rate limit, restrict CORS, add CSP Report-Only, block private-IP SSRF targets, fix path traversal in recording log retrieval, chmod 777 -> 770 - Remove dead HiveService (seeded admin/admin into IndexedDB with SHA-256) - Fix authMiddleware not populating 'user' context (getPlaylist ignored the logged-in user; admin purge always returned 403) Streaming: - New FfmpegSessionManager: process registry, idle reaper (4 min live / 15 min VOD), orphan cleanup at startup, clean SIGTERM shutdown, fast-fail with stderr instead of 30 s timeout - Quality selection (source/high/medium/low) for live and VOD; source mode streams with -c:v copy (zero transcoding); selector wired into the player - Concurrent recordings (MAX_CONCURRENT_RECORDINGS, default 2); conflicts retry on the next tick instead of silently failing - Lower live latency (HLS window 20 -> 10 segments, liveSync 10 -> 3) - Fix recording log lookup (.mp4 vs .mkv mismatch) Design: - Replace hardcoded colors with AppColors tokens (12 files) - web/theme.css syncs HTML players with the Flutter palette - DPAD/keyboard navigation (arrow-key focus, player shortcuts) - Tooltips on player icon buttons, Semantics on content cards - Remove 7 dead widgets broken since the Stitch merge Quality: - bin/test/: 21 unit tests (bcrypt, redaction, traversal, SSRF, recording conflicts) plus a quality-selector widget test - GitHub Actions CI (analyze + test + build web) - Archive stale status docs into docs/archive/ Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
226 lines
7.4 KiB
Dart
226 lines
7.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../../core/models/playlist_config.dart';
|
|
import '../../../core/theme/app_colors.dart';
|
|
import '../../../core/widgets/glass_container.dart';
|
|
import '../../../core/widgets/tv_focusable_card.dart';
|
|
import '../widgets/live_tv_tab.dart';
|
|
import '../widgets/movies_tab.dart';
|
|
import '../widgets/series_tab.dart';
|
|
import '../widgets/settings_tab.dart';
|
|
import '../widgets/recordings_tab.dart';
|
|
|
|
class DashboardScreen extends ConsumerStatefulWidget {
|
|
final PlaylistConfig playlist;
|
|
|
|
const DashboardScreen({
|
|
super.key,
|
|
required this.playlist,
|
|
});
|
|
|
|
@override
|
|
ConsumerState<DashboardScreen> createState() => _DashboardScreenState();
|
|
}
|
|
|
|
class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|
int _selectedIndex = 0;
|
|
final List<String> _tabs = [
|
|
'Live TV',
|
|
'Movies',
|
|
'Series',
|
|
'Recordings',
|
|
'Settings',
|
|
];
|
|
final List<IconData> _icons = [
|
|
Icons.live_tv_rounded,
|
|
Icons.movie_rounded,
|
|
Icons.tv_rounded,
|
|
Icons.video_library_rounded,
|
|
Icons.settings_rounded,
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.background,
|
|
body: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
// 1. Cinematic Deep Space Background - Premium Apple TV Style
|
|
Positioned.fill(
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
AppColors.surfaceContainerLowest, // Very dark top
|
|
AppColors.background, // Black bottom
|
|
AppColors.baseLevel0, // Slightly darker for depth
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// Ambient Glow Top-Left - Teal (Primary) - VISIBLE
|
|
Positioned(
|
|
top: -300,
|
|
left: -300,
|
|
child: Container(
|
|
width: 800,
|
|
height: 800,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: RadialGradient(
|
|
colors: [
|
|
AppColors.primary.withOpacity(0.4),
|
|
AppColors.primary.withOpacity(0.1),
|
|
Colors.transparent,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// Ambient Glow Bottom-Right - Blue - VISIBLE
|
|
Positioned(
|
|
bottom: -250,
|
|
right: -250,
|
|
child: Container(
|
|
width: 700,
|
|
height: 700,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: RadialGradient(
|
|
colors: [
|
|
AppColors.info.withOpacity(0.35),
|
|
AppColors.info.withOpacity(0.1),
|
|
Colors.transparent,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// 2. Main Content Area
|
|
Positioned.fill(
|
|
left: 100, // Leave space for sidebar
|
|
child: IndexedStack(
|
|
index: _selectedIndex,
|
|
children: [
|
|
LiveTVTab(playlist: widget.playlist),
|
|
MoviesTab(playlist: widget.playlist),
|
|
SeriesTab(playlist: widget.playlist),
|
|
RecordingsTab(playlist: widget.playlist),
|
|
const SettingsTab(),
|
|
],
|
|
),
|
|
),
|
|
|
|
// 3. Vertical Glass Sidebar
|
|
Positioned(
|
|
left: 24,
|
|
top: 24,
|
|
bottom: 24,
|
|
width: 80,
|
|
child: GlassContainer.glass(
|
|
borderRadius: 24,
|
|
borderColor: AppColors.border,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Logo Icon
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
|
child: Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
gradient: AppColors.primaryGradient,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.primary.withOpacity(0.4),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: const Icon(
|
|
Icons.play_arrow_rounded,
|
|
color: AppColors.textPrimary,
|
|
size: 28,
|
|
),
|
|
),
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
// Navigation Icons
|
|
...List.generate(_tabs.length, (index) {
|
|
final isSelected = _selectedIndex == index;
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
child: TvFocusableCard(
|
|
onTap: () => setState(() => _selectedIndex = index),
|
|
scaleFactor: 1.2,
|
|
borderRadius: 16,
|
|
focusColor: AppColors.primary,
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: 48,
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
color: isSelected
|
|
? AppColors.primary.withOpacity(0.2)
|
|
: Colors.transparent,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: isSelected
|
|
? Border.all(
|
|
color: AppColors.primary.withOpacity(0.5),
|
|
)
|
|
: null,
|
|
),
|
|
child: Icon(
|
|
_icons[index],
|
|
color: isSelected
|
|
? AppColors.textPrimary
|
|
: AppColors.textSecondary,
|
|
size: 24,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
|
|
const Spacer(),
|
|
|
|
// Settings / Profile
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 24),
|
|
child: TvFocusableCard(
|
|
onTap: () {},
|
|
borderRadius: 50,
|
|
scaleFactor: 1.1,
|
|
child: CircleAvatar(
|
|
radius: 20,
|
|
backgroundColor: AppColors.primary.withOpacity(0.1),
|
|
child: const Icon(
|
|
Icons.person,
|
|
color: AppColors.textSecondary,
|
|
size: 20,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|