Buildout 3.57.1 (URI encoding, #708 and #711)

This commit is contained in:
James Barnsley
2021-03-23 20:29:31 +13:00
parent e6dac74c82
commit bdaba7c65f
11 changed files with 58 additions and 64 deletions

View File

@ -1 +1 @@
3.57.0
3.57.1

View File

@ -3,7 +3,7 @@ import pathlib
from mopidy import config, ext
__version__ = "3.57.0"
__version__ = "3.57.1"
logger = logging.getLogger(__name__)

View File

@ -162220,7 +162220,11 @@ var decodeUri = function decodeUri() {
uri = uri.replace(/&/g, '%26');
uri = uri.replace(/'/g, '%27');
uri = uri.replace(/,/g, '%2C');
uri = uri.replace(/ /g, '%20');
uri = uri.replace(/ /g, '%20'); // Re-encode any accented characters. Most Mopidy backends expect encoding of these.
uri = uri.replaceAll(/[À-ÖØ-öø-ÿ]/g, function (_char) {
return encodeURIComponent(_char);
});
return uri;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -106,8 +106,8 @@
// Release details
// These are automatically injected to built HTML
var build = "1616054097";
var version = "3.57.0";
var build = "1616484495";
var version = "3.57.1";
// Construct the script tag
var js = document.createElement("script");

View File

@ -1,5 +1,5 @@
{
"manifest_version": "3.57.0",
"manifest_version": "3.57.1",
"short_name": "Iris",
"name": "Iris",
"icons": [

View File

@ -1,4 +1,3 @@
const blacklist = [
'jamesbarnsley.co.nz',
'following/contains',
@ -9,55 +8,51 @@ const blacklist = [
'refresh_spotify_token'
];
function inBlacklist(url) {
for (let item of blacklist) {
if (url.indexOf(item) >= 0){
for (const item of blacklist) {
if (url.indexOf(item) >= 0) {
return true;
}
}
return false;
}
self.addEventListener('activate', function(event) {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.filter(cacheName => {
// Return true if you want to remove this cache,
// but remember that caches are shared across
// the whole origin
return true;
}).map(cacheName => {
return caches.delete(cacheName);
})
);
caches.keys().then((cacheNames) => {
return Promise.all(cacheNames.map((cacheName) => caches.delete(cacheName)));
})
);
});
self.addEventListener('fetch', event => {
self.addEventListener('fetch', (event) => {
const { request } = event;
event.respondWith(
// Opens Cache objects that start with 'font'.
caches.open('iris').then(cache => {
caches.open('iris').then((cache) => {
return cache.match(request)
.then(response => {
.then((response) => {
if (response) {
return response;
}
// Not cached, so we make the request, return that and also save response in cache
return fetch(request)
.then(liveResponse => {
.then((liveResponse) => {
const isBlacklisted = inBlacklist(request.url);
// Only cache successful GET requests
if (!isBlacklisted &&
request.method === 'GET' &&
liveResponse.status >= 200 &&
liveResponse.status < 400
if (
!isBlacklisted
&& request.method === 'GET'
&& liveResponse.status >= 200
&& liveResponse.status < 400
) {
// Fixes Edge browser "'chrome-extension' is unsupported" issue
// See https://stackoverflow.com/questions/49157622/service-worker-typeerror-when-opening-chrome-extension
if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
cache.put(request, liveResponse.clone());
} else {
console.info(`Not caching ${isBlacklisted ? '(blacklisted) ' : ''}${request.method} ${request.url}`);
@ -67,9 +62,9 @@ self.addEventListener('fetch', event => {
});
// Exceptions from match() or fetch()
}).catch(error => {
}).catch((error) => {
throw error;
});
})
}),
);
});

View File

@ -1,6 +1,6 @@
{
"name": "mopidy-iris",
"version": "3.57.0",
"version": "3.57.1",
"description": "Mopidy HTTP interface",
"repository": "https://github.com/jaedb/iris",
"author": "James Barnsley <james@barnsley.nz>",

View File

@ -1,6 +1,6 @@
[metadata]
name = Mopidy-Iris
version = 3.57.0
version = 3.57.1
url = https://github.com/jaedb/iris
author = James Barnsley
author_email = james@barnsley.nz

View File

@ -1,4 +1,3 @@
const blacklist = [
'jamesbarnsley.co.nz',
'following/contains',
@ -9,55 +8,51 @@ const blacklist = [
'refresh_spotify_token'
];
function inBlacklist(url) {
for (let item of blacklist) {
if (url.indexOf(item) >= 0){
for (const item of blacklist) {
if (url.indexOf(item) >= 0) {
return true;
}
}
return false;
}
self.addEventListener('activate', function(event) {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.filter(cacheName => {
// Return true if you want to remove this cache,
// but remember that caches are shared across
// the whole origin
return true;
}).map(cacheName => {
return caches.delete(cacheName);
})
);
caches.keys().then((cacheNames) => {
return Promise.all(cacheNames.map((cacheName) => caches.delete(cacheName)));
})
);
});
self.addEventListener('fetch', event => {
self.addEventListener('fetch', (event) => {
const { request } = event;
event.respondWith(
// Opens Cache objects that start with 'font'.
caches.open('iris').then(cache => {
caches.open('iris').then((cache) => {
return cache.match(request)
.then(response => {
.then((response) => {
if (response) {
return response;
}
// Not cached, so we make the request, return that and also save response in cache
return fetch(request)
.then(liveResponse => {
.then((liveResponse) => {
const isBlacklisted = inBlacklist(request.url);
// Only cache successful GET requests
if (!isBlacklisted &&
request.method === 'GET' &&
liveResponse.status >= 200 &&
liveResponse.status < 400
if (
!isBlacklisted
&& request.method === 'GET'
&& liveResponse.status >= 200
&& liveResponse.status < 400
) {
// Fixes Edge browser "'chrome-extension' is unsupported" issue
// See https://stackoverflow.com/questions/49157622/service-worker-typeerror-when-opening-chrome-extension
if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
cache.put(request, liveResponse.clone());
} else {
console.info(`Not caching ${isBlacklisted ? '(blacklisted) ' : ''}${request.method} ${request.url}`);
@ -67,9 +62,9 @@ self.addEventListener('fetch', event => {
});
// Exceptions from match() or fetch()
}).catch(error => {
}).catch((error) => {
throw error;
});
})
}),
);
});