mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-25 10:39:20 +02:00
parent
18d64cd7be
commit
aa2fbcd409
|
@ -7,7 +7,7 @@
|
|||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
max-width: 900px;
|
||||
max-width: 800px;
|
||||
margin: 30px;
|
||||
}
|
||||
img {
|
||||
|
@ -53,14 +53,13 @@ let username = document.querySelector('#username').value;
|
|||
let out = document.querySelector('#out');
|
||||
fetch(`/api/convert/?feed=${feed}&username=${username}`)
|
||||
.then(function(response) {
|
||||
if (response.status !== 200) {
|
||||
out.innerHTML = `<p>Error: ${JSON.stringify(response.statusText)}</p>`;
|
||||
return {};
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(function(myJson) {
|
||||
console.log((myJson));
|
||||
if (myJson.err) {
|
||||
out.innerHTML = `<p>Error: ${myJson.err}</p>`;
|
||||
return {};
|
||||
}
|
||||
// a feed exists in the database
|
||||
if (myJson.content) {
|
||||
// was it a match on feed
|
||||
|
|
|
@ -29,6 +29,9 @@ router.get('/convert', function (req, res) {
|
|||
let parser = new Parser();
|
||||
parser.parseURL(feed, function(err, feedData) {
|
||||
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});
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue