mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added modular configuration
This commit is contained in:
parent
0a3876a9b1
commit
6c602e1ad7
5 changed files with 72 additions and 39 deletions
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
function loadPage(page, config, users) {
|
function loadPage(page, config, users) {
|
||||||
|
|
||||||
$('#chkEnableServer', page).checked(config.DlnaOptions.EnableServer).checkboxradio("refresh");
|
$('#chkEnableServer', page).checked(config.EnableServer).checkboxradio("refresh");
|
||||||
$('#chkBlastAliveMessages', page).checked(config.DlnaOptions.BlastAliveMessages).checkboxradio("refresh");
|
$('#chkBlastAliveMessages', page).checked(config.BlastAliveMessages).checkboxradio("refresh");
|
||||||
$('#txtBlastInterval', page).val(config.DlnaOptions.BlastAliveMessageIntervalSeconds);
|
$('#txtBlastInterval', page).val(config.BlastAliveMessageIntervalSeconds);
|
||||||
|
|
||||||
var usersHtml = users.map(function (u) {
|
var usersHtml = users.map(function (u) {
|
||||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
$('#selectUser', page).html(usersHtml).val(config.DlnaOptions.DefaultUserId || '').selectmenu("refresh");
|
$('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '').selectmenu("refresh");
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
var promise1 = ApiClient.getServerConfiguration();
|
var promise1 = ApiClient.getNamedConfiguration("dlna");
|
||||||
var promise2 = ApiClient.getUsers();
|
var promise2 = ApiClient.getUsers();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).done(function (response1, response2) {
|
||||||
|
@ -38,14 +38,14 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||||
|
|
||||||
config.DlnaOptions.EnableServer = $('#chkEnableServer', form).checked();
|
config.EnableServer = $('#chkEnableServer', form).checked();
|
||||||
config.DlnaOptions.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
|
config.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
|
||||||
config.DlnaOptions.BlastAliveMessageIntervalSeconds = $('#txtBlastInterval', form).val();
|
config.BlastAliveMessageIntervalSeconds = $('#txtBlastInterval', form).val();
|
||||||
config.DlnaOptions.DefaultUserId = $('#selectUser', form).val();
|
config.DefaultUserId = $('#selectUser', form).val();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
function loadPage(page, config) {
|
function loadPage(page, config) {
|
||||||
|
|
||||||
$('#chkEnablePlayTo', page).checked(config.DlnaOptions.EnablePlayTo).checkboxradio("refresh");
|
$('#chkEnablePlayTo', page).checked(config.EnablePlayTo).checkboxradio("refresh");
|
||||||
$('#chkEnableDlnaDebugLogging', page).checked(config.DlnaOptions.EnableDebugLogging).checkboxradio("refresh");
|
$('#chkEnableDlnaDebugLogging', page).checked(config.EnableDebugLogging).checkboxradio("refresh");
|
||||||
$('#txtClientDiscoveryInterval', page).val(config.DlnaOptions.ClientDiscoveryIntervalSeconds);
|
$('#txtClientDiscoveryInterval', page).val(config.ClientDiscoveryIntervalSeconds);
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||||
|
|
||||||
config.DlnaOptions.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
|
config.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
|
||||||
config.DlnaOptions.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
|
config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
|
||||||
config.DlnaOptions.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
|
config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
$('.chapterDownloadSettings', page).hide();
|
$('.chapterDownloadSettings', page).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#chkChaptersMovies', page).checked(config.ChapterOptions.EnableMovieChapterImageExtraction).checkboxradio("refresh");
|
$('#chkChaptersMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh");
|
||||||
$('#chkChaptersEpisodes', page).checked(config.ChapterOptions.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
|
$('#chkChaptersEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
|
||||||
$('#chkChaptersOtherVideos', page).checked(config.ChapterOptions.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
|
$('#chkChaptersOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
|
||||||
|
|
||||||
$('#chkDownloadChapterMovies', page).checked(config.ChapterOptions.DownloadMovieChapters).checkboxradio("refresh");
|
$('#chkDownloadChapterMovies', page).checked(config.DownloadMovieChapters).checkboxradio("refresh");
|
||||||
$('#chkDownloadChapterEpisodes', page).checked(config.ChapterOptions.DownloadEpisodeChapters).checkboxradio("refresh");
|
$('#chkDownloadChapterEpisodes', page).checked(config.DownloadEpisodeChapters).checkboxradio("refresh");
|
||||||
|
|
||||||
renderChapterFetchers(page, config, providers);
|
renderChapterFetchers(page, config, providers);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
id = 'chkChapterFetcher' + i;
|
id = 'chkChapterFetcher' + i;
|
||||||
|
|
||||||
var isChecked = config.ChapterOptions.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : '';
|
var isChecked = config.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : '';
|
||||||
|
|
||||||
html += '<input class="chkChapterFetcher" type="checkbox" name="' + id + '" id="' + id + '" data-pluginname="' + plugin.Name + '" data-mini="true"' + isChecked + '>';
|
html += '<input class="chkChapterFetcher" type="checkbox" name="' + id + '" id="' + id + '" data-pluginname="' + plugin.Name + '" data-mini="true"' + isChecked + '>';
|
||||||
html += '<label for="' + id + '">' + plugin.Name + '</label>';
|
html += '<label for="' + id + '">' + plugin.Name + '</label>';
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
var promise1 = ApiClient.getServerConfiguration();
|
var promise1 = ApiClient.getNamedConfiguration("chapters");
|
||||||
var promise2 = $.getJSON(ApiClient.getUrl("Providers/Chapters"));
|
var promise2 = $.getJSON(ApiClient.getUrl("Providers/Chapters"));
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).done(function (response1, response2) {
|
||||||
|
@ -134,28 +134,28 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
ApiClient.getNamedConfiguration("chapters").done(function (config) {
|
||||||
|
|
||||||
config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
|
config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
|
||||||
config.ChapterOptions.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
|
config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
|
||||||
config.ChapterOptions.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
|
config.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
|
||||||
|
|
||||||
config.ChapterOptions.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked();
|
config.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked();
|
||||||
config.ChapterOptions.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked();
|
config.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked();
|
||||||
|
|
||||||
config.ChapterOptions.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) {
|
config.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) {
|
||||||
|
|
||||||
return c.getAttribute('data-pluginname');
|
return c.getAttribute('data-pluginname');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
config.ChapterOptions.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) {
|
config.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) {
|
||||||
|
|
||||||
return c.getAttribute('data-pluginname');
|
return c.getAttribute('data-pluginname');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("chapters", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -14,14 +14,20 @@
|
||||||
// After saving chapter task, now save server config
|
// After saving chapter task, now save server config
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
ApiClient.getServerConfiguration().done(function (config) {
|
||||||
|
|
||||||
config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked();
|
|
||||||
|
|
||||||
config.EnableUPnP = $('#chkEnableUpnp', page).checked();
|
config.EnableUPnP = $('#chkEnableUpnp', page).checked();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(function (result) {
|
ApiClient.updateServerConfiguration(config).done(function (result) {
|
||||||
|
|
||||||
navigateToNextPage();
|
ApiClient.getNamedConfiguration("chapters").done(function (chapterConfig) {
|
||||||
|
|
||||||
|
chapterConfig.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked();
|
||||||
|
|
||||||
|
ApiClient.updateNamedConfiguration("chapters", chapterConfig).done(function () {
|
||||||
|
|
||||||
|
navigateToNextPage();
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1310,6 +1310,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getNamedConfiguration = function (name) {
|
||||||
|
|
||||||
|
var url = self.getUrl("System/Configuration/" + name);
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "json"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server's scheduled tasks
|
* Gets the server's scheduled tasks
|
||||||
|
@ -2393,6 +2404,22 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.updateNamedConfiguration = function (name, configuration) {
|
||||||
|
|
||||||
|
if (!configuration) {
|
||||||
|
throw new Error("null configuration");
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = self.getUrl("System/Configuration/" + name);
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: JSON.stringify(configuration),
|
||||||
|
contentType: "application/json"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
self.updateItem = function (item) {
|
self.updateItem = function (item) {
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue