update components

This commit is contained in:
Luke Pulverenti 2016-01-01 14:38:55 -05:00
parent 74d8bc3ef1
commit 2fe27c82da
7 changed files with 149 additions and 17 deletions

View File

@ -16,12 +16,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.0.20", "version": "1.0.21",
"_release": "1.0.20", "_release": "1.0.21",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.0.20", "tag": "1.0.21",
"commit": "55cf67710a438d3eea15f58587b2c2fcd731bf29" "commit": "e341b097c05c31ec012e04dfbd0455ae9dfc4929"
}, },
"_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",

View File

@ -422,7 +422,7 @@
afterConnected(apiClient, options); afterConnected(apiClient, options);
onLocalUserSignIn(result.User); onLocalUserSignIn(server, server.LastConnectionMode, result.User);
} }
function saveUserInfoIntoCredentials(server, user) { function saveUserInfoIntoCredentials(server, user) {
@ -452,7 +452,10 @@
} }
} }
function onLocalUserSignIn(user) { function onLocalUserSignIn(server, connectionMode, user) {
// Ensure this is created so that listeners of the event can get the apiClient instance
getOrAddApiClient(server, connectionMode);
Events.trigger(self, 'localusersignedin', [user]); Events.trigger(self, 'localusersignedin', [user]);
} }
@ -575,7 +578,7 @@
}).then(function (user) { }).then(function (user) {
onLocalUserSignIn(user); onLocalUserSignIn(server, connectionMode, user);
resolve(); resolve();
}, function () { }, function () {

View File

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.0.6", "version": "1.0.11",
"_release": "1.0.6", "_release": "1.0.11",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.0.6", "tag": "1.0.11",
"commit": "4d04f0ed205e94c00160c48dc131b9d8dbed995f" "commit": "8838a06a04887893b4a0e165764067409f4f3518"
}, },
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.0.0", "_target": "~1.0.0",

View File

@ -113,7 +113,7 @@
}); });
} }
if (browser.chrome) { if (canPlayMkv) {
profile.DirectPlayProfiles.push({ profile.DirectPlayProfiles.push({
Container: 'mkv,mov', Container: 'mkv,mov',
Type: 'Video', Type: 'Video',

View File

@ -0,0 +1,129 @@
define([], function () {
function getFetchPromise(request) {
var headers = request.headers || {};
if (request.dataType == 'json') {
headers.accept = 'application/json';
}
var fetchRequest = {
headers: headers,
method: request.type,
credentials: 'same-origin'
};
var contentType = request.contentType;
if (request.data) {
if (typeof request.data === 'string') {
fetchRequest.body = request.data;
} else {
fetchRequest.body = paramsToString(request.data);
contentType = contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
}
}
if (contentType) {
headers['Content-Type'] = contentType;
}
var url = request.url;
if (request.query) {
var paramString = paramsToString(request.query);
if (paramString) {
url += '?' + paramString;
}
}
if (!request.timeout) {
return fetch(url, fetchRequest);
}
return fetchWithTimeout(url, fetchRequest, request.timeout);
}
function fetchWithTimeout(url, options, timeoutMs) {
console.log('fetchWithTimeout: timeoutMs: ' + timeoutMs + ', url: ' + url);
return new Promise(function (resolve, reject) {
var timeout = setTimeout(reject, timeoutMs);
options = options || {};
options.credentials = 'same-origin';
fetch(url, options).then(function (response) {
clearTimeout(timeout);
console.log('fetchWithTimeout: succeeded connecting to url: ' + url);
resolve(response);
}, function (error) {
clearTimeout(timeout);
console.log('fetchWithTimeout: timed out connecting to url: ' + url);
reject();
});
});
}
function paramsToString(params) {
var values = [];
for (var key in params) {
var value = params[key];
if (value !== null && value !== undefined && value !== '') {
values.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
}
}
return values.join('&');
}
function ajax(request) {
if (!request) {
throw new Error("Request cannot be null");
}
request.headers = request.headers || {};
console.log('requesting url: ' + request.url);
return getFetchPromise(request).then(function (response) {
console.log('response status: ' + response.status + ', url: ' + request.url);
if (response.status < 400) {
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
return response.json();
} else {
return response;
}
} else {
return Promise.reject(response);
}
}, function (err) {
console.log('request failed to url: ' + request.url);
throw err;
});
}
return {
getFetchPromise: getFetchPromise,
ajax: ajax
};
});

View File

@ -36,7 +36,7 @@
"tag": "v1.0.8", "tag": "v1.0.8",
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff" "commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff"
}, },
"_source": "git://github.com/polymerelements/iron-selector.git", "_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-selector" "_originalSource": "PolymerElements/iron-selector"
} }

View File

@ -52,7 +52,7 @@
"tag": "v1.1.3", "tag": "v1.1.3",
"commit": "f070288446f9e78fbe16b032ddb429a8e8015ee7" "commit": "f070288446f9e78fbe16b032ddb429a8e8015ee7"
}, },
"_source": "git://github.com/polymerelements/paper-input.git", "_source": "git://github.com/PolymerElements/paper-input.git",
"_target": "^1.0.9", "_target": "^1.0.0",
"_originalSource": "polymerelements/paper-input" "_originalSource": "PolymerElements/paper-input"
} }