From 23296aaf0f70cc82733c23af88239a3842cf3d4b Mon Sep 17 00:00:00 2001 From: Joe Crawford Date: Wed, 29 May 2024 17:25:29 -0700 Subject: [PATCH 1/2] Addresses #33 - thisvictorianlife.com is http only - no valid SSL cert under https --- feed.xml | 6 +++--- generate.js | 7 +++++-- http-sites.json | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 http-sites.json diff --git a/feed.xml b/feed.xml index eb0b39a..ef07bc6 100644 --- a/feed.xml +++ b/feed.xml @@ -652,9 +652,9 @@ <![CDATA[thisvictorianlife.com]]> - https://thisvictorianlife.com - https://thisvictorianlife.com - Thu, 30 May 2024 00:00:00 GMT + http://thisvictorianlife.com + http://thisvictorianlife.com + Thu, 30 May 2024 00:00:01 GMT \ No newline at end of file diff --git a/generate.js b/generate.js index d7415c6..923741e 100644 --- a/generate.js +++ b/generate.js @@ -2,6 +2,7 @@ const fs = require('fs'); const sites = require('./sites.json'); const dates = require('./dates.json'); +const httpSites = require('./http-sites.json'); const today = new Date().toISOString().split('T')[0]; const numberOfSites = sites.blogs.length; const maxNumberOfDates = numberOfSites * 2; @@ -73,10 +74,11 @@ sites.blogs.forEach(site => { // log whether the site has a description const hasDescriptionKey = sites.descriptions.hasOwnProperty(site); const hasDescription = sites.descriptions[site] && sites.descriptions[site].length > 0; + const protocol = httpSites.includes(site) ? 'http://' : 'https://'; if (!hasDescriptionKey) { console.log(`Fetching description for ${site}.`); - fetch(`https://${site}`) + fetch(`${protocol}${site}`) .then(res => res.text()) .then(html => { const $ = cheerio.load(html); @@ -105,10 +107,11 @@ Object.keys(dates.dates).forEach(date => { const site = dates.dates[date]; const sites = require('./sites.json'); const description = sites.descriptions[site] || ''; + const protocol = httpSites.includes(site) ? 'http://' : 'https://'; feed.item({ title: site, description: description, - url: `https://${site}`, + url: `${protocol}${site}`, date: date }); }); diff --git a/http-sites.json b/http-sites.json new file mode 100644 index 0000000..ce04978 --- /dev/null +++ b/http-sites.json @@ -0,0 +1,5 @@ +{ + "blogs": [ + "thisvictorianlife.com" + ] +} \ No newline at end of file From 1c080e28e335791a80d37fba94d95a8616c5b871 Mon Sep 17 00:00:00 2001 From: Joe Crawford Date: Wed, 29 May 2024 17:28:27 -0700 Subject: [PATCH 2/2] #13 fix for http sites. change name to match existing json --- generate.js | 4 ++-- http-sites.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generate.js b/generate.js index 923741e..ac575c4 100644 --- a/generate.js +++ b/generate.js @@ -74,7 +74,7 @@ sites.blogs.forEach(site => { // log whether the site has a description const hasDescriptionKey = sites.descriptions.hasOwnProperty(site); const hasDescription = sites.descriptions[site] && sites.descriptions[site].length > 0; - const protocol = httpSites.includes(site) ? 'http://' : 'https://'; + const protocol = httpSites.sites.includes(site) ? 'http://' : 'https://'; if (!hasDescriptionKey) { console.log(`Fetching description for ${site}.`); @@ -107,7 +107,7 @@ Object.keys(dates.dates).forEach(date => { const site = dates.dates[date]; const sites = require('./sites.json'); const description = sites.descriptions[site] || ''; - const protocol = httpSites.includes(site) ? 'http://' : 'https://'; + const protocol = httpSites.sites.include(site) ? 'http://' : 'https://'; feed.item({ title: site, description: description, diff --git a/http-sites.json b/http-sites.json index ce04978..8b28e2d 100644 --- a/http-sites.json +++ b/http-sites.json @@ -1,5 +1,5 @@ { - "blogs": [ + "sites": [ "thisvictorianlife.com" ] } \ No newline at end of file