diff --git a/client-api.md b/client-api.md index 88ae892..569f9a7 100644 --- a/client-api.md +++ b/client-api.md @@ -141,8 +141,6 @@ system/SystemComponent - [header](https://github.com/plexinc/plex-media-player/b - str getUserAgent() - str debugInformation() - list[str] networkAddresses() -- int networkPort() -- void userInformation(dict userModel) - void openExternalUrl(str url) - Opens in external browser. - void runUserScript(str script) - Starts processes in the datadir + scripts/ - void hello(str version) - called by web client when loading done diff --git a/native/nativeshell.js b/native/nativeshell.js index eab41e7..0873214 100644 --- a/native/nativeshell.js +++ b/native/nativeshell.js @@ -1,5 +1,4 @@ const viewdata = JSON.parse(window.atob("@@data@@")); -console.log(viewdata); const features = [ "filedownload", @@ -115,7 +114,7 @@ window.NativeShell.AppHost = { })(); }, getDefaultLayout() { - return "desktop"; + return viewdata.mode; }, supports(command) { return features.includes(command.toLowerCase()); diff --git a/resources/meta/com.github.iwalton3.jellyfin-media-player.desktop b/resources/meta/com.github.iwalton3.jellyfin-media-player.desktop index c9738bd..5c2854c 100644 --- a/resources/meta/com.github.iwalton3.jellyfin-media-player.desktop +++ b/resources/meta/com.github.iwalton3.jellyfin-media-player.desktop @@ -8,7 +8,7 @@ Terminal=false Type=Application Categories=AudioVideo;Video;Player;TV; -Actions=DesktopF;DesktopW; +Actions=DesktopF;DesktopW;TVF;TVW [Desktop Action DesktopF] Name=Desktop [Fullscreen] @@ -17,3 +17,11 @@ Exec=jellyfinmediaplayer --fullscreen --desktop [Desktop Action DesktopW] Name=Desktop [Windowed] Exec=jellyfinmediaplayer --windowed --desktop + +[Desktop Action TVF] +Name=TV [Fullscreen] +Exec=jellyfinmediaplayer --fullscreen --tv + +[Desktop Action TVW] +Name=TV [Windowed] +Exec=jellyfinmediaplayer --windowed --tv \ No newline at end of file diff --git a/resources/settings/settings_description.json b/resources/settings/settings_description.json index 5cf10a6..47d8a0b 100644 --- a/resources/settings/settings_description.json +++ b/resources/settings/settings_description.json @@ -1,7 +1,7 @@ [ { "section": "__meta__", - "version": 4 + "version": 5 }, { "section": "state", @@ -20,9 +20,8 @@ "values": [ { "value": "webMode", - "default": "tv", + "default": "desktop", "hidden": true, - "platforms": [ "windows", "macosx" ], "possible_values": [ [ "desktop", "desktop" ], [ "tv", "tv" ] @@ -30,18 +29,13 @@ }, { "value": "layout", - "default": "auto", + "default": "desktop", "hidden": true, "possible_values": [ - [ "auto", "auto" ], + [ "desktop", "desktop" ], [ "tv", "tv" ] ] }, - { - "value": "remoteInspector", - "default": false, - "hidden": true - }, { "value": "fullscreen", "default": false, @@ -57,30 +51,6 @@ "value": "alwaysOnTop", "default": false }, - { - "value": "webserverport", - "default": 32433, - "hidden": true - }, - { - "value": "automaticUpdates", - "default": true, - "hidden": true - }, - { - "value": "manualUpdateCheck", - "input_type": "button", - "default": true, - "hidden": true - }, - { - "value": "updateChannel", - "default": 0, - "hidden": true, - "possible_values": [ - [ 0, "Stable" ] - ] - }, { "value": "hdmi_poweron", "default": false, @@ -112,11 +82,6 @@ "default": false, "platforms": [ "windows" ] }, - { - "value": "clientUUID", - "default": "", - "hidden": true - }, { "value": "showPowerOptions", "default": true, @@ -136,16 +101,6 @@ ], "hidden": true }, - { - "value": "preventSystemScreensaver", - "default": false, - "hidden": true - }, - { - "value": "useHelper", - "default": true, - "hidden": true - }, { "value": "forceFSScreen", "platforms_excluded": [ "oe" ], @@ -255,15 +210,7 @@ }, { "value": "hardwareDecoding", - "default": [ - { - "value": "enabled", - "platforms": [ "oe" ] - }, - { - "value": "disabled" - } - ], + "default": "enabled", "possible_values": [ [ "enabled", "video.decode.enabled", { "platforms_excluded": "osx" } ], [ "enabled", "video.decode.enabled.modern", { "platforms": "osx" } ], @@ -278,16 +225,6 @@ "default": false, "platforms_excluded": "oe_rpi" }, - { - "value": "directPlay", - "default": true, - "hidden": true - }, - { - "value": "directStream", - "default": true, - "hidden": true - }, { "value": "sync_mode", "default": "audio", @@ -403,48 +340,14 @@ } ] }, - { - "section": "manualServers", - "hidden": true, - "values": [ - { - "value": "ip1", - "default": "", - "input_type": "ip" - }, - { - "value": "port1", - "default": "32400", - "input_type": "port" - }, - { - "value": "ip2", - "default": "", - "input_type": "ip" - }, - { - "value": "port2", - "default": "32400", - "input_type": "port" - } - ] - }, { "section": "path", "hidden": true, "values": [ - { - "value": "startupurl_tv", - "default": "bundled" - }, { "value": "startupurl_desktop", "default": "bundled" }, - { - "value": "helperprogram", - "default": "" - }, { "value": "startupurl_extension", "default": "bundled" @@ -495,12 +398,6 @@ } ] }, - { - "section": "webclient", - "hidden": true, - "storage": true, - "values": [] - }, { "section": "system", "hidden": true, @@ -527,10 +424,5 @@ "platforms": [ "oe" ] } ] - }, - { - "section": "privacy", - "hidden": true, - "values": [] } ] diff --git a/src/input/InputRoku.cpp b/src/input/InputRoku.cpp index 9c35a27..0a7bdf1 100644 --- a/src/input/InputRoku.cpp +++ b/src/input/InputRoku.cpp @@ -160,7 +160,7 @@ void InputRoku::handleQueryDeviceInfo(QHttpRequest* request, QHttpResponse* resp writer.writeStartDocument(); writer.writeStartElement("device-info"); - writer.writeTextElement("udn", Utils::ClientUUID()); + //writer.writeTextElement("udn", Utils::ClientUUID()); writer.writeTextElement("serial-number", ROKU_SERIAL_NUMBER); writer.writeTextElement("device-id", ROKU_SERIAL_NUMBER); writer.writeTextElement("vendor-name", "Roku"); @@ -243,7 +243,7 @@ void InputRoku::handleRootInfo(QHttpRequest* request, QHttpResponse* response) writer.writeTextElement("modelNumber", "4200X"); writer.writeTextElement("modelURL", "http://www.roku.com"); writer.writeTextElement("serialNumber", ROKU_SERIAL_NUMBER); - writer.writeTextElement("UDN", "uuid:" + Utils::ClientUUID()); + //writer.writeTextElement("UDN", "uuid:" + Utils::ClientUUID()); writer.writeStartElement("serviceList"); writer.writeStartElement("service"); diff --git a/src/main.cpp b/src/main.cpp index a8960ae..b041c73 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,13 +94,10 @@ int main(int argc, char *argv[]) parser.addHelpOption(); parser.addVersionOption(); parser.addOptions({{{"l", "licenses"}, "Show license information"}, - {{"a", "from-auto-update"}, "When invoked from auto-update"}, {"desktop", "Start in desktop mode"}, {"tv", "Start in TV mode"}, - {"auto-layout", "Use auto-layout mode"}, {"windowed", "Start in windowed mode"}, {"fullscreen", "Start in fullscreen"}, - {"no-updates", "Disable auto-updating"}, {"terminal", "Log to terminal"}, {"disable-gpu", "Disable QtWebEngine gpu accel"}}); @@ -192,10 +189,6 @@ int main(int argc, char *argv[]) SettingsComponent::Get().setCommandLineValues(parser.optionNames()); - // enable remote inspection if we have the correct setting for it. - if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "remoteInspector").toBool()) - qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "0.0.0.0:9992"); - QtWebEngine::initialize(); // load QtWebChannel so that we can register our components with it. diff --git a/src/settings/SettingsComponent.cpp b/src/settings/SettingsComponent.cpp index 34a1efa..44ddd35 100644 --- a/src/settings/SettingsComponent.cpp +++ b/src/settings/SettingsComponent.cpp @@ -214,18 +214,14 @@ void SettingsComponent::load() /////////////////////////////////////////////////////////////////////////////////////////////////// void SettingsComponent::loadConf(const QString& path, bool storage) { - bool migrateTvMode = false; + bool migrateJmpSettings = false; QJsonObject json = loadJson(path); int version = json["version"].toInt(0); - // Migrate to settings version 4 - if (version == 3 && m_settingsVersion == 4) + if (version == 4 && m_settingsVersion == 5) { - // We only need to make sure that old users have the - // webmode set to "tv" so that we don't flip their - // interface unnecessarly - migrateTvMode = true; + migrateJmpSettings = true; } else if (version != m_settingsVersion) { @@ -268,8 +264,13 @@ void SettingsComponent::loadConf(const QString& path, bool storage) sec->setValue(setting, jsonSection.value(setting).toVariant()); } - if (migrateTvMode) - getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "tv"); + if (migrateJmpSettings) { + getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "desktop"); + getSection(SETTINGS_SECTION_MAIN)->setValue("layout", "desktop"); + if (getSection(SETTINGS_SECTION_VIDEO)->value("hardwareDecoding") == "disabled") { + getSection(SETTINGS_SECTION_VIDEO)->setValue("hardwareDecoding", "enabled"); + } + } } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -698,23 +699,6 @@ void SettingsComponent::setupVersion() } } -///////////////////////////////////////////////////////////////////////////////////////// -void SettingsComponent::setUserRoleList(const QStringList& userRoles) -{ - QVariantList values; - - // Channel names and values are aligned with values expected by plex.tv. - // See: https://github.com/plexinc/plex-media-player-private/issues/642 - - // Public is always available as the default value. - QVariantMap publicChannel; - publicChannel.insert("value", 0); - publicChannel.insert("title", "Public"); - values << publicChannel; - - updatePossibleValues(SETTINGS_SECTION_MAIN, "updateChannel", values); -} - ///////////////////////////////////////////////////////////////////////////////////////// bool SettingsComponent::resetAndSaveOldConfiguration() { @@ -774,8 +758,6 @@ void SettingsComponent::setCommandLineValues(const QStringList& values) { QLOG_DEBUG() << values; - QString mode = ""; // unset, different from "auto" - for (const QString& value : values) { if (value == "fullscreen") @@ -783,14 +765,9 @@ void SettingsComponent::setCommandLineValues(const QStringList& values) else if (value == "windowed") setValue(SETTINGS_SECTION_MAIN, "fullscreen", false); else if (value == "desktop") - mode = "desktop"; + setValue(SETTINGS_SECTION_MAIN, "layout", "desktop"); else if (value == "tv") - mode = "tv"; - else if (value == "auto-layout") - mode = "auto"; + setValue(SETTINGS_SECTION_MAIN, "layout", "tv"); } - - setValue(SETTINGS_SECTION_MAIN, "layout", "auto"); - setValue(SETTINGS_SECTION_MAIN, "webMode", "desktop"); } diff --git a/src/settings/SettingsComponent.h b/src/settings/SettingsComponent.h index a08b393..9da1a3b 100644 --- a/src/settings/SettingsComponent.h +++ b/src/settings/SettingsComponent.h @@ -80,8 +80,6 @@ public: // part of the map. Q_SIGNAL void sectionValueUpdate(const QString& section, const QVariantMap& values); - void setUserRoleList(const QStringList& userRoles); - // A hack to load a value from the config file at very early init time, before // the SettingsComponent is created. // diff --git a/src/system/SystemComponent.cpp b/src/system/SystemComponent.cpp index 7c016e6..b3ad7e8 100644 --- a/src/system/SystemComponent.cpp +++ b/src/system/SystemComponent.cpp @@ -249,12 +249,6 @@ QString SystemComponent::debugInformation() return debugInfo; } -///////////////////////////////////////////////////////////////////////////////////////// -int SystemComponent::networkPort() const -{ - return SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "webserverport").toInt(); -} - ///////////////////////////////////////////////////////////////////////////////////////// QStringList SystemComponent::networkAddresses() const { @@ -273,21 +267,6 @@ QStringList SystemComponent::networkAddresses() const return list; } -///////////////////////////////////////////////////////////////////////////////////////// -void SystemComponent::userInformation(const QVariantMap& userModel) -{ - QStringList roleList; - for(const QVariant& role : userModel.value("roles").toList()) - { - roleList << role.toMap().value("id").toString(); - } - - SettingsComponent::Get().setUserRoleList(roleList); - - m_authenticationToken = userModel.value("authToken").toString(); - emit userInfoChanged(); -} - ///////////////////////////////////////////////////////////////////////////////////////// void SystemComponent::openExternalUrl(const QString& url) { @@ -347,6 +326,7 @@ QString SystemComponent::getNativeShellScript() QJsonObject clientData; clientData.insert("deviceName", QJsonValue::fromVariant(SettingsComponent::Get().getClientName())); clientData.insert("scriptPath", QJsonValue::fromVariant("file:///" + path)); + clientData.insert("mode", QJsonValue::fromVariant(SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "layout").toString())); nativeshellString.replace("@@data@@", QJsonDocument(clientData).toJson(QJsonDocument::Compact).toBase64()); return nativeshellString; } diff --git a/src/system/SystemComponent.h b/src/system/SystemComponent.h index 11d6f74..f9d5f41 100644 --- a/src/system/SystemComponent.h +++ b/src/system/SystemComponent.h @@ -39,9 +39,6 @@ public: Q_INVOKABLE QString debugInformation(); Q_INVOKABLE QStringList networkAddresses() const; - Q_INVOKABLE int networkPort() const; - - Q_INVOKABLE void userInformation(const QVariantMap& userModel); Q_INVOKABLE void openExternalUrl(const QString& url); diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 7764b2f..7f8859c 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -142,20 +142,6 @@ QString Utils::PrimaryIPv4Address() return ""; } -///////////////////////////////////////////////////////////////////////////////////////// -QString Utils::ClientUUID() -{ - QString storedUUID = SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "clientUUID").toString(); - if (storedUUID.isEmpty()) - { - QString newUUID = QUuid::createUuid().toString(); - newUUID = newUUID.replace("{", "").replace("}", ""); - SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "clientUUID", newUUID); - return newUUID; - } - return storedUUID; -} - /////////////////////////////////////////////////////////////////////////////////////////////////// bool Utils::safelyWriteFile(const QString& filename, const QByteArray& data) { diff --git a/src/utils/Utils.h b/src/utils/Utils.h index 54a9f3a..06caae6 100644 --- a/src/utils/Utils.h +++ b/src/utils/Utils.h @@ -56,7 +56,6 @@ namespace Utils QString CurrentUserId(); QString ComputerName(); QString PrimaryIPv4Address(); - QString ClientUUID(); bool safelyWriteFile(const QString& filename, const QByteArray& data); QString sanitizeForHttpSeparators(const QString& input); }