Commit 93707d78 authored by yPhil's avatar yPhil
Browse files

#Favrat: DB Check for status headers

parent 680902c5
Pipeline #400777 passed with stage
in 1 minute and 12 seconds
This diff is collapsed.
......@@ -41,7 +41,6 @@
"node-fetch": "^2.6.1",
"npm": "^7.5.2",
"pm2": "^4.5.4",
"request": "^2.88.2",
"sanitize": "^2.1.0"
},
"devDependencies": {
......
......@@ -197,32 +197,17 @@ PTL.feed = {
feedTitle = feedUrl;
}
function addImageProcess(src){
return new Promise((resolve, reject) => {
let img = new Image();
img.onload = () => resolve(img.height);
img.onerror = reject;
img.src = src;
});
}
async function testImage(url) {
var tester=await new Image();
tester.onload=function(){
console.log('image loaded (%s)', url);
return true;
};
tester.onerror=function(){
console.log('image NOT loaded (%s)', url);
return false;
};
tester.src=url;
}
$feedLink.text(feedTitle)
.attr('href', feedUrl)
.attr('title', feedTitle + ' (' + feedUrl + ')');
const $myFeedIcon = $('<img>').attr({
class: 'favicon',
width: '16px',
height: '16px',
onerror: "this.onerror=null;this.src='/static/images/rss.png';"
});
$.get("/favicon", {
url: decodeURI(feedHost),
dataType: "json"
......@@ -230,26 +215,17 @@ PTL.feed = {
if (icon) {
const $myFeedIcon = $('<img>').attr({
class: 'favicon',
width: '24px',
height: '24px',
src: icon,
onerror: "this.onerror=null;this.src='/static/images/rss.png';"
});
$feedIcon
.removeClass('icon-rss icon-down')
.html($myFeedIcon);
.html($myFeedIcon.attr('src', icon))
.removeClass('icon-rss icon-down');
} else {
$feedIcon.addClass('icon-rss');
$feedToggle.css('background-image', 'none');
}
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log('ERROR: %s (%s)', feedUrl, textStatus, errorThrown);
$feedIcon.addClass('icon-rss');
$feedToggle.css('background-image', 'none');
});
if ($dataStore.data('status') == 'on') {
......@@ -282,8 +258,6 @@ PTL.feed = {
if (data.error || (data.feedItems && data.feedItems.length == 0)) {
console.log('data: %s (%s)', JSON.stringify(data));
var message = (data.message) ? data.message : PTL.tr('Unknown error');
var errno = (data.errno) ? data.errno : '0';
......@@ -344,12 +318,11 @@ PTL.feed = {
.append('&nbsp;')
.append($value);
$feedIcon.addClass('icon-rss');
$feedBodyUl
.append($errorItem);
// $feedIcon.addClass('icon-rss');
// $feedToggle.css('background-image', 'none');
$feedBody.css('height', '');
return;
......@@ -364,8 +337,6 @@ PTL.feed = {
if (index == 30) return false;
// console.log('i: (%s)', JSON.stringify(item));
var $description = $.parseHTML(item.description),
summary,
imageUrl,
......
......@@ -2,10 +2,9 @@ const express = require('express'),
router = express.Router(),
favrat = require('favrat'),
feeder = require('./feeder'),
request = require('request'),
fetch = require('node-fetch'),
// feedrat = require('feedrat'),
feedrat = require(__dirname + '/../../feedrat/'),
feedrat = require('feedrat'),
// feedrat = require(__dirname + '/../../feedrat/'),
fs = require('fs'),
path = require('path'),
crypto = require('crypto'),
......
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