mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
make download function modular
This commit is contained in:
parent
ae57b97712
commit
4a50925c17
7 changed files with 118 additions and 111 deletions
|
@ -1,71 +0,0 @@
|
||||||
<div id="advancedConfigurationPage" data-role="page" class="page type-interior advancedConfigurationPage" data-require="emby-collapsible,scripts/advancedconfigurationpage,paper-input,paper-checkbox">
|
|
||||||
|
|
||||||
<div data-role="content">
|
|
||||||
<div class="content-primary">
|
|
||||||
|
|
||||||
<form class="advancedConfigurationForm">
|
|
||||||
|
|
||||||
<emby-collapsible title="${HeaderAutomaticUpdates}">
|
|
||||||
<br />
|
|
||||||
<ul data-role="listview" class="ulForm">
|
|
||||||
<li class="fldAutomaticUpdates">
|
|
||||||
<div data-role="controlgroup">
|
|
||||||
<input type="checkbox" id="chkEnableAutomaticServerUpdates" data-mini="true" />
|
|
||||||
<label for="chkEnableAutomaticServerUpdates">${OptionEnableAutomaticServerUpdates}</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="lnlAutomaticUpdateLevel selectLabel" for="selectAutomaticUpdateLevel"></label>
|
|
||||||
<select name="selectAutomaticUpdateLevel" id="selectAutomaticUpdateLevel">
|
|
||||||
<option value="Release">${OptionRelease}</option>
|
|
||||||
<option value="Beta">${OptionBeta}</option>
|
|
||||||
<option value="Dev">${OptionDev}</option>
|
|
||||||
</select>
|
|
||||||
<div id="devBuildWarning" class="fieldDescription warningFieldDescription" style="display: none;">
|
|
||||||
${DevBuildWarning}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li id="fldEnableAutomaticRestart" style="display: none;">
|
|
||||||
<paper-checkbox id="chkEnableAutomaticRestart">${LabelAllowServerAutoRestart}</paper-checkbox>
|
|
||||||
<div class="fieldDescription paperCheckboxFieldDescription">
|
|
||||||
${LabelAllowServerAutoRestartHelp}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</emby-collapsible>
|
|
||||||
|
|
||||||
<emby-collapsible title="${HeaderDeveloperOptions}">
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<paper-checkbox id="chkEnableDashboardResponseCache">${OptionEnableWebClientResponseCache}</paper-checkbox>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<paper-checkbox id="chkEnableMinification">${OptionEnableWebClientResourceMinification}</paper-checkbox>
|
|
||||||
</div>
|
|
||||||
<div class="fieldDescription paperCheckboxFieldDescription">
|
|
||||||
${OptionDisableForDevelopmentHelp}
|
|
||||||
</div>
|
|
||||||
<br /><br />
|
|
||||||
<ul data-role="listview" class="ulForm">
|
|
||||||
<li>
|
|
||||||
<paper-input type="text" id="txtDashboardSourcePath" label="${LabelDashboardSourcePath}" style="display: inline-block; width: 80%;"></paper-input>
|
|
||||||
<paper-icon-button id="btnSelectDashboardSourcePath" icon="search" title="${ButtonSelectDirectory}"></paper-icon-button>
|
|
||||||
<div class="fieldDescription">${LabelDashboardSourcePathHelp}</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</emby-collapsible>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<ul data-role="listview" class="ulForm">
|
|
||||||
<li>
|
|
||||||
<button type="submit" data-role="none" class="clearButton">
|
|
||||||
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
9
dashboard-ui/components/filedownloader.js
Normal file
9
dashboard-ui/components/filedownloader.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
define([], function () {
|
||||||
|
|
||||||
|
return function (items) {
|
||||||
|
|
||||||
|
items.forEach(function (item) {
|
||||||
|
window.location.href = item.url;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
|
@ -53,6 +53,35 @@
|
||||||
</ul>
|
</ul>
|
||||||
</emby-collapsible>
|
</emby-collapsible>
|
||||||
|
|
||||||
|
<emby-collapsible title="${HeaderAutomaticUpdates}">
|
||||||
|
<br />
|
||||||
|
<ul data-role="listview" class="ulForm">
|
||||||
|
<li class="fldAutomaticUpdates">
|
||||||
|
<div data-role="controlgroup">
|
||||||
|
<input type="checkbox" id="chkEnableAutomaticServerUpdates" data-mini="true" />
|
||||||
|
<label for="chkEnableAutomaticServerUpdates">${OptionEnableAutomaticServerUpdates}</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label class="lnlAutomaticUpdateLevel selectLabel" for="selectAutomaticUpdateLevel"></label>
|
||||||
|
<select name="selectAutomaticUpdateLevel" id="selectAutomaticUpdateLevel">
|
||||||
|
<option value="Release">${OptionRelease}</option>
|
||||||
|
<option value="Beta">${OptionBeta}</option>
|
||||||
|
<option value="Dev">${OptionDev}</option>
|
||||||
|
</select>
|
||||||
|
<div id="devBuildWarning" class="fieldDescription warningFieldDescription" style="display: none;">
|
||||||
|
${DevBuildWarning}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li id="fldEnableAutomaticRestart" style="display: none;">
|
||||||
|
<paper-checkbox id="chkEnableAutomaticRestart">${LabelAllowServerAutoRestart}</paper-checkbox>
|
||||||
|
<div class="fieldDescription paperCheckboxFieldDescription">
|
||||||
|
${LabelAllowServerAutoRestartHelp}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</emby-collapsible>
|
||||||
|
|
||||||
<emby-collapsible title="${HeaderBranding}">
|
<emby-collapsible title="${HeaderBranding}">
|
||||||
<p>${HeaderBrandingHelp}</p>
|
<p>${HeaderBrandingHelp}</p>
|
||||||
<br />
|
<br />
|
||||||
|
@ -68,6 +97,28 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</emby-collapsible>
|
</emby-collapsible>
|
||||||
|
|
||||||
|
<emby-collapsible title="${HeaderDeveloperOptions}">
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<paper-checkbox id="chkEnableDashboardResponseCache">${OptionEnableWebClientResponseCache}</paper-checkbox>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<paper-checkbox id="chkEnableMinification">${OptionEnableWebClientResourceMinification}</paper-checkbox>
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription paperCheckboxFieldDescription">
|
||||||
|
${OptionDisableForDevelopmentHelp}
|
||||||
|
</div>
|
||||||
|
<br /><br />
|
||||||
|
<ul data-role="listview" class="ulForm">
|
||||||
|
<li>
|
||||||
|
<paper-input type="text" id="txtDashboardSourcePath" label="${LabelDashboardSourcePath}" style="display: inline-block; width: 80%;"></paper-input>
|
||||||
|
<paper-icon-button id="btnSelectDashboardSourcePath" icon="search" title="${ButtonSelectDirectory}"></paper-icon-button>
|
||||||
|
<div class="fieldDescription">${LabelDashboardSourcePathHelp}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</emby-collapsible>
|
||||||
<br />
|
<br />
|
||||||
<ul data-role="listview" class="ulForm">
|
<ul data-role="listview" class="ulForm">
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -2,26 +2,6 @@
|
||||||
|
|
||||||
function loadPage(page, config, systemInfo) {
|
function loadPage(page, config, systemInfo) {
|
||||||
|
|
||||||
if (systemInfo.CanSelfUpdate) {
|
|
||||||
$('.fldAutomaticUpdates', page).show();
|
|
||||||
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevel'));
|
|
||||||
} else {
|
|
||||||
$('.fldAutomaticUpdates', page).hide();
|
|
||||||
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevelForPlugins'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#chkEnableAutomaticServerUpdates', page).checked(config.EnableAutoUpdate);
|
|
||||||
$('#chkEnableAutomaticRestart', page).checked(config.EnableAutomaticRestart);
|
|
||||||
|
|
||||||
if (systemInfo.CanSelfRestart) {
|
|
||||||
$('#fldEnableAutomaticRestart', page).show();
|
|
||||||
} else {
|
|
||||||
$('#fldEnableAutomaticRestart', page).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#selectAutomaticUpdateLevel', page).val(config.SystemUpdateLevel).trigger('change');
|
|
||||||
|
|
||||||
|
|
||||||
$('#chkEnableDashboardResponseCache', page).checked(config.EnableDashboardResponseCaching);
|
$('#chkEnableDashboardResponseCache', page).checked(config.EnableDashboardResponseCaching);
|
||||||
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
|
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
|
||||||
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
|
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
|
||||||
|
@ -36,10 +16,6 @@
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
|
|
||||||
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
|
|
||||||
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
|
|
||||||
config.EnableAutoUpdate = $('#chkEnableAutomaticServerUpdates', form).checked();
|
|
||||||
|
|
||||||
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
||||||
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||||
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||||
|
|
|
@ -34,6 +34,29 @@
|
||||||
$('#chkUsageData', page).checked(config.EnableAnonymousUsageReporting);
|
$('#chkUsageData', page).checked(config.EnableAnonymousUsageReporting);
|
||||||
$('#chkRunAtStartup', page).checked(config.RunAtStartup);
|
$('#chkRunAtStartup', page).checked(config.RunAtStartup);
|
||||||
|
|
||||||
|
if (systemInfo.CanSelfUpdate) {
|
||||||
|
$('.fldAutomaticUpdates', page).show();
|
||||||
|
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevel'));
|
||||||
|
} else {
|
||||||
|
$('.fldAutomaticUpdates', page).hide();
|
||||||
|
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevelForPlugins'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#chkEnableAutomaticServerUpdates', page).checked(config.EnableAutoUpdate);
|
||||||
|
$('#chkEnableAutomaticRestart', page).checked(config.EnableAutomaticRestart);
|
||||||
|
|
||||||
|
if (systemInfo.CanSelfRestart) {
|
||||||
|
$('#fldEnableAutomaticRestart', page).show();
|
||||||
|
} else {
|
||||||
|
$('#fldEnableAutomaticRestart', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#selectAutomaticUpdateLevel', page).val(config.SystemUpdateLevel).trigger('change');
|
||||||
|
|
||||||
|
$('#chkEnableDashboardResponseCache', page).checked(config.EnableDashboardResponseCaching);
|
||||||
|
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
|
||||||
|
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +80,14 @@
|
||||||
config.EnableAnonymousUsageReporting = $('#chkUsageData', form).checked();
|
config.EnableAnonymousUsageReporting = $('#chkUsageData', form).checked();
|
||||||
config.RunAtStartup = $('#chkRunAtStartup', form).checked();
|
config.RunAtStartup = $('#chkRunAtStartup', form).checked();
|
||||||
|
|
||||||
|
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
|
||||||
|
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
|
||||||
|
config.EnableAutoUpdate = $('#chkEnableAutomaticServerUpdates', form).checked();
|
||||||
|
|
||||||
|
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
||||||
|
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||||
|
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).then(function () {
|
ApiClient.updateServerConfiguration(config).then(function () {
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (brandingConfig) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (brandingConfig) {
|
||||||
|
@ -82,6 +113,16 @@
|
||||||
|
|
||||||
return function (view, params) {
|
return function (view, params) {
|
||||||
|
|
||||||
|
$('#selectAutomaticUpdateLevel', view).on('change', function () {
|
||||||
|
|
||||||
|
if (this.value == "Dev") {
|
||||||
|
$('#devBuildWarning', view).show();
|
||||||
|
} else {
|
||||||
|
$('#devBuildWarning', view).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$('#btnSelectCachePath', view).on("click.selectDirectory", function () {
|
$('#btnSelectCachePath', view).on("click.selectDirectory", function () {
|
||||||
|
|
||||||
require(['directorybrowser'], function (directoryBrowser) {
|
require(['directorybrowser'], function (directoryBrowser) {
|
||||||
|
|
|
@ -478,10 +478,17 @@
|
||||||
break;
|
break;
|
||||||
case 'download':
|
case 'download':
|
||||||
{
|
{
|
||||||
var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", {
|
require(['fileDownloader'], function (fileDownloader) {
|
||||||
api_key: ApiClient.accessToken()
|
|
||||||
|
var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", {
|
||||||
|
api_key: ApiClient.accessToken()
|
||||||
|
});
|
||||||
|
|
||||||
|
fileDownloader([{
|
||||||
|
url: downloadHref,
|
||||||
|
itemId: itemId
|
||||||
|
}]);
|
||||||
});
|
});
|
||||||
window.location.href = downloadHref;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -910,11 +910,6 @@ var Dashboard = {
|
||||||
href: "autoorganizelog.html",
|
href: "autoorganizelog.html",
|
||||||
pageIds: ['libraryFileOrganizerPage', 'libraryFileOrganizerSmartMatchPage', 'libraryFileOrganizerLogPage'],
|
pageIds: ['libraryFileOrganizerPage', 'libraryFileOrganizerSmartMatchPage', 'libraryFileOrganizerLogPage'],
|
||||||
icon: 'folder'
|
icon: 'folder'
|
||||||
}, {
|
|
||||||
name: Globalize.translate('TabGeneral'),
|
|
||||||
href: "advanced.html",
|
|
||||||
pageIds: ['advancedConfigurationPage'],
|
|
||||||
icon: 'mode-edit'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: Globalize.translate('TabHosting'),
|
name: Globalize.translate('TabHosting'),
|
||||||
|
@ -1536,7 +1531,7 @@ var AppInfo = {};
|
||||||
// This doesn't perform well on iOS
|
// This doesn't perform well on iOS
|
||||||
AppInfo.enableHeadRoom = !isIOS;
|
AppInfo.enableHeadRoom = !isIOS;
|
||||||
|
|
||||||
AppInfo.supportsDownloading = !(AppInfo.isNativeApp);
|
AppInfo.supportsDownloading = !(AppInfo.isNativeApp && isIOS);
|
||||||
|
|
||||||
// This currently isn't working on android, unfortunately
|
// This currently isn't working on android, unfortunately
|
||||||
AppInfo.supportsFileInput = !(AppInfo.isNativeApp && isAndroid);
|
AppInfo.supportsFileInput = !(AppInfo.isNativeApp && isAndroid);
|
||||||
|
@ -2123,6 +2118,12 @@ var AppInfo = {};
|
||||||
} else {
|
} else {
|
||||||
define("loading", [embyWebComponentsBowerPath + "/loading/loading-lite"], returnFirstDependency);
|
define("loading", [embyWebComponentsBowerPath + "/loading/loading-lite"], returnFirstDependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Dashboard.isRunningInCordova() && browser.android) {
|
||||||
|
define("fileDownloader", 'components/filedownloader', returnFirstDependency);
|
||||||
|
} else {
|
||||||
|
define("fileDownloader", 'cordova/android/filedownloader', returnFirstDependency);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(hostingAppInfo) {
|
function init(hostingAppInfo) {
|
||||||
|
@ -2319,13 +2320,6 @@ var AppInfo = {};
|
||||||
roles: 'admin'
|
roles: 'admin'
|
||||||
});
|
});
|
||||||
|
|
||||||
defineRoute({
|
|
||||||
path: '/advanced.html',
|
|
||||||
dependencies: [],
|
|
||||||
autoFocus: false,
|
|
||||||
roles: 'admin'
|
|
||||||
});
|
|
||||||
|
|
||||||
defineRoute({
|
defineRoute({
|
||||||
path: '/appservices.html',
|
path: '/appservices.html',
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue