mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-22 09:19:19 +02:00
parent
18d64cd7be
commit
aa2fbcd409
|
@ -7,7 +7,7 @@
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
max-width: 900px;
|
max-width: 800px;
|
||||||
margin: 30px;
|
margin: 30px;
|
||||||
}
|
}
|
||||||
img {
|
img {
|
||||||
|
@ -53,14 +53,13 @@ let username = document.querySelector('#username').value;
|
||||||
let out = document.querySelector('#out');
|
let out = document.querySelector('#out');
|
||||||
fetch(`/api/convert/?feed=${feed}&username=${username}`)
|
fetch(`/api/convert/?feed=${feed}&username=${username}`)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
if (response.status !== 200) {
|
|
||||||
out.innerHTML = `<p>Error: ${JSON.stringify(response.statusText)}</p>`;
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(function(myJson) {
|
.then(function(myJson) {
|
||||||
console.log((myJson));
|
if (myJson.err) {
|
||||||
|
out.innerHTML = `<p>Error: ${myJson.err}</p>`;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
// a feed exists in the database
|
// a feed exists in the database
|
||||||
if (myJson.content) {
|
if (myJson.content) {
|
||||||
// was it a match on feed
|
// was it a match on feed
|
||||||
|
|
|
@ -29,6 +29,9 @@ router.get('/convert', function (req, res) {
|
||||||
let parser = new Parser();
|
let parser = new Parser();
|
||||||
parser.parseURL(feed, function(err, feedData) {
|
parser.parseURL(feed, function(err, feedData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (err.message === 'Status code 400') {
|
||||||
|
err.message = `That doesn't look like a valid RSS feed. Check <a href="${feed}">the URL you provided</a> in a feed validator. You can <a href="https://validator.w3.org/feed/check.cgi?url=${feed}" target="_blank">click here</a> to pop up a test immediately.`
|
||||||
|
}
|
||||||
res.status(400).json({err: err.message});
|
res.status(400).json({err: err.message});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue