1
0
Fork 0
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:
Luke Pulverenti 2016-03-29 01:16:44 -04:00
parent ae57b97712
commit 4a50925c17
7 changed files with 118 additions and 111 deletions

View file

@ -2,26 +2,6 @@
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);
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
@ -36,10 +16,6 @@
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.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();

View file

@ -34,6 +34,29 @@
$('#chkUsageData', page).checked(config.EnableAnonymousUsageReporting);
$('#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();
}
@ -57,6 +80,14 @@
config.EnableAnonymousUsageReporting = $('#chkUsageData', 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.getNamedConfiguration(brandingConfigKey).then(function (brandingConfig) {
@ -82,6 +113,16 @@
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 () {
require(['directorybrowser'], function (directoryBrowser) {

View file

@ -478,10 +478,17 @@
break;
case 'download':
{
var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", {
api_key: ApiClient.accessToken()
require(['fileDownloader'], function (fileDownloader) {
var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", {
api_key: ApiClient.accessToken()
});
fileDownloader([{
url: downloadHref,
itemId: itemId
}]);
});
window.location.href = downloadHref;
break;
}

View file

@ -910,11 +910,6 @@ var Dashboard = {
href: "autoorganizelog.html",
pageIds: ['libraryFileOrganizerPage', 'libraryFileOrganizerSmartMatchPage', 'libraryFileOrganizerLogPage'],
icon: 'folder'
}, {
name: Globalize.translate('TabGeneral'),
href: "advanced.html",
pageIds: ['advancedConfigurationPage'],
icon: 'mode-edit'
},
{
name: Globalize.translate('TabHosting'),
@ -1536,7 +1531,7 @@ var AppInfo = {};
// This doesn't perform well on iOS
AppInfo.enableHeadRoom = !isIOS;
AppInfo.supportsDownloading = !(AppInfo.isNativeApp);
AppInfo.supportsDownloading = !(AppInfo.isNativeApp && isIOS);
// This currently isn't working on android, unfortunately
AppInfo.supportsFileInput = !(AppInfo.isNativeApp && isAndroid);
@ -2123,6 +2118,12 @@ var AppInfo = {};
} else {
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) {
@ -2319,13 +2320,6 @@ var AppInfo = {};
roles: 'admin'
});
defineRoute({
path: '/advanced.html',
dependencies: [],
autoFocus: false,
roles: 'admin'
});
defineRoute({
path: '/appservices.html',
dependencies: [],