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": {},
|
||||
"ignore": [],
|
||||
"version": "1.0.45",
|
||||
"_release": "1.0.45",
|
||||
"version": "1.0.47",
|
||||
"_release": "1.0.47",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.0.45",
|
||||
"commit": "b49575b7ace02784d060db167c17e92deec3512e"
|
||||
"tag": "1.0.47",
|
||||
"commit": "e54fbdbdc56bd99a253adc96fd8847b67225b79a"
|
||||
},
|
||||
"_source": "git://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
|
||||
"_target": "~1.0.3",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['events', 'apiclient'], function (Events, apiClientFactory) {
|
||||
define(['events', 'apiclient', 'appStorage'], function (Events, apiClientFactory, appStorage) {
|
||||
|
||||
var ConnectionState = {
|
||||
Unavailable: 0,
|
||||
|
@ -1497,29 +1497,82 @@
|
|||
|
||||
self.getRegistrationInfo = function (feature, apiClient) {
|
||||
|
||||
if (isConnectUserSupporter()) {
|
||||
return Promise.resolve({
|
||||
Name: feature,
|
||||
IsRegistered: true,
|
||||
IsTrial: false
|
||||
var params = {
|
||||
serverId: apiClient.serverInfo().Id,
|
||||
deviceId: self.deviceId(),
|
||||
deviceName: deviceName,
|
||||
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);
|
||||
};
|
||||
|
||||
function isConnectUserSupporter() {
|
||||
|
||||
if (self.isLoggedIntoConnect()) {
|
||||
|
||||
var connectUser = self.connectUser();
|
||||
|
||||
if (connectUser && connectUser.IsSupporter) {
|
||||
return true;
|
||||
}
|
||||
if (!updateDevicePromise) {
|
||||
updateDevicePromise = Promise.resolve();
|
||||
}
|
||||
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) {
|
||||
request.headers = request.headers || {};
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.1.79",
|
||||
"_release": "1.1.79",
|
||||
"version": "1.1.80",
|
||||
"_release": "1.1.80",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.1.79",
|
||||
"commit": "2b23575ee295d72e1e8c5d55949bf06cce0c8def"
|
||||
"tag": "1.1.80",
|
||||
"commit": "babf2d95fc689946e18922a8c9a782ad40d250fa"
|
||||
},
|
||||
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "~1.1.5",
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
transition: opacity ease-out 0.2s;
|
||||
}
|
||||
|
||||
.paperDialog.opened + .dialogBackdrop {
|
||||
.dialogBackdrop.opened {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
function onDialogClosed() {
|
||||
|
||||
removeBackdrop(dlg);
|
||||
dlg.classList.remove('opened');
|
||||
|
||||
if (removeScrollLockOnClose) {
|
||||
document.body.classList.remove('noScroll');
|
||||
|
@ -77,25 +78,20 @@
|
|||
dlg.classList.remove('hide');
|
||||
|
||||
// Use native methods if available
|
||||
var hasManualBackdrop = false;
|
||||
if (dlg.showModal) {
|
||||
if (dlg.getAttribute('modal')) {
|
||||
dlg.showModal();
|
||||
} else {
|
||||
addBackdropOverlay(dlg);
|
||||
hasManualBackdrop = true;
|
||||
dlg.show();
|
||||
}
|
||||
// Undo the auto-focus applied by the native dialog element
|
||||
safeBlur(document.activeElement);
|
||||
} else {
|
||||
addBackdropOverlay(dlg);
|
||||
hasManualBackdrop = true;
|
||||
}
|
||||
|
||||
if (!hasManualBackdrop) {
|
||||
dlg.classList.add('opened');
|
||||
}
|
||||
dlg.classList.add('opened');
|
||||
|
||||
if (center) {
|
||||
centerDialog(dlg);
|
||||
|
@ -135,7 +131,7 @@
|
|||
|
||||
// Doing this immediately causes the opacity to jump immediately without animating
|
||||
setTimeout(function () {
|
||||
dlg.classList.add('opened');
|
||||
backdrop.classList.add('opened');
|
||||
}, 0);
|
||||
|
||||
backdrop.addEventListener('click', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue