mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
8f19e02116
commit
d2d7f7e865
5 changed files with 85 additions and 36 deletions
|
@ -16,12 +16,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.0.45",
|
"version": "1.0.47",
|
||||||
"_release": "1.0.45",
|
"_release": "1.0.47",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.0.45",
|
"tag": "1.0.47",
|
||||||
"commit": "b49575b7ace02784d060db167c17e92deec3512e"
|
"commit": "e54fbdbdc56bd99a253adc96fd8847b67225b79a"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
|
"_source": "git://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
|
||||||
"_target": "~1.0.3",
|
"_target": "~1.0.3",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['events', 'apiclient'], function (Events, apiClientFactory) {
|
define(['events', 'apiclient', 'appStorage'], function (Events, apiClientFactory, appStorage) {
|
||||||
|
|
||||||
var ConnectionState = {
|
var ConnectionState = {
|
||||||
Unavailable: 0,
|
Unavailable: 0,
|
||||||
|
@ -1497,29 +1497,82 @@
|
||||||
|
|
||||||
self.getRegistrationInfo = function (feature, apiClient) {
|
self.getRegistrationInfo = function (feature, apiClient) {
|
||||||
|
|
||||||
if (isConnectUserSupporter()) {
|
var params = {
|
||||||
return Promise.resolve({
|
serverId: apiClient.serverInfo().Id,
|
||||||
Name: feature,
|
deviceId: self.deviceId(),
|
||||||
IsRegistered: true,
|
deviceName: deviceName,
|
||||||
IsTrial: false
|
appName: appName,
|
||||||
|
appVersion: appVersion,
|
||||||
|
embyUserName: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
var cacheKey = 'regInfo-' + params.serverId;
|
||||||
|
var regInfo = JSON.parse(appStorage.getItem(cacheKey) || '{}');
|
||||||
|
|
||||||
|
var updateDevicePromise;
|
||||||
|
|
||||||
|
// Cache for 3 days
|
||||||
|
if (params.deviceId && (new Date().getTime() - (regInfo.lastValidDate || 0)) < 259200000) {
|
||||||
|
|
||||||
|
console.log('getRegistrationInfo has cached info');
|
||||||
|
|
||||||
|
if (regInfo.deviceId == params.deviceId) {
|
||||||
|
console.log('getRegistrationInfo returning cached info');
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateDevicePromise = ajax({
|
||||||
|
url: 'https://mb3admin.com/admin/service/registration/updateDevice?' + paramsToString({
|
||||||
|
serverId: params.serverId,
|
||||||
|
oldDeviceId: regInfo.deviceId,
|
||||||
|
newDeviceId: params.deviceId
|
||||||
|
}),
|
||||||
|
type: 'POST'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiClient.getRegistrationInfo(feature);
|
if (!updateDevicePromise) {
|
||||||
};
|
updateDevicePromise = Promise.resolve();
|
||||||
|
|
||||||
function isConnectUserSupporter() {
|
|
||||||
|
|
||||||
if (self.isLoggedIntoConnect()) {
|
|
||||||
|
|
||||||
var connectUser = self.connectUser();
|
|
||||||
|
|
||||||
if (connectUser && connectUser.IsSupporter) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
return updateDevicePromise.then(function () {
|
||||||
|
return apiClient.getCurrentUser().then(function (user) {
|
||||||
|
|
||||||
|
params.embyUserName = user.Name;
|
||||||
|
|
||||||
|
return ajax({
|
||||||
|
url: 'https://mb3admin.com/admin/service/registration/validateDevice?' + paramsToString(params),
|
||||||
|
type: 'POST'
|
||||||
|
|
||||||
|
}).then(function (response) {
|
||||||
|
|
||||||
|
var status = response.status;
|
||||||
|
console.log('getRegistrationInfo response: ' + status);
|
||||||
|
|
||||||
|
if (status == 200) {
|
||||||
|
appStorage.setItem(cacheKey, JSON.stringify({
|
||||||
|
lastValidDate: new Date().getTime(),
|
||||||
|
deviceId: params.deviceId
|
||||||
|
}));
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (status == 401) {
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
|
if (status == 403) {
|
||||||
|
return Promise.reject('overlimit');
|
||||||
|
}
|
||||||
|
|
||||||
|
// general error
|
||||||
|
return Promise.reject();
|
||||||
|
|
||||||
|
}, function (err) {
|
||||||
|
console.log('getRegistrationInfo failed');
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function addAppInfoToConnectRequest(request) {
|
function addAppInfoToConnectRequest(request) {
|
||||||
request.headers = request.headers || {};
|
request.headers = request.headers || {};
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.1.79",
|
"version": "1.1.80",
|
||||||
"_release": "1.1.79",
|
"_release": "1.1.80",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.1.79",
|
"tag": "1.1.80",
|
||||||
"commit": "2b23575ee295d72e1e8c5d55949bf06cce0c8def"
|
"commit": "babf2d95fc689946e18922a8c9a782ad40d250fa"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
||||||
"_target": "~1.1.5",
|
"_target": "~1.1.5",
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
transition: opacity ease-out 0.2s;
|
transition: opacity ease-out 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paperDialog.opened + .dialogBackdrop {
|
.dialogBackdrop.opened {
|
||||||
opacity: .6;
|
opacity: .6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
||||||
removeBackdrop(dlg);
|
removeBackdrop(dlg);
|
||||||
|
dlg.classList.remove('opened');
|
||||||
|
|
||||||
if (removeScrollLockOnClose) {
|
if (removeScrollLockOnClose) {
|
||||||
document.body.classList.remove('noScroll');
|
document.body.classList.remove('noScroll');
|
||||||
|
@ -77,25 +78,20 @@
|
||||||
dlg.classList.remove('hide');
|
dlg.classList.remove('hide');
|
||||||
|
|
||||||
// Use native methods if available
|
// Use native methods if available
|
||||||
var hasManualBackdrop = false;
|
|
||||||
if (dlg.showModal) {
|
if (dlg.showModal) {
|
||||||
if (dlg.getAttribute('modal')) {
|
if (dlg.getAttribute('modal')) {
|
||||||
dlg.showModal();
|
dlg.showModal();
|
||||||
} else {
|
} else {
|
||||||
addBackdropOverlay(dlg);
|
addBackdropOverlay(dlg);
|
||||||
hasManualBackdrop = true;
|
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
// Undo the auto-focus applied by the native dialog element
|
// Undo the auto-focus applied by the native dialog element
|
||||||
safeBlur(document.activeElement);
|
safeBlur(document.activeElement);
|
||||||
} else {
|
} else {
|
||||||
addBackdropOverlay(dlg);
|
addBackdropOverlay(dlg);
|
||||||
hasManualBackdrop = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasManualBackdrop) {
|
dlg.classList.add('opened');
|
||||||
dlg.classList.add('opened');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (center) {
|
if (center) {
|
||||||
centerDialog(dlg);
|
centerDialog(dlg);
|
||||||
|
@ -135,7 +131,7 @@
|
||||||
|
|
||||||
// Doing this immediately causes the opacity to jump immediately without animating
|
// Doing this immediately causes the opacity to jump immediately without animating
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
dlg.classList.add('opened');
|
backdrop.classList.add('opened');
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
backdrop.addEventListener('click', function () {
|
backdrop.addEventListener('click', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue