Refactor ap_id to apID + improve method using apex.domain
This commit is contained in:
parent
5d9e931c6f
commit
ebaa58cb82
|
@ -55,7 +55,7 @@ module.exports = {
|
|||
return res.status(403).json({ error: 'email_already_exists' })
|
||||
|
||||
// TODO: when implementing email confirmation, move this actor creation when confirmed
|
||||
var actor = await apex.store.getObject(ap_id(req.body.username))
|
||||
var actor = await apex.store.getObject(apID(req.body.username))
|
||||
if (actor === null)
|
||||
actor = await apex.createActor(req.body.username, req.body.username, '', null)
|
||||
|
||||
|
|
|
@ -21,10 +21,8 @@ const routes = {
|
|||
shares: '/s/:id/shares',
|
||||
likes: '/s/:id/likes'
|
||||
}
|
||||
global.ap_id = (username) => {
|
||||
return `https://${process.env.DOMAIN}` +
|
||||
routes.actor.replace(':actor', username)
|
||||
}
|
||||
global.apID = (username) => { return `https://${apex.domain}`+
|
||||
routes.actor.replace(':actor', username) }
|
||||
global.db = require('./db.js')
|
||||
global.apex = ActivitypubExpress({
|
||||
name: 'FediLove ActivityPub API',
|
||||
|
@ -70,7 +68,6 @@ app.route(api.url('/auth/register')).post(api.auth.register.post)
|
|||
app.route(api.url('/auth/login')).post(api.auth.login.post)
|
||||
app.route(api.url('/feed/meet')).get(api.feed.meet.get)
|
||||
|
||||
|
||||
// initialize
|
||||
client.connect({ useNewUrlParser: true })
|
||||
.then(() => {
|
||||
|
@ -78,7 +75,7 @@ client.connect({ useNewUrlParser: true })
|
|||
return apex.store.setup()
|
||||
})
|
||||
.then(async () => {
|
||||
const sysActor = await apex.store.getObject(ap_id('fedilove'), true)
|
||||
const sysActor = await apex.store.getObject(apID('fedilove'), true)
|
||||
if (sysActor === null) {
|
||||
apex.createActor('fedilove', 'FediLove', '', null, 'Service')
|
||||
.then(async (actor) => {
|
||||
|
|
Loading…
Reference in New Issue