mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-01 08:52:45 +00:00
Add (optional) firejail support
This commit is contained in:
parent
8552e08a12
commit
e4e35c03d4
6 changed files with 50 additions and 8 deletions
|
@ -3,7 +3,7 @@ Type=Application
|
|||
Version=1.1
|
||||
X-Nemo-Application-Type=silica-qt5
|
||||
Icon=harbour-sailfin
|
||||
Exec=harbour-sailfin
|
||||
Exec=harbour-sailfin --attempt-sandbox
|
||||
|
||||
|
||||
Name=Sailfin
|
||||
|
@ -17,3 +17,8 @@ GenericName=Jellyfin client
|
|||
|
||||
Comment=Stream audio and video from your Jellyfin media server
|
||||
Categories=AudioVideo;Player
|
||||
|
||||
[X-Sailjail]
|
||||
Permissions=Internet;Audio
|
||||
OrganizationName=nl.netsoj.chris
|
||||
ApplicationName=Sailfin
|
||||
|
|
|
@ -21,16 +21,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <QtQuick>
|
||||
#endif
|
||||
|
||||
#include <QCommandLineOption>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDebug>
|
||||
#include <QJSEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickView>
|
||||
#include <QQmlEngine>
|
||||
#include <QString>
|
||||
|
||||
#include <sailfishapp.h>
|
||||
|
||||
#include <JellyfinQt/jellyfin.h>
|
||||
|
||||
static const char *SANDBOX_PROGRAM = "/usr/bin/sailjail";
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// SailfishApp::main() will display "qml/harbour-sailfin.qml", if you need more
|
||||
// control over initialization, you can use:
|
||||
|
@ -42,6 +47,30 @@ int main(int argc, char *argv[]) {
|
|||
//
|
||||
// To display the view, call "show()" (will show fullscreen on device).
|
||||
QGuiApplication *app = SailfishApp::application(argc, argv);
|
||||
app->setOrganizationName("nl.netsoj.chris");
|
||||
app->setOrganizationDomain("nl.netsoj.chris");
|
||||
app->setApplicationName("Sailfin");
|
||||
//: Application display name
|
||||
app->setApplicationDisplayName(QObject::tr("Sailfin"));
|
||||
|
||||
bool canSanbox = QFile::exists(SANDBOX_PROGRAM);
|
||||
QCommandLineParser cmdParser;
|
||||
cmdParser.addHelpOption();
|
||||
cmdParser.addVersionOption();
|
||||
QCommandLineOption sandboxOption("attempt-sandbox", app->translate("Command line argument description", "Try to start with FireJail."));
|
||||
if (canSanbox) {
|
||||
cmdParser.addOption(sandboxOption);
|
||||
}
|
||||
cmdParser.process(*app);
|
||||
|
||||
if (canSanbox && cmdParser.isSet(sandboxOption)) {
|
||||
qDebug() << "Restarting in Sanbox mode";
|
||||
QProcess::execute(QString(SANDBOX_PROGRAM),
|
||||
QStringList() << "-p" << "harbour-sailfin.desktop" << "/usr/bin/harbour-sailfin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Jellyfin::registerTypes();
|
||||
QQuickView *view = SailfishApp::createView();
|
||||
view->setSource(SailfishApp::pathToMainQml());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue