use only supported continents

This commit is contained in:
Niko Storni 2020-03-12 23:15:13 +01:00
parent 7afaeb8333
commit 6d12e0da06

View file

@ -12,7 +12,7 @@ function generateStreamUrl(claimName, claimId, apiUrl) {
prefix = prefix.replace('//', '//' + continent + '.');
} else {
Lbryio.call('locale', 'get', {}, 'post').then(result => {
const userContinent = result.continent;
const userContinent = getSupportedCDN(result.continent);
setCookie(CONTINENT_COOKIE, userContinent, 1);
});
}
@ -20,6 +20,16 @@ function generateStreamUrl(claimName, claimId, apiUrl) {
return `${prefix}/content/claims/${claimName}/${claimId}/stream`;
}
function getSupportedCDN(continent) {
switch (continent) {
case 'NA':
case 'EU':
return continent;
default:
return 'NA';
}
}
function generateEmbedUrl(claimName, claimId) {
return `${URL}/$/embed/${claimName}/${claimId}`;
}