mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-12-22 14:05:18 +00:00
Add (optional) firejail support
This commit is contained in:
parent
8552e08a12
commit
e4e35c03d4
|
@ -6,17 +6,17 @@ set(CMAKE_AUTOMOC ON)
|
|||
cmake_policy(SET CMP0048 NEW)
|
||||
|
||||
# Options
|
||||
option(SAILFISHOS "Build SailfishOS version of application")
|
||||
option(PLATFORM_SAILFISHOS "Build SailfishOS version of application")
|
||||
option(PLATFORM_QTQUICK "Build QtQuick version of application")
|
||||
|
||||
if(SAILFISHOS)
|
||||
if(PLATFORM_SAILFISHOS)
|
||||
# Hardcode this less?
|
||||
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/lib")
|
||||
endif()
|
||||
|
||||
add_subdirectory(core)
|
||||
if(SAILFISHOS)
|
||||
if(PLATFORM_SAILFISHOS)
|
||||
add_subdirectory(sailfish)
|
||||
else()
|
||||
elseif(PLATFORM_QTQUICK)
|
||||
add_subdirectory(qtquick)
|
||||
endif()
|
||||
|
|
|
@ -27,6 +27,9 @@ set(jellyfin-qt_HEADERS
|
|||
include/JellyfinQt/serverdiscoverymodel.h)
|
||||
|
||||
add_definitions(-DSAILFIN_VERSION=\"${SAILFIN_VERSION}\")
|
||||
if (PLATFORM_SAILFISHOS)
|
||||
add_definitions(-DPLATFORM_SAILFISHOS=1)
|
||||
endif()
|
||||
add_library(jellyfin-qt ${jellyfin-qt_SOURCES} ${jellyfin-qt_HEADERS})
|
||||
target_include_directories(jellyfin-qt
|
||||
PUBLIC "include"
|
||||
|
|
|
@ -27,7 +27,13 @@ CredentialsManager * CredentialsManager::newInstance(QObject *parent) {
|
|||
// FallbackCredentialsManager //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
FallbackCredentialsManager::FallbackCredentialsManager(QObject *parent)
|
||||
: CredentialsManager (parent) {
|
||||
: CredentialsManager (parent)
|
||||
#if PLATFORM_SAILFISHOS
|
||||
// I'd rather not hardcoded this here, but I don´t know a better, quick solution.
|
||||
// since this file must be placed in this path due to sandboxing.
|
||||
, m_settings("nl.netsoj.chris/Sailfin/sailfin")
|
||||
#endif
|
||||
{
|
||||
m_settings.beginGroup("Credentials");
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@ Macros:
|
|||
- '_unpackaged_files_terminate_build; 0 '
|
||||
|
||||
ConfigOptions:
|
||||
- -DCMAKE_BUILD_TYPE=Release
|
||||
- -DSAILFISHOS=1
|
||||
- -DPLATFORM_SAILFISHOS=1
|
||||
- -DSAILFIN_VERSION='%{version}-%{release}'
|
||||
|
||||
# ExtraInstall: |
|
||||
|
|
|
@ -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…
Reference in a new issue