Skip to content

Commit

Permalink
Some small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolver committed Aug 13, 2022
1 parent 8a95fc9 commit 2493aef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/service/jellyfin_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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']!)));
Expand Down
6 changes: 4 additions & 2 deletions lib/utils/temp_dir.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Directory> 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;
}
}
3 changes: 2 additions & 1 deletion lib/view/sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2493aef

Please sign in to comment.