Commit ece61177 authored by yPhil's avatar yPhil
Browse files

HUGE PB w/ Favicons

- Emergency disable
parent 08d0cb89
Pipeline #418147 passed with stage
in 44 seconds
...@@ -388,7 +388,6 @@ PTL.dialog = { ...@@ -388,7 +388,6 @@ PTL.dialog = {
$('.helpTourDialogItem').each(function() { $('.helpTourDialogItem').each(function() {
const step = $(this).data('step'); const step = $(this).data('step');
console.error('step: %s (%s)', step);
$(this) $(this)
.parent() .parent()
.prev() .prev()
......
...@@ -540,20 +540,20 @@ PTL.feed = { ...@@ -540,20 +540,20 @@ PTL.feed = {
.addClass('folded'); .addClass('folded');
} }
if (feedIconHash) { // if (feedIconHash) {
$favIcon.attr('src', '/favicons/' + feedIconHash + '.favicon'); // $favIcon.attr('src', '/favicons/' + feedIconHash + '.favicon');
} else { // } else {
await PTL.feed.fetchIcon(feedHost).then((iconhash) => { // await PTL.feed.fetchIcon(feedHost).then((iconhash) => {
if (iconhash) { // if (iconhash) {
$favIcon.attr('src', '/favicons/' + iconhash + '.favicon'); // $favIcon.attr('src', '/favicons/' + iconhash + '.favicon');
$dataStore.data('iconhash', iconhash); // $dataStore.data('iconhash', iconhash);
PTL.tab.saveTabs(); // PTL.tab.saveTabs();
} // }
}).catch((error) => { // }).catch((error) => {
console.error('Fav: %s (%s)', error, feedUrl); // console.log('Fav: %s (%s)', JSON.stringify(error), feedUrl);
$favIcon.addClass('icon-rss'); // $favIcon.addClass('icon-rss');
}); // });
} // }
if ($dataStore.data('status') == 'on') { if ($dataStore.data('status') == 'on') {
...@@ -607,7 +607,7 @@ PTL.feed = { ...@@ -607,7 +607,7 @@ PTL.feed = {
} }
if (progress) progress.increment(); if (progress) progress.increment();
} }
}; };
...@@ -31,20 +31,18 @@ router.get('/favicon', function(req, res) { ...@@ -31,20 +31,18 @@ router.get('/favicon', function(req, res) {
filePath = path.join(pjson.FAVICONS_CACHE_DIR, fileName); filePath = path.join(pjson.FAVICONS_CACHE_DIR, fileName);
fetch(url) fetch(url)
.then( .then(res => {
res => const dest = fs.createWriteStream(filePath, { 'Content-Type': 'image/x-icon' });
new Promise((resolve, reject) => { res.body.pipe(dest);
const dest = fs.createWriteStream(filePath, {'Content-Type': 'image/x-icon'}); res.body.on("end", () => {
res.body.pipe(dest); resolve();
res.body.on("end", () => { res.send(hash);
resolve({fileName, url}); });
}); dest.on("error", () => {
dest.on("error", () => { res.status(500).send(false);
res.status(500).send(false); reject('No favicon found');
reject('No favicon found'); });
}); });
})
);
} else { } else {
reject('Not a valid URL'); reject('Not a valid URL');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment