1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/controllers/wizard/remoteaccess.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-05-04 12:44:12 +02:00
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
'use strict';
2018-10-23 01:05:09 +03:00
function save(page) {
loading.show();
2019-10-08 01:28:30 +03:00
var apiClient = ApiClient;
var config = {};
2020-05-04 12:44:12 +02:00
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
2019-10-08 01:28:30 +03:00
apiClient.ajax({
2020-05-04 12:44:12 +02:00
type: 'POST',
2018-10-23 01:05:09 +03:00
data: config,
2020-05-04 12:44:12 +02:00
url: apiClient.getUrl('Startup/RemoteAccess')
2019-10-08 01:28:30 +03:00
}).then(function () {
loading.hide();
navigateToNextPage();
});
2018-10-23 01:05:09 +03:00
}
function navigateToNextPage() {
2020-05-04 12:44:12 +02:00
Dashboard.navigate('wizardfinish.html');
2018-10-23 01:05:09 +03:00
}
function onSubmit(e) {
2019-10-08 01:28:30 +03:00
save(this);
e.preventDefault();
return false;
2018-10-23 01:05:09 +03:00
}
2019-10-08 01:28:30 +03:00
return function (view, params) {
2020-05-04 12:44:12 +02:00
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
view.addEventListener('viewshow', function () {
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
2019-10-08 01:28:30 +03:00
});
2020-05-04 12:44:12 +02:00
view.addEventListener('viewhide', function () {
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
2019-10-08 01:28:30 +03:00
});
};
2018-12-11 00:46:50 -05:00
});