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 = {
$('.helpTourDialogItem').each(function() {
const step = $(this).data('step');
console.error('step: %s (%s)', step);
$(this)
.parent()
.prev()
......
......@@ -540,20 +540,20 @@ PTL.feed = {
.addClass('folded');
}
if (feedIconHash) {
$favIcon.attr('src', '/favicons/' + feedIconHash + '.favicon');
} else {
await PTL.feed.fetchIcon(feedHost).then((iconhash) => {
if (iconhash) {
$favIcon.attr('src', '/favicons/' + iconhash + '.favicon');
$dataStore.data('iconhash', iconhash);
PTL.tab.saveTabs();
}
}).catch((error) => {
console.error('Fav: %s (%s)', error, feedUrl);
$favIcon.addClass('icon-rss');
});
}
// if (feedIconHash) {
// $favIcon.attr('src', '/favicons/' + feedIconHash + '.favicon');
// } else {
// await PTL.feed.fetchIcon(feedHost).then((iconhash) => {
// if (iconhash) {
// $favIcon.attr('src', '/favicons/' + iconhash + '.favicon');
// $dataStore.data('iconhash', iconhash);
// PTL.tab.saveTabs();
// }
// }).catch((error) => {
// console.log('Fav: %s (%s)', JSON.stringify(error), feedUrl);
// $favIcon.addClass('icon-rss');
// });
// }
if ($dataStore.data('status') == 'on') {
......@@ -607,7 +607,7 @@ PTL.feed = {
}
if (progress) progress.increment();
}
};
......@@ -31,20 +31,18 @@ router.get('/favicon', function(req, res) {
filePath = path.join(pjson.FAVICONS_CACHE_DIR, fileName);
fetch(url)
.then(
res =>
new Promise((resolve, reject) => {
const dest = fs.createWriteStream(filePath, {'Content-Type': 'image/x-icon'});
res.body.pipe(dest);
res.body.on("end", () => {
resolve({fileName, url});
});
dest.on("error", () => {
res.status(500).send(false);
reject('No favicon found');
});
})
);
.then(res => {
const dest = fs.createWriteStream(filePath, { 'Content-Type': 'image/x-icon' });
res.body.pipe(dest);
res.body.on("end", () => {
resolve();
res.send(hash);
});
dest.on("error", () => {
res.status(500).send(false);
reject('No favicon found');
});
});
} else {
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