[fedi] toot as admin only
This commit is contained in:
@@ -20,6 +20,6 @@
|
|||||||
"secure": true,
|
"secure": true,
|
||||||
"host": ""
|
"host": ""
|
||||||
},
|
},
|
||||||
"admin": "info@gancio.org",
|
"admin_email": "admin",
|
||||||
"secret": "notsosecret"
|
"secret": "notsosecret"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
small.float-right 🔖 {{event.likes.length}}
|
small.float-right 🔖 {{event.likes.length}}
|
||||||
small.float-right.mr-3 ✊ {{event.boost.length}}<br/>
|
small.float-right.mr-3 ✊ {{event.boost.length}}<br/>
|
||||||
strong {{$tc('common.comments', event.comments.length)}} -
|
strong {{$tc('common.comments', event.comments.length)}} -
|
||||||
<small>{{$t('event.interact_with_me_at')}} <u>{{event.user && event.user.username}}@{{settings.baseurl|url2host}}</u></small>
|
<small>{{$t('event.interact_with_me_at')}} <u>{{fedi_user}}@{{settings.baseurl|url2host}}</u></small>
|
||||||
|
|
||||||
.card-header(v-for='comment in event.comments' :key='comment.id')
|
.card-header(v-for='comment in event.comments' :key='comment.id')
|
||||||
a.float-right(:href='comment.data.url')
|
a.float-right(:href='comment.data.url')
|
||||||
@@ -133,6 +133,10 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['filteredEvents']),
|
...mapGetters(['filteredEvents']),
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
|
fedi_user () {
|
||||||
|
// TODO:
|
||||||
|
return this.settings.fedi_admin
|
||||||
|
},
|
||||||
next () {
|
next () {
|
||||||
let found = false
|
let found = false
|
||||||
const event = this.filteredEvents.find(e => {
|
const event = this.filteredEvents.find(e => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { setting: Setting } = require('../models')
|
const { setting: Setting, user: User } = require('../models')
|
||||||
const config = require('config')
|
const config = require('config')
|
||||||
const consola = require('consola')
|
const consola = require('consola')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@@ -26,6 +26,12 @@ const settingsController = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// set fediverse admin actor
|
||||||
|
const fedi_admin = await User.findOne({ where: { email: config.admin_email }})
|
||||||
|
if (fedi_admin) {
|
||||||
|
settingsController.settings['fedi_admin'] = fedi_admin.username
|
||||||
|
}
|
||||||
|
|
||||||
// // initialize user_locale
|
// // initialize user_locale
|
||||||
if (config.user_locale && fs.existsSync(path.resolve(config.user_locale))) {
|
if (config.user_locale && fs.existsSync(path.resolve(config.user_locale))) {
|
||||||
const user_locale = fs.readdirSync(path.resolve(config.user_locale))
|
const user_locale = fs.readdirSync(path.resolve(config.user_locale))
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
|
|
||||||
//
|
//
|
||||||
event.prototype.toAP = function (username, follower = []) {
|
event.prototype.toAP = function (username, follower = []) {
|
||||||
const tags = this.tags && this.tags.map(t => '#' + t.tag).join(' ')
|
const tags = this.tags && this.tags.map(t => `<a href='/tags/${t.tag}' class='mention hashtag' rel='tag'>#${t.tag}</a>`).join(' ')
|
||||||
|
|
||||||
const content = `<a href='${config.baseurl}/event/${this.id}'>${this.title}</a><br/>
|
const content = `<a href='${config.baseurl}/event/${this.id}'>${this.title}</a><br/>
|
||||||
📍${this.place.name}<br/>
|
📍${this.place.name}<br/>
|
||||||
⏰ ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}<br/><br/>
|
⏰ ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}<br/><br/>
|
||||||
@@ -57,13 +58,14 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'Note',
|
|
||||||
id: `${config.baseurl}/federation/m/${this.id}`,
|
id: `${config.baseurl}/federation/m/${this.id}`,
|
||||||
url: `${config.baseurl}/federation/m/${this.id}`,
|
url: `${config.baseurl}/federation/m/${this.id}`,
|
||||||
attachment,
|
type: 'Note',
|
||||||
|
// attachment,
|
||||||
tag: this.tags.map(tag => ({
|
tag: this.tags.map(tag => ({
|
||||||
type: 'Hashtag',
|
type: 'Hashtag',
|
||||||
name: '#' + tag.tag
|
name: '#' + tag.tag,
|
||||||
|
href: '/tags/' + tag.tag
|
||||||
})),
|
})),
|
||||||
published: this.createdAt,
|
published: this.createdAt,
|
||||||
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
||||||
@@ -72,7 +74,12 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
content,
|
content,
|
||||||
summary: null,
|
summary: null,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
// }
|
startTime: moment.unix(this.start_datetime),
|
||||||
|
location: {
|
||||||
|
type: 'Place',
|
||||||
|
name: this.place.name,
|
||||||
|
address: this.place.address
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,10 +85,15 @@ const Helpers = {
|
|||||||
// object: event.toAP(instanceAdmin.username, [`${config.baseurl}/federation/u/${instanceAdmin.username}/followers`, ...recipients[sharedInbox]])
|
// object: event.toAP(instanceAdmin.username, [`${config.baseurl}/federation/u/${instanceAdmin.username}/followers`, ...recipients[sharedInbox]])
|
||||||
object: event.toAP(instanceAdmin.username, recipients[sharedInbox])
|
object: event.toAP(instanceAdmin.username, recipients[sharedInbox])
|
||||||
}
|
}
|
||||||
body['@context'] = 'https://www.w3.org/ns/activitystreams'
|
body['@context'] = [
|
||||||
|
'https://www.w3.org/ns/activitystreams',
|
||||||
|
'https://w3id.org/security/v1',
|
||||||
|
{ Hashtag: 'as:Hashtag' } ]
|
||||||
Helpers.signAndSend(body, instanceAdmin, sharedInbox)
|
Helpers.signAndSend(body, instanceAdmin, sharedInbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
// TODO
|
||||||
// in case the event is published by the Admin itself do not add user
|
// in case the event is published by the Admin itself do not add user
|
||||||
if (instanceAdmin.id === user.id) {
|
if (instanceAdmin.id === user.id) {
|
||||||
debug('Event published by instance Admin')
|
debug('Event published by instance Admin')
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = {
|
|||||||
await db.user.create({
|
await db.user.create({
|
||||||
email: admin.email,
|
email: admin.email,
|
||||||
password: admin.password,
|
password: admin.password,
|
||||||
username: admin.email,
|
username: config.title.toLowerCase().replace(/ /g, ''),
|
||||||
display_name: config.title,
|
display_name: config.title,
|
||||||
is_admin: true,
|
is_admin: true,
|
||||||
is_active: true
|
is_active: true
|
||||||
|
|||||||
Reference in New Issue
Block a user