mirror of
https://github.com/jellyfin/jellyfin-media-player.git
synced 2024-11-27 08:10:25 +00:00
Load web-client from resources directory instead of the Qt resource system
Now that the web-client is bundled with the binaries in the resources directory we want to load it from there directly as well. Since many configuration point the startup URL to qrc://konvergo/index.html we need to migrate them to a new value. Instead of putting the full file:// url in this setting I made a special value called "bundled" instead that will always point to the latest version of the bundled web-client. This makes any future migrations unnecessary. This is implemented in a new function in SettingsComponent as opposed to just reading the values raw.
This commit is contained in:
parent
bd51fbfcfc
commit
c2df48f19e
@ -362,7 +362,7 @@
|
||||
"values": [
|
||||
{
|
||||
"value": "startupurl",
|
||||
"default": "qrc:/konvergo/index.html"
|
||||
"default": "bundled"
|
||||
},
|
||||
{
|
||||
"value": "helperprogram",
|
||||
|
@ -20,7 +20,7 @@ QString Version::GetBuildDate()
|
||||
|
||||
QString Version::GetWebVersion()
|
||||
{
|
||||
return QString("@WEB_CLIENT_VERSION@");
|
||||
return QString("@WEB_CLIENT_VERSTR@");
|
||||
}
|
||||
|
||||
QString Version::GetDependenciesVersion()
|
||||
@ -31,4 +31,4 @@ QString Version::GetDependenciesVersion()
|
||||
QString Version::GetQtDepsVersion()
|
||||
{
|
||||
return QString("@QT_DEPS_HASH@");
|
||||
}
|
||||
}
|
||||
|
@ -667,3 +667,21 @@ bool SettingsComponent::resetAndSaveOldConfiguration()
|
||||
return settingsFile.rename(Paths::dataDir("plexmediaplayer.conf.old"));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
QString SettingsComponent::getWebClientUrl()
|
||||
{
|
||||
auto url = SettingsComponent::Get().value(SETTINGS_SECTION_PATH, "startupurl").toString();
|
||||
|
||||
// Transition to the new value so that old users are not screwed.
|
||||
if (url == "qrc:/konvergo/index.html")
|
||||
{
|
||||
SettingsComponent::Get().setValue(SETTINGS_SECTION_PATH, "startupurl", "bundled");
|
||||
url = "bundled";
|
||||
}
|
||||
|
||||
if (url == "bundled")
|
||||
return "file://" + Paths::webClientPath();
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
Q_INVOKABLE void removeValue(const QString& sectionOrKey);
|
||||
Q_INVOKABLE void resetToDefault();
|
||||
Q_INVOKABLE QVariantList settingDescriptions();
|
||||
Q_INVOKABLE QString getWebClientUrl();
|
||||
|
||||
// host commands
|
||||
Q_SLOT void cycleSetting(const QString& args);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <QsLog.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include "Names.h"
|
||||
#include "Version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
static QDir writableLocation(QStandardPaths::StandardLocation loc)
|
||||
@ -110,3 +111,10 @@ QString Paths::soundsPath(const QString& sound)
|
||||
|
||||
return f.absoluteFilePath();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
QString Paths::webClientPath()
|
||||
{
|
||||
QString webName = QString("web-client-%1").arg(Version::GetWebVersion());
|
||||
return resourceDir(webName + "/index.html");
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ namespace Paths
|
||||
QString logDir(const QString& file = QString());
|
||||
QString socketName(const QString& serverName);
|
||||
QString soundsPath(const QString& sound);
|
||||
QString webClientPath();
|
||||
};
|
||||
|
||||
#endif //KONVERGO_PATHS_H
|
||||
|
@ -63,7 +63,7 @@ KonvergoWindow
|
||||
backgroundColor : "#111111"
|
||||
forceActiveFocus()
|
||||
mainWindow.reloadWebClient.connect(reload)
|
||||
url = components.settings.value("path", "startupurl") + getInitialScaleArg();
|
||||
url = components.settings.getWebClientUrl() + getInitialScaleArg();
|
||||
}
|
||||
|
||||
onLoadingChanged:
|
||||
@ -81,8 +81,8 @@ KonvergoWindow
|
||||
errorLabel.visible = true
|
||||
errorLabel.text = "Error loading client, this is bad and should not happen<br>" +
|
||||
"You can try to <a href='reload'>reload</a> or head to our <a href='http://plex.tv/support'>support page</a><br><br>Actual Error: <pre>" +
|
||||
loadRequest.url + "\n" + loadRequest.errorString + " [" + loadRequest.errorCode + "]</pre><br><br>" +
|
||||
"Provide the <a href='file://"+ components.system.logFilePath() + "'>logfile</a> as well."
|
||||
loadRequest.errorString + " [" + loadRequest.errorCode + "]</pre><br><br>" +
|
||||
"Provide the <a href='file://"+ components.system.logFilePath + "'>logfile</a> as well."
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,8 +114,8 @@ KonvergoWindow
|
||||
{
|
||||
if (link == "reload")
|
||||
{
|
||||
web.reload()
|
||||
errorLabel.visible = false
|
||||
web.reload()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user