preparing multisite settings, fix #141

This commit is contained in:
lesion
2022-03-07 17:47:31 +01:00
parent bac0aa5b16
commit 4f3a34d356
9 changed files with 43 additions and 39 deletions

View File

@@ -8,10 +8,11 @@ module.exports = {
// follow request from fediverse
async follow (req, res) {
const body = req.body
const settings = res.locals.settings
if (typeof body.object !== 'string') { return }
const username = body.object.replace(`${config.baseurl}/federation/u/`, '')
if (username !== settingsController.settings.instance_name) {
log.warn(`Following the wrong user: ${username} instead of ${settingsController.settings.instance_name} (could be a wrong config.baseurl)`)
if (username !== settings.instance_name) {
log.warn(`Following the wrong user: ${username} instead of ${settings.instance_name} (could be a wrong config.baseurl)`)
return res.status(404).send('User not found')
}
@@ -35,10 +36,11 @@ module.exports = {
// unfollow request from fediverse
async unfollow (req, res) {
const settings = res.locals.settings
const body = req.body
const username = body.object.object.replace(`${config.baseurl}/federation/u/`, '')
if (username !== settingsController.settings.instance_name) {
log.warn(`Unfollowing wrong user: ${username} instead of ${settingsController.settings.instance_name}`)
if (username !== settings.instance_name) {
log.warn(`Unfollowing wrong user: ${username} instead of ${settings.instance_name}`)
return res.status(404).send('User not found')
}