From 40ee777c514f1236068541762098891c1b017706 Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:03:14 +0100 Subject: [PATCH 1/2] [flowplayer.desktop] Implement a proper SailJail configuration Originally developed by @poetaster and reviewed by @dcaliste in PR #75, see commits 68dc7f1 and fce86cd. --- flowplayer.desktop | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flowplayer.desktop b/flowplayer.desktop index f87a750..25e8bb3 100644 --- a/flowplayer.desktop +++ b/flowplayer.desktop @@ -6,4 +6,8 @@ Exec=flowplayer Name=FlowPlayer [X-Sailjail] -Sandboxing=Disabled +OrganizationName=sailfishos-applications +# ApplicationName does not have to be identical to Name +ApplicationName=flowplayer +# Add the required permissions here +Permissions=UserDirs;Audio;Bluetooth;Internet;RemovableMedia From 3233241efcd90b5ba220445090c605a2468060ca Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:07:12 +0100 Subject: [PATCH 2/2] [FlowPlayer.cpp] Eliminate migration functions due to conflict with sandboxing --- src/FlowPlayer.cpp | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/src/FlowPlayer.cpp b/src/FlowPlayer.cpp index bea8eac..cab0872 100644 --- a/src/FlowPlayer.cpp +++ b/src/FlowPlayer.cpp @@ -22,61 +22,6 @@ bool isDBOpened; bool databaseWorking; -static void migrateSettings() -{ - const QString oldSettings = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/cepiperez/flowplayer.conf"; - const QString newSettings = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + ".conf"; - if (QFile::exists(oldSettings)) { - if (QDir().mkpath(QFileInfo(newSettings).path()) - && !QFile::rename(oldSettings, newSettings)) { - qWarning() << "unable to move old configuration from" << oldSettings << "to" << newSettings; - } - QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).rmdir("cepiperez"); - } -} - -static void migrateDatabase() -{ - const QString olderDb = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/cepiperez/flowplayer.db"; - const QString oldDb = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/flowplayer/flowplayer/flowplayer.db"; - const QString newDb = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/flowplayer.db"; - if (QFile::exists(oldDb)) { - if (QDir().mkpath(QFileInfo(newDb).path()) - && !QFile::rename(oldDb, newDb)) { - qWarning() << "unable to move old database from" << oldDb << "to" << newDb; - } - QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/flowplayer").rmdir("flowplayer"); - QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).rmdir("flowplayer"); - } else if (QFile::exists(olderDb)) { - if (QDir().mkpath(QFileInfo(newDb).path()) - && !QFile::rename(olderDb, newDb)) { - qWarning() << "unable to move old database from" << olderDb << "to" << newDb; - } - QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).rmdir("cepiperez"); - } -} - -static void migrateCache() -{ - const QString olderCache = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/flowplayer"; - const QString oldCache = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/flowplayer/flowplayer"; - const QString newCache = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); - if (QFileInfo(oldCache).isDir()) { - if (QDir().mkpath(QFileInfo(newCache).path()) - && !QDir().rename(oldCache, newCache)) { - qWarning() << "unable to move old cache from" << oldCache << "to" << newCache; - } - QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/flowplayer").rmdir("flowplayer"); - QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).rmdir("flowplayer"); - } else if (QFileInfo(olderCache).isDir()) { - if (QDir().mkpath(QFileInfo(newCache).path()) - && !QDir().rename(olderCache, newCache)) { - qWarning() << "unable to move old cache from" << olderCache << "to" << newCache; - } - QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).rmdir("flowplayer"); - } -} - int main(int argc, char *argv[]) { QTextCodec *linuxCodec = QTextCodec::codecForName("UTF-8"); @@ -86,10 +31,6 @@ int main(int argc, char *argv[]) app->setOrganizationName("sailfishos-applications"); app->setApplicationName("flowplayer"); - migrateSettings(); - migrateDatabase(); - migrateCache(); - QString lang; QTranslator translator;