1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/dashboardhosting.js

84 lines
2.5 KiB
JavaScript
Raw Normal View History

2015-01-18 23:29:57 -05:00
(function ($, document, window) {
function loadPage(page, config) {
$('#txtPortNumber', page).val(config.HttpServerPortNumber);
$('#txtPublicPort', page).val(config.PublicPort);
2015-01-18 23:53:28 -05:00
$('#txtPublicHttpsPort', page).val(config.PublicHttpsPort);
2015-01-18 23:29:57 -05:00
2015-08-19 12:43:23 -04:00
$('#chkEnableHttps', page).checked(config.EnableHttps);
2015-01-18 23:29:57 -05:00
$('#txtHttpsPort', page).val(config.HttpsPortNumber);
$('#txtDdns', page).val(config.WanDdns || '');
2015-01-23 01:15:15 -05:00
$('#txtCertificatePath', page).val(config.CertificatePath || '');
2015-01-18 23:29:57 -05:00
2015-08-19 12:43:23 -04:00
$('#chkEnableUpnp', page).checked(config.EnableUPnP);
2015-01-18 23:29:57 -05:00
Dashboard.hideLoadingMsg();
}
2015-05-14 13:16:29 -04:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.HttpServerPortNumber = $('#txtPortNumber', form).val();
config.PublicPort = $('#txtPublicPort', form).val();
config.PublicHttpsPort = $('#txtPublicHttpsPort', form).val();
config.EnableHttps = $('#chkEnableHttps', form).checked();
config.HttpsPortNumber = $('#txtHttpsPort', form).val();
config.EnableUPnP = $('#chkEnableUpnp', form).checked();
config.WanDdns = $('#txtDdns', form).val();
config.CertificatePath = $('#txtCertificatePath', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
2015-05-19 15:15:40 -04:00
$(document).on('pageshowready', "#dashboardHostingPage", function () {
2015-01-18 23:29:57 -05:00
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
2015-09-01 10:01:59 -04:00
}).on('pageinit', "#dashboardHostingPage", function () {
2015-01-18 23:29:57 -05:00
var page = this;
2015-01-23 01:15:15 -05:00
$('#btnSelectCertPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
includeFiles: true,
includeDirectories: true,
callback: function (path) {
if (path) {
$('#txtCertificatePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectCertificatePath')
});
});
2015-01-18 23:29:57 -05:00
2015-05-14 13:16:29 -04:00
$('.dashboardHostingForm').off('submit', onSubmit).on('submit', onSubmit);
});
2015-01-18 23:29:57 -05:00
})(jQuery, document, window);