mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-25 10:39:20 +02:00
change hard coded domain
This commit is contained in:
parent
b8992bd817
commit
b26955dc3c
|
@ -46,6 +46,7 @@
|
||||||
<script>
|
<script>
|
||||||
// https://bots.tinysubversions.com/api/convert/?feed=https://toomuchnotenough.site/feed.xml&username=tmne
|
// https://bots.tinysubversions.com/api/convert/?feed=https://toomuchnotenough.site/feed.xml&username=tmne
|
||||||
function submit() {
|
function submit() {
|
||||||
|
let domain = document.domain;
|
||||||
let feed = document.querySelector('#feed').value;
|
let feed = document.querySelector('#feed').value;
|
||||||
let username = document.querySelector('#username').value;
|
let username = document.querySelector('#username').value;
|
||||||
let out = document.querySelector('#out');
|
let out = document.querySelector('#out');
|
||||||
|
@ -64,7 +65,7 @@ fetch(`/api/convert/?feed=${feed}&username=${username}`)
|
||||||
// was it a match on feed
|
// was it a match on feed
|
||||||
if (myJson.feed === feed) {
|
if (myJson.feed === feed) {
|
||||||
console.log('feed match!');
|
console.log('feed match!');
|
||||||
out.innerHTML = `<p>This feed already exists! Follow @${myJson.username}@bots.tinysubversions.com.</p>`;
|
out.innerHTML = `<p>This feed already exists! Follow @${myJson.username}@${domain}.</p>`;
|
||||||
window.location = `/u/${myJson.username}`;
|
window.location = `/u/${myJson.username}`;
|
||||||
}
|
}
|
||||||
// was it a match on username
|
// was it a match on username
|
||||||
|
@ -74,7 +75,7 @@ fetch(`/api/convert/?feed=${feed}&username=${username}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (myJson.title) {
|
else if (myJson.title) {
|
||||||
out.innerHTML = `<p>Okay! There is now an ActivityPub actor for ${myJson.title}. You should be able to search for it from your ActivityPub client (Mastodon, Pleroma, etc) using this identifier: @${username}@bots.tinysubversions.com. You won't see anything there until the next time the RSS feed updates. You can check out the profile page for this feed at <a href="https://bots.tinysubversions.com/u/${username}/">https://bots.tinysubversions.com/u/${username}</a> too!</p>`;
|
out.innerHTML = `<p>Okay! There is now an ActivityPub actor for ${myJson.title}. You should be able to search for it from your ActivityPub client (Mastodon, Pleroma, etc) using this identifier: @${username}@${domain}. You won't see anything there until the next time the RSS feed updates. You can check out the profile page for this feed at <a href="https://${domain}/u/${username}/">https://${domain}/u/${username}</a> too!</p>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -57,7 +57,7 @@ router.post('/', function (req, res) {
|
||||||
let domain = req.app.get('domain');
|
let domain = req.app.get('domain');
|
||||||
const myURL = new URL(req.body.actor);
|
const myURL = new URL(req.body.actor);
|
||||||
let targetDomain = myURL.hostname;
|
let targetDomain = myURL.hostname;
|
||||||
fs.appendFile('/home/dariusk/bot-node/inbox.log', JSON.stringify(req.body)+'\r\n', function (err) {
|
fs.appendFile('./inbox.log', JSON.stringify(req.body)+'\r\n', function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const config = require('./config.json');
|
||||||
|
const { DOMAIN, PRIVKEY_PATH, CERT_PATH, PORT_HTTP, PORT_HTTPS } = config;
|
||||||
const Database = require('better-sqlite3');
|
const Database = require('better-sqlite3');
|
||||||
const db = new Database('bot-node.db'),
|
const db = new Database('bot-node.db'),
|
||||||
Parser = require('rss-parser'),
|
Parser = require('rss-parser'),
|
||||||
|
@ -50,7 +52,7 @@ function doFeed() {
|
||||||
// get a list of new items in the diff
|
// get a list of new items in the diff
|
||||||
let brandNewItems = newItems.filter(el => difference.includes(el.guid) || difference.includes(el.title) || difference.includes(el.description));
|
let brandNewItems = newItems.filter(el => difference.includes(el.guid) || difference.includes(el.title) || difference.includes(el.description));
|
||||||
let acct = feed.username;
|
let acct = feed.username;
|
||||||
let domain = 'bots.tinysubversions.com';
|
let domain = DOMAIN;
|
||||||
//console.log(acct, brandNewItems);
|
//console.log(acct, brandNewItems);
|
||||||
|
|
||||||
// send the message to everyone for each item!
|
// send the message to everyone for each item!
|
||||||
|
@ -197,10 +199,10 @@ function createMessage(text, name, domain, item) {
|
||||||
|
|
||||||
function sendCreateMessage(text, name, domain, req, res, item) {
|
function sendCreateMessage(text, name, domain, req, res, item) {
|
||||||
let message = createMessage(text, name, domain, item);
|
let message = createMessage(text, name, domain, item);
|
||||||
|
// console.log(`${name}@${domain}`);
|
||||||
let result = db.prepare('select followers from accounts where name = ?').get(`${name}@${domain}`);
|
let result = db.prepare('select followers from accounts where name = ?').get(`${name}@${domain}`);
|
||||||
let followers = JSON.parse(result.followers);
|
let followers = JSON.parse(result.followers);
|
||||||
//console.log(followers);
|
// console.log(followers);
|
||||||
if (!followers) {
|
if (!followers) {
|
||||||
followers = [];
|
followers = [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue