change hard coded domain

This commit is contained in:
Peter Hormanns 2018-11-06 18:45:33 +01:00 committed by Darius Kazemi
parent b8992bd817
commit b26955dc3c
3 changed files with 9 additions and 6 deletions

View File

@ -46,6 +46,7 @@
<script>
// https://bots.tinysubversions.com/api/convert/?feed=https://toomuchnotenough.site/feed.xml&username=tmne
function submit() {
let domain = document.domain;
let feed = document.querySelector('#feed').value;
let username = document.querySelector('#username').value;
let out = document.querySelector('#out');
@ -64,7 +65,7 @@ fetch(`/api/convert/?feed=${feed}&username=${username}`)
// was it a match on feed
if (myJson.feed === feed) {
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}`;
}
// was it a match on username
@ -74,7 +75,7 @@ fetch(`/api/convert/?feed=${feed}&username=${username}`)
}
}
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>`;
}
})

View File

@ -57,7 +57,7 @@ router.post('/', function (req, res) {
let domain = req.app.get('domain');
const myURL = new URL(req.body.actor);
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) {
return console.log(err);
}

View File

@ -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 db = new Database('bot-node.db'),
Parser = require('rss-parser'),
@ -50,7 +52,7 @@ function doFeed() {
// 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 acct = feed.username;
let domain = 'bots.tinysubversions.com';
let domain = DOMAIN;
//console.log(acct, brandNewItems);
// 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) {
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 followers = JSON.parse(result.followers);
//console.log(followers);
// console.log(followers);
if (!followers) {
followers = [];
}