diff --git a/lib/service/jellyfin_server.dart b/lib/service/jellyfin_server.dart index 5130b89..d7b216a 100644 --- a/lib/service/jellyfin_server.dart +++ b/lib/service/jellyfin_server.dart @@ -18,7 +18,6 @@ import 'package:vup/service/rich_status_service.dart'; import 'package:vup/service/web_server/serve_chunked_file.dart'; import 'package:alfred/src/type_handlers/websocket_type_handler.dart'; import 'package:vup/utils/temp_dir.dart'; -import 'package:xdg_directories/xdg_directories.dart'; import 'package:subtitle/subtitle.dart'; import 'package:archive2/archive_io.dart'; @@ -2101,7 +2100,7 @@ class JellyfinServerService extends VupService { app.get('/playback/bitratetest', (req, res) async { String tmpString = (await getTempDir()).path; - final file = File(join(tmpString, Uuid().v4())); + final file = File(join(tmpString, const Uuid().v4())); file.createSync(recursive: true); file.writeAsBytesSync( Uint8List(int.parse(req.requestedUri.queryParameters['size']!))); diff --git a/lib/utils/temp_dir.dart b/lib/utils/temp_dir.dart index 7964f85..d188f0b 100644 --- a/lib/utils/temp_dir.dart +++ b/lib/utils/temp_dir.dart @@ -4,10 +4,12 @@ import 'package:path_provider/path_provider.dart'; import 'package:xdg_directories/xdg_directories.dart'; import 'package:path/path.dart'; +bool get isRunningAsFlatpak => configHome.path.contains('app.vup.Vup'); + Future getTempDir() async { Directory tmpDir = await getTemporaryDirectory(); - if(Platform.isLinux && configHome.toString().contains('app.vup.Vup') && runtimeDir != null){ + if (Platform.isLinux && isRunningAsFlatpak && runtimeDir != null) { tmpDir = Directory(join(runtimeDir!.path, 'app', 'app.vup.Vup')); } return tmpDir; -} \ No newline at end of file +} diff --git a/lib/view/sidebar.dart b/lib/view/sidebar.dart index 475c320..c003eb9 100644 --- a/lib/view/sidebar.dart +++ b/lib/view/sidebar.dart @@ -16,6 +16,7 @@ import 'package:vup/page/settings.dart'; import 'package:vup/utils/ffmpeg/base.dart'; import 'package:vup/utils/ffmpeg_installer.dart'; import 'package:vup/utils/show_portal_dialog.dart'; +import 'package:vup/utils/temp_dir.dart'; import 'package:vup/view/setup_sync_dialog.dart'; import 'package:vup/widget/sidebar_shortcut.dart'; import 'package:vup/widget/user.dart'; @@ -829,7 +830,7 @@ MimeType=x-scheme-handler/vup; ], ), ), - if (isInstallationAvailable && !configHome.toString().contains("app.vup.Vup")) + if (isInstallationAvailable && !isRunningAsFlatpak) Container( decoration: BoxDecoration( color: SkyColors.warning,