Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redsolver/vup
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolver committed Oct 2, 2022
2 parents 24208f2 + ab33b28 commit 894225c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:vup/utils/ffmpeg/flutter.dart';
import 'package:vup/utils/ffmpeg/io.dart';
import 'package:vup/utils/special_titles.dart';
import 'package:vup/utils/strings.dart';
import 'package:vup/utils/temp_dir.dart';
import 'package:vup/view/tab.dart';
import 'package:vup/widget/app_bar_wrapper.dart';
import 'package:vup/widget/vup_logo.dart';
Expand Down Expand Up @@ -105,7 +106,7 @@ Future<void> initApp() async {
'vup',
);

final tempDir = await getTemporaryDirectory();
final tempDir = await getTempDir();
vupTempDir = join(tempDir.path, 'vup');

vupDataDir = join(dataHome.path, 'vup');
Expand Down
4 changes: 3 additions & 1 deletion lib/service/jellyfin_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:vup/service/jellyfin_server/statistics.dart';
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:subtitle/subtitle.dart';

import 'package:archive2/archive_io.dart';
Expand Down Expand Up @@ -2098,7 +2099,8 @@ class JellyfinServerService extends VupService {
});

app.get('/playback/bitratetest', (req, res) async {
final file = File('/tmp/${Uuid().v4()}');
String tmpString = (await getTempDir()).path;
final file = File(join(tmpString, const Uuid().v4()));
file.createSync(recursive: true);
file.writeAsBytesSync(
Uint8List(int.parse(req.requestedUri.queryParameters['size']!)));
Expand Down
15 changes: 15 additions & 0 deletions lib/utils/temp_dir.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'dart:io';

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 && 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)
if (isInstallationAvailable && !isRunningAsFlatpak)
Container(
decoration: BoxDecoration(
color: SkyColors.warning,
Expand Down

0 comments on commit 894225c

Please sign in to comment.