mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
experimenting with AP
This commit is contained in:
parent
076390ba2f
commit
cb88720bd3
3 changed files with 15 additions and 10 deletions
|
@ -122,6 +122,7 @@
|
||||||
"tag_description": "Etichetta",
|
"tag_description": "Etichetta",
|
||||||
"media_description": "Puoi aggiungere un volantino (opzionale)",
|
"media_description": "Puoi aggiungere un volantino (opzionale)",
|
||||||
"added": "Evento aggiunto",
|
"added": "Evento aggiunto",
|
||||||
|
"saved": "Evento salvato",
|
||||||
"added_anon": "Evento aggiunto, verrà confermato quanto prima.",
|
"added_anon": "Evento aggiunto, verrà confermato quanto prima.",
|
||||||
"updated": "Evento aggiornato",
|
"updated": "Evento aggiornato",
|
||||||
"where_description": "Dov'è il gancio? Se il posto non è presente potrai crearlo. ",
|
"where_description": "Dov'è il gancio? Se il posto non è presente potrai crearlo. ",
|
||||||
|
|
|
@ -12,6 +12,10 @@ const Place = require('./place')
|
||||||
const User = require('./user')
|
const User = require('./user')
|
||||||
const Tag = require('./tag')
|
const Tag = require('./tag')
|
||||||
|
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
class Event extends Model {}
|
class Event extends Model {}
|
||||||
|
|
||||||
Event.init({
|
Event.init({
|
||||||
|
@ -59,7 +63,7 @@ Event.belongsTo(Event, { as: 'parent' })
|
||||||
|
|
||||||
Event.prototype.toAPNote = function (username, locale, to = []) {
|
Event.prototype.toAPNote = function (username, locale, to = []) {
|
||||||
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
|
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
|
||||||
const plainDescription = htmlToText.fromString(this.description.replace('\n', '').slice(0, 1000))
|
const plainDescription = htmlToText.fromString(this.description && this.description.replace('\n', '').slice(0, 1000))
|
||||||
const content = `
|
const content = `
|
||||||
${this.title}<br/><br/>
|
${this.title}<br/><br/>
|
||||||
📍 ${this.place && this.place.name}<br/>
|
📍 ${this.place && this.place.name}<br/>
|
||||||
|
@ -94,16 +98,17 @@ Event.prototype.toAPNote = function (username, locale, to = []) {
|
||||||
// name: this.place && this.place.name
|
// name: this.place && this.place.name
|
||||||
// },
|
// },
|
||||||
// attachment,
|
// attachment,
|
||||||
tag: tags && tags.map(tag => ({
|
// tag: tags && tags.map(tag => ({
|
||||||
type: 'Hashtag',
|
// type: 'Hashtag',
|
||||||
name: '#' + tag,
|
// name: '#' + tag,
|
||||||
href: '/tags/' + tag
|
// href: '/tags/' + tag
|
||||||
})),
|
// })),
|
||||||
published: this.createdAt,
|
published: dayjs(this.createdAt).utc().format(),
|
||||||
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
||||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||||
// cc: [`${config.baseurl}/federation/u/${username}/followers`],
|
cc: [`${config.baseurl}/federation/u/${username}/followers`],
|
||||||
content
|
content,
|
||||||
|
summary: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const path = require('path')
|
|
||||||
const config = require('config')
|
const config = require('config')
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const cors = require('cors')
|
const cors = require('cors')
|
||||||
|
|
Loading…
Reference in a new issue