mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 01:05:17 +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)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
option(SAILFISHOS "Build SailfishOS version of application")
|
option(PLATFORM_SAILFISHOS "Build SailfishOS version of application")
|
||||||
option(PLATFORM_QTQUICK "Build QtQuick version of application")
|
option(PLATFORM_QTQUICK "Build QtQuick version of application")
|
||||||
|
|
||||||
if(SAILFISHOS)
|
if(PLATFORM_SAILFISHOS)
|
||||||
# Hardcode this less?
|
# Hardcode this less?
|
||||||
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/lib")
|
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
if(SAILFISHOS)
|
if(PLATFORM_SAILFISHOS)
|
||||||
add_subdirectory(sailfish)
|
add_subdirectory(sailfish)
|
||||||
else()
|
elseif(PLATFORM_QTQUICK)
|
||||||
add_subdirectory(qtquick)
|
add_subdirectory(qtquick)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -27,6 +27,9 @@ set(jellyfin-qt_HEADERS
|
||||||
include/JellyfinQt/serverdiscoverymodel.h)
|
include/JellyfinQt/serverdiscoverymodel.h)
|
||||||
|
|
||||||
add_definitions(-DSAILFIN_VERSION=\"${SAILFIN_VERSION}\")
|
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})
|
add_library(jellyfin-qt ${jellyfin-qt_SOURCES} ${jellyfin-qt_HEADERS})
|
||||||
target_include_directories(jellyfin-qt
|
target_include_directories(jellyfin-qt
|
||||||
PUBLIC "include"
|
PUBLIC "include"
|
||||||
|
|
|
@ -27,7 +27,13 @@ CredentialsManager * CredentialsManager::newInstance(QObject *parent) {
|
||||||
// FallbackCredentialsManager //
|
// FallbackCredentialsManager //
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
FallbackCredentialsManager::FallbackCredentialsManager(QObject *parent)
|
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");
|
m_settings.beginGroup("Credentials");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,7 @@ Macros:
|
||||||
- '_unpackaged_files_terminate_build; 0 '
|
- '_unpackaged_files_terminate_build; 0 '
|
||||||
|
|
||||||
ConfigOptions:
|
ConfigOptions:
|
||||||
- -DCMAKE_BUILD_TYPE=Release
|
- -DPLATFORM_SAILFISHOS=1
|
||||||
- -DSAILFISHOS=1
|
|
||||||
- -DSAILFIN_VERSION='%{version}-%{release}'
|
- -DSAILFIN_VERSION='%{version}-%{release}'
|
||||||
|
|
||||||
# ExtraInstall: |
|
# ExtraInstall: |
|
||||||
|
|
|
@ -3,7 +3,7 @@ Type=Application
|
||||||
Version=1.1
|
Version=1.1
|
||||||
X-Nemo-Application-Type=silica-qt5
|
X-Nemo-Application-Type=silica-qt5
|
||||||
Icon=harbour-sailfin
|
Icon=harbour-sailfin
|
||||||
Exec=harbour-sailfin
|
Exec=harbour-sailfin --attempt-sandbox
|
||||||
|
|
||||||
|
|
||||||
Name=Sailfin
|
Name=Sailfin
|
||||||
|
@ -17,3 +17,8 @@ GenericName=Jellyfin client
|
||||||
|
|
||||||
Comment=Stream audio and video from your Jellyfin media server
|
Comment=Stream audio and video from your Jellyfin media server
|
||||||
Categories=AudioVideo;Player
|
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>
|
#include <QtQuick>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QCommandLineOption>
|
||||||
|
#include <QCommandLineParser>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJSEngine>
|
#include <QJSEngine>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include <sailfishapp.h>
|
#include <sailfishapp.h>
|
||||||
|
|
||||||
#include <JellyfinQt/jellyfin.h>
|
#include <JellyfinQt/jellyfin.h>
|
||||||
|
|
||||||
|
static const char *SANDBOX_PROGRAM = "/usr/bin/sailjail";
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
// SailfishApp::main() will display "qml/harbour-sailfin.qml", if you need more
|
// SailfishApp::main() will display "qml/harbour-sailfin.qml", if you need more
|
||||||
// control over initialization, you can use:
|
// 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).
|
// To display the view, call "show()" (will show fullscreen on device).
|
||||||
QGuiApplication *app = SailfishApp::application(argc, argv);
|
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();
|
Jellyfin::registerTypes();
|
||||||
QQuickView *view = SailfishApp::createView();
|
QQuickView *view = SailfishApp::createView();
|
||||||
view->setSource(SailfishApp::pathToMainQml());
|
view->setSource(SailfishApp::pathToMainQml());
|
||||||
|
|
Loading…
Reference in a new issue