mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Implement plugin update identification by guid
This commit is contained in:
parent
47687eb5e9
commit
29773b4c09
4 changed files with 20 additions and 12 deletions
13
ApiClient.js
13
ApiClient.js
|
@ -730,7 +730,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
/**
|
||||
* Installs or updates a new plugin
|
||||
*/
|
||||
self.installPlugin = function (name, updateClass, version) {
|
||||
self.installPlugin = function (name, guid, updateClass, version) {
|
||||
|
||||
if (!name) {
|
||||
throw new Error("null name");
|
||||
|
@ -741,7 +741,8 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
}
|
||||
|
||||
var options = {
|
||||
updateClass: updateClass
|
||||
updateClass: updateClass,
|
||||
AssemblyGuid: guid
|
||||
};
|
||||
|
||||
if (version) {
|
||||
|
@ -785,13 +786,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
/**
|
||||
* Gets information about an installable package
|
||||
*/
|
||||
self.getPackageInfo = function (name) {
|
||||
self.getPackageInfo = function (name, guid) {
|
||||
|
||||
if (!name) {
|
||||
throw new Error("null name");
|
||||
}
|
||||
|
||||
var url = self.getUrl("Packages/" + name);
|
||||
var options = {
|
||||
AssemblyGuid: guid
|
||||
};
|
||||
|
||||
var url = self.getUrl("Packages/" + name, options);
|
||||
|
||||
return self.ajax({
|
||||
type: "GET",
|
||||
|
|
|
@ -192,8 +192,9 @@
|
|||
Dashboard.showLoadingMsg();
|
||||
|
||||
var name = getParameterByName('name');
|
||||
var guid = getParameterByName('guid');
|
||||
|
||||
var promise1 = ApiClient.getPackageInfo(name);
|
||||
var promise1 = ApiClient.getPackageInfo(name, guid);
|
||||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
var promise3 = ApiClient.getPluginSecurityInfo();
|
||||
|
||||
|
@ -205,9 +206,9 @@
|
|||
|
||||
});
|
||||
|
||||
function performInstallation(packageName, updateClass, version) {
|
||||
function performInstallation(packageName, guid, updateClass, version) {
|
||||
|
||||
ApiClient.installPlugin(packageName, updateClass, version).done(function () {
|
||||
ApiClient.installPlugin(packageName, guid, updateClass, version).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
@ -226,6 +227,7 @@
|
|||
$('#btnInstall', page).button('disable');
|
||||
|
||||
var name = getParameterByName('name');
|
||||
var guid = getParameterByName('guid');
|
||||
|
||||
ApiClient.getInstalledPlugins().done(function (plugins) {
|
||||
|
||||
|
@ -246,14 +248,14 @@
|
|||
if (confirmResult) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
performInstallation(name, vals[1], version);
|
||||
performInstallation(name, guid, vals[1], version);
|
||||
} else {
|
||||
$('#btnInstall', page).button('enable');
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
performInstallation(name, vals[1], version);
|
||||
performInstallation(name, guid, vals[1], version);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@
|
|||
|
||||
html += '<p><strong>A new version of ' + update.name + ' is available!</strong></p>';
|
||||
|
||||
html += '<button type="button" data-icon="download" data-theme="b" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">Update Now</button>';
|
||||
html += '<button type="button" data-icon="download" data-theme="b" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-guid="' + update.guid + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">Update Now</button>';
|
||||
}
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
|
@ -487,12 +487,13 @@
|
|||
$(button).button('disable');
|
||||
|
||||
var name = button.getAttribute('data-name');
|
||||
var guid = button.getAttribute('data-guid');
|
||||
var version = button.getAttribute('data-version');
|
||||
var classification = button.getAttribute('data-classification');
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.installPlugin(name, classification, version).done(function () {
|
||||
ApiClient.installPlugin(name, guid, classification, version).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
currentCategory = category;
|
||||
}
|
||||
|
||||
var href = plugin.externalUrl ? plugin.externalUrl : "addPlugin.html?name=" + encodeURIComponent(plugin.name);
|
||||
var href = plugin.externalUrl ? plugin.externalUrl : "addPlugin.html?name=" + encodeURIComponent(plugin.name) + "&guid=" + plugin.guid;
|
||||
var target = plugin.externalUrl ? ' target="_blank"' : '';
|
||||
|
||||
html += "<a class='posterItem backdropPosterItem transparentPosterItem borderlessPosterItem' href='" + href + "' " + target + ">";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue