Merge pull request #249 from Human-Connection/another-fix-of-activity-pub-implementation

Another fix of activity pub implementation
This commit is contained in:
Robert Schäfer 2019-03-26 09:17:35 +01:00 committed by GitHub
commit 58938dc2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 78 additions and 73 deletions

View File

@ -4,7 +4,7 @@
"description": "GraphQL Backend for Human Connection", "description": "GraphQL Backend for Human Connection",
"main": "src/index.js", "main": "src/index.js",
"config": { "config": {
"no_auth": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 PERMISSIONS=disabled" "no_auth": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 DISABLED_MIDDLEWARES=permissions"
}, },
"scripts": { "scripts": {
"build": "babel src/ -d dist/ --copy-files", "build": "babel src/ -d dist/ --copy-files",
@ -15,7 +15,7 @@
"test": "nyc --reporter=text-lcov yarn test:jest", "test": "nyc --reporter=text-lcov yarn test:jest",
"test:cypress": "run-p --race test:before:*", "test:cypress": "run-p --race test:before:*",
"test:before:server": "cross-env CLIENT_URI=http://localhost:4123 GRAPHQL_URI=http://localhost:4123 GRAPHQL_PORT=4123 babel-node src/ 2> /dev/null", "test:before:server": "cross-env CLIENT_URI=http://localhost:4123 GRAPHQL_URI=http://localhost:4123 GRAPHQL_PORT=4123 babel-node src/ 2> /dev/null",
"test:before:seeder": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 PERMISSIONS=disabled babel-node src/ 2> /dev/null", "test:before:seeder": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 DISABLED_MIDDLEWARES=permissions,activityPub babel-node src/ 2> /dev/null",
"test:jest:cmd": "wait-on tcp:4001 tcp:4123 && jest --forceExit --detectOpenHandles --runInBand", "test:jest:cmd": "wait-on tcp:4001 tcp:4123 && jest --forceExit --detectOpenHandles --runInBand",
"test:cucumber:cmd": "wait-on tcp:4001 tcp:4123 && cucumber-js --require-module @babel/register --exit test/", "test:cucumber:cmd": "wait-on tcp:4001 tcp:4123 && cucumber-js --require-module @babel/register --exit test/",
"test:jest:cmd:debug": "wait-on tcp:4001 tcp:4123 && node --inspect-brk ./node_modules/.bin/jest -i --forceExit --detectOpenHandles --runInBand", "test:jest:cmd:debug": "wait-on tcp:4001 tcp:4123 && node --inspect-brk ./node_modules/.bin/jest -i --forceExit --detectOpenHandles --runInBand",

View File

@ -22,21 +22,19 @@ let activityPub = null
export { activityPub } export { activityPub }
export default class ActivityPub { export default class ActivityPub {
constructor (host, uri) { constructor (activityPubEndpointUri, internalGraphQlUri) {
this.host = host this.endpoint = activityPubEndpointUri
this.dataSource = new NitroDataSource(uri) this.dataSource = new NitroDataSource(internalGraphQlUri)
this.collections = new Collections(this.dataSource) this.collections = new Collections(this.dataSource)
} }
static init (server) { static init (server) {
if (!activityPub) { if (!activityPub) {
dotenv.config() dotenv.config()
const url = new URL(process.env.CLIENT_URI) activityPub = new ActivityPub(process.env.CLIENT_URI || 'http://localhost:3000', process.env.GRAPHQL_URI || 'http://localhost:4000')
activityPub = new ActivityPub(url.host || 'localhost:4000', url.origin)
// integrate into running graphql express server // integrate into running graphql express server
server.express.set('ap', activityPub) server.express.set('ap', activityPub)
server.express.set('port', url.port)
server.express.use(router) server.express.use(router)
console.log('-> ActivityPub middleware added to the graphql express server') console.log('-> ActivityPub middleware added to the graphql express server')
} else { } else {

View File

@ -12,15 +12,20 @@ router.get('/', async function (req, res) {
const nameAndDomain = resource.replace('acct:', '') const nameAndDomain = resource.replace('acct:', '')
const name = nameAndDomain.split('@')[0] const name = nameAndDomain.split('@')[0]
const result = await req.app.get('ap').dataSource.client.query({ let result
query: gql` try {
result = await req.app.get('ap').dataSource.client.query({
query: gql`
query { query {
User(slug: "${name}") { User(slug: "${name}") {
slug slug
} }
} }
` `
}) })
} catch (error) {
return res.status(500).json({ error })
}
if (result.data && result.data.User.length > 0) { if (result.data && result.data.User.length > 0) {
const webFinger = createWebFinger(name) const webFinger = createWebFinger(name)

View File

@ -11,14 +11,14 @@ export function createNoteObject (text, name, id, published) {
return { return {
'@context': 'https://www.w3.org/ns/activitystreams', '@context': 'https://www.w3.org/ns/activitystreams',
'id': `https://${activityPub.host}/activitypub/users/${name}/status/${createUuid}`, 'id': `${activityPub.endpoint}/activitypub/users/${name}/status/${createUuid}`,
'type': 'Create', 'type': 'Create',
'actor': `https://${activityPub.host}/activitypub/users/${name}`, 'actor': `${activityPub.endpoint}/activitypub/users/${name}`,
'object': { 'object': {
'id': `https://${activityPub.host}/activitypub/users/${name}/status/${id}`, 'id': `${activityPub.endpoint}/activitypub/users/${name}/status/${id}`,
'type': 'Note', 'type': 'Note',
'published': published, 'published': published,
'attributedTo': `https://${activityPub.host}/activitypub/users/${name}`, 'attributedTo': `${activityPub.endpoint}/activitypub/users/${name}`,
'content': text, 'content': text,
'to': 'https://www.w3.org/ns/activitystreams#Public' 'to': 'https://www.w3.org/ns/activitystreams#Public'
} }
@ -64,8 +64,8 @@ export async function getActorId (name) {
export function sendAcceptActivity (theBody, name, targetDomain, url) { export function sendAcceptActivity (theBody, name, targetDomain, url) {
as.accept() as.accept()
.id(`https://${activityPub.host}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex')) .id(`${activityPub.endpoint}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex'))
.actor(`https://${activityPub.host}/activitypub/users/${name}`) .actor(`${activityPub.endpoint}/activitypub/users/${name}`)
.object(theBody) .object(theBody)
.prettyWrite((err, doc) => { .prettyWrite((err, doc) => {
if (!err) { if (!err) {
@ -79,8 +79,8 @@ export function sendAcceptActivity (theBody, name, targetDomain, url) {
export function sendRejectActivity (theBody, name, targetDomain, url) { export function sendRejectActivity (theBody, name, targetDomain, url) {
as.reject() as.reject()
.id(`https://${activityPub.host}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex')) .id(`${activityPub.endpoint}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex'))
.actor(`https://${activityPub.host}/activitypub/users/${name}`) .actor(`${activityPub.endpoint}/activitypub/users/${name}`)
.object(theBody) .object(theBody)
.prettyWrite((err, doc) => { .prettyWrite((err, doc) => {
if (!err) { if (!err) {

View File

@ -6,34 +6,35 @@ export function createActor (name, pubkey) {
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1' 'https://w3id.org/security/v1'
], ],
'id': `https://${activityPub.host}/activitypub/users/${name}`, 'id': `${activityPub.endpoint}/activitypub/users/${name}`,
'type': 'Person', 'type': 'Person',
'preferredUsername': `${name}`, 'preferredUsername': `${name}`,
'name': `${name}`, 'name': `${name}`,
'following': `https://${activityPub.host}/activitypub/users/${name}/following`, 'following': `${activityPub.endpoint}/activitypub/users/${name}/following`,
'followers': `https://${activityPub.host}/activitypub/users/${name}/followers`, 'followers': `${activityPub.endpoint}/activitypub/users/${name}/followers`,
'inbox': `https://${activityPub.host}/activitypub/users/${name}/inbox`, 'inbox': `${activityPub.endpoint}/activitypub/users/${name}/inbox`,
'outbox': `https://${activityPub.host}/activitypub/users/${name}/outbox`, 'outbox': `${activityPub.endpoint}/activitypub/users/${name}/outbox`,
'url': `https://${activityPub.host}/activitypub/@${name}`, 'url': `${activityPub.endpoint}/activitypub/@${name}`,
'endpoints': { 'endpoints': {
'sharedInbox': `https://${activityPub.host}/activitypub/inbox` 'sharedInbox': `${activityPub.endpoint}/activitypub/inbox`
}, },
'publicKey': { 'publicKey': {
'id': `https://${activityPub.host}/activitypub/users/${name}#main-key`, 'id': `${activityPub.endpoint}/activitypub/users/${name}#main-key`,
'owner': `https://${activityPub.host}/activitypub/users/${name}`, 'owner': `${activityPub.endpoint}/activitypub/users/${name}`,
'publicKeyPem': pubkey 'publicKeyPem': pubkey
} }
} }
} }
export function createWebFinger (name) { export function createWebFinger (name) {
const { host } = new URL(activityPub.endpoint)
return { return {
'subject': `acct:${name}@${activityPub.host}`, 'subject': `acct:${name}@${host}`,
'links': [ 'links': [
{ {
'rel': 'self', 'rel': 'self',
'type': 'application/activity+json', 'type': 'application/activity+json',
'href': `https://${activityPub.host}/activitypub/users/${name}` 'href': `${activityPub.endpoint}/activitypub/users/${name}`
} }
] ]
} }

View File

@ -5,10 +5,10 @@ const debug = require('debug')('ea:utils:collections')
export function createOrderedCollection (name, collectionName) { export function createOrderedCollection (name, collectionName) {
return { return {
'@context': 'https://www.w3.org/ns/activitystreams', '@context': 'https://www.w3.org/ns/activitystreams',
'id': `https://${activityPub.host}/activitypub/users/${name}/${collectionName}`, 'id': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
'summary': `${name}s ${collectionName} collection`, 'summary': `${name}s ${collectionName} collection`,
'type': 'OrderedCollection', 'type': 'OrderedCollection',
'first': `https://${activityPub.host}/activitypub/users/${name}/${collectionName}?page=true`, 'first': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
'totalItems': 0 'totalItems': 0
} }
} }
@ -16,11 +16,11 @@ export function createOrderedCollection (name, collectionName) {
export function createOrderedCollectionPage (name, collectionName) { export function createOrderedCollectionPage (name, collectionName) {
return { return {
'@context': 'https://www.w3.org/ns/activitystreams', '@context': 'https://www.w3.org/ns/activitystreams',
'id': `https://${activityPub.host}/activitypub/users/${name}/${collectionName}?page=true`, 'id': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
'summary': `${name}s ${collectionName} collection`, 'summary': `${name}s ${collectionName} collection`,
'type': 'OrderedCollectionPage', 'type': 'OrderedCollectionPage',
'totalItems': 0, 'totalItems': 0,
'partOf': `https://${activityPub.host}/activitypub/users/${name}/${collectionName}`, 'partOf': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
'orderedItems': [] 'orderedItems': []
} }
} }

View File

@ -20,8 +20,8 @@ export function extractIdFromActivityId (uri) {
return splitted[splitted.indexOf('status') + 1] return splitted[splitted.indexOf('status') + 1]
} }
export function constructIdFromName (name, fromDomain = activityPub.host) { export function constructIdFromName (name, fromDomain = activityPub.endpoint) {
return `http://${fromDomain}/activitypub/users/${name}` return `${fromDomain}/activitypub/users/${name}`
} }
export function extractDomainFromUrl (url) { export function extractDomainFromUrl (url) {
@ -76,7 +76,7 @@ export function signAndSend (activity, fromName, targetDomain, url) {
'Host': targetDomain, 'Host': targetDomain,
'Date': date, 'Date': date,
'Signature': createSignature({ privateKey, 'Signature': createSignature({ privateKey,
keyId: `http://${activityPub.host}/activitypub/users/${fromName}#main-key`, keyId: `${activityPub.endpoint}/activitypub/users/${fromName}#main-key`,
url, url,
headers: { headers: {
'Host': targetDomain, 'Host': targetDomain,

View File

@ -27,9 +27,11 @@ export default schema => {
// add permisions middleware at the first position (unless we're seeding) // add permisions middleware at the first position (unless we're seeding)
// NOTE: DO NOT SET THE PERMISSION FLAT YOUR SELF // NOTE: DO NOT SET THE PERMISSION FLAT YOUR SELF
if (process.env.PERMISSIONS !== 'disabled' && process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
middleware.unshift(activityPubMiddleware) const DISABLED_MIDDLEWARES = process.env.DISABLED_MIDDLEWARES || ''
middleware.unshift(permissionsMiddleware.generate(schema)) const disabled = DISABLED_MIDDLEWARES.split(',')
if (!disabled.includes('activityPub')) middleware.unshift(activityPubMiddleware)
if (!disabled.includes('permissions')) middleware.unshift(permissionsMiddleware.generate(schema))
} }
return middleware return middleware
} }

View File

@ -29,7 +29,7 @@ Feature: Delete an object
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/karl-heinz/status/a4DJ2afdg323v32641vna42lkj685kasd2", "id": "http://localhost:4123/activitypub/users/karl-heinz/status/a4DJ2afdg323v32641vna42lkj685kasd2",
"type": "Delete", "type": "Delete",
"object": { "object": {
"id": "https://aronda.org/activitypub/users/bernd-das-brot/status/kljsdfg9843jknsdf234", "id": "https://aronda.org/activitypub/users/bernd-das-brot/status/kljsdfg9843jknsdf234",

View File

@ -15,7 +15,7 @@ Feature: Follow a user
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/stuart-little/status/83J23549sda1k72fsa4567na42312455kad83", "id": "http://localhost:4123/activitypub/users/stuart-little/status/83J23549sda1k72fsa4567na42312455kad83",
"type": "Follow", "type": "Follow",
"actor": "http://localhost:4123/activitypub/users/stuart-little", "actor": "http://localhost:4123/activitypub/users/stuart-little",
"object": "http://localhost:4123/activitypub/users/tero-vota" "object": "http://localhost:4123/activitypub/users/tero-vota"
@ -32,11 +32,11 @@ Feature: Follow a user
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/tero-vota/status/a4DJ2afdg323v32641vna42lkj685kasd2", "id": "http://localhost:4123/activitypub/users/tero-vota/status/a4DJ2afdg323v32641vna42lkj685kasd2",
"type": "Undo", "type": "Undo",
"actor": "http://localhost:4123/activitypub/users/tero-vota", "actor": "http://localhost:4123/activitypub/users/tero-vota",
"object": { "object": {
"id": "https://localhost:4123/activitypub/users/stuart-little/status/83J23549sda1k72fsa4567na42312455kad83", "id": "http://localhost:4123/activitypub/users/stuart-little/status/83J23549sda1k72fsa4567na42312455kad83",
"type": "Follow", "type": "Follow",
"actor": "http://localhost:4123/activitypub/users/stuart-little", "actor": "http://localhost:4123/activitypub/users/stuart-little",
"object": "http://localhost:4123/activitypub/users/tero-vota" "object": "http://localhost:4123/activitypub/users/tero-vota"

View File

@ -13,14 +13,14 @@ Feature: Like an object like an article or note
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/karl-heinz/status/faslkasa7dasfzkjn2398hsfd", "id": "http://localhost:4123/activitypub/users/karl-heinz/status/faslkasa7dasfzkjn2398hsfd",
"type": "Create", "type": "Create",
"actor": "https://localhost:4123/activitypub/users/karl-heinz", "actor": "http://localhost:4123/activitypub/users/karl-heinz",
"object": { "object": {
"id": "https://localhost:4123/activitypub/users/karl-heinz/status/dkasfljsdfaafg9843jknsdf", "id": "http://localhost:4123/activitypub/users/karl-heinz/status/dkasfljsdfaafg9843jknsdf",
"type": "Article", "type": "Article",
"published": "2019-02-07T19:37:55.002Z", "published": "2019-02-07T19:37:55.002Z",
"attributedTo": "https://localhost:4123/activitypub/users/karl-heinz", "attributedTo": "http://localhost:4123/activitypub/users/karl-heinz",
"content": "Hi Max, how are you?", "content": "Hi Max, how are you?",
"to": "https://www.w3.org/ns/activitystreams#Public" "to": "https://www.w3.org/ns/activitystreams#Public"
} }
@ -32,7 +32,7 @@ Feature: Like an object like an article or note
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/peter-lustiger/status/83J23549sda1k72fsa4567na42312455kad83", "id": "http://localhost:4123/activitypub/users/peter-lustiger/status/83J23549sda1k72fsa4567na42312455kad83",
"type": "Like", "type": "Like",
"actor": "http://localhost:4123/activitypub/users/peter-lustiger", "actor": "http://localhost:4123/activitypub/users/peter-lustiger",
"object": "http://localhost:4123/activitypub/users/karl-heinz/status/dkasfljsdfaafg9843jknsdf" "object": "http://localhost:4123/activitypub/users/karl-heinz/status/dkasfljsdfaafg9843jknsdf"

View File

@ -14,10 +14,10 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/outbox", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/outbox",
"summary": "renate-oberdorfers outbox collection", "summary": "renate-oberdorfers outbox collection",
"type": "OrderedCollection", "type": "OrderedCollection",
"first": "https://localhost:4123/activitypub/users/renate-oberdorfer/outbox?page=true", "first": "http://localhost:4123/activitypub/users/renate-oberdorfer/outbox?page=true",
"totalItems": 0 "totalItems": 0
} }
""" """
@ -29,10 +29,10 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/following", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/following",
"summary": "renate-oberdorfers following collection", "summary": "renate-oberdorfers following collection",
"type": "OrderedCollection", "type": "OrderedCollection",
"first": "https://localhost:4123/activitypub/users/renate-oberdorfer/following?page=true", "first": "http://localhost:4123/activitypub/users/renate-oberdorfer/following?page=true",
"totalItems": 0 "totalItems": 0
} }
""" """
@ -44,10 +44,10 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/followers", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/followers",
"summary": "renate-oberdorfers followers collection", "summary": "renate-oberdorfers followers collection",
"type": "OrderedCollection", "type": "OrderedCollection",
"first": "https://localhost:4123/activitypub/users/renate-oberdorfer/followers?page=true", "first": "http://localhost:4123/activitypub/users/renate-oberdorfer/followers?page=true",
"totalItems": 0 "totalItems": 0
} }
""" """
@ -59,11 +59,11 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/outbox?page=true", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/outbox?page=true",
"summary": "renate-oberdorfers outbox collection", "summary": "renate-oberdorfers outbox collection",
"type": "OrderedCollectionPage", "type": "OrderedCollectionPage",
"totalItems": 0, "totalItems": 0,
"partOf": "https://localhost:4123/activitypub/users/renate-oberdorfer/outbox", "partOf": "http://localhost:4123/activitypub/users/renate-oberdorfer/outbox",
"orderedItems": [] "orderedItems": []
} }
""" """
@ -75,11 +75,11 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/following?page=true", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/following?page=true",
"summary": "renate-oberdorfers following collection", "summary": "renate-oberdorfers following collection",
"type": "OrderedCollectionPage", "type": "OrderedCollectionPage",
"totalItems": 0, "totalItems": 0,
"partOf": "https://localhost:4123/activitypub/users/renate-oberdorfer/following", "partOf": "http://localhost:4123/activitypub/users/renate-oberdorfer/following",
"orderedItems": [] "orderedItems": []
} }
""" """
@ -91,11 +91,11 @@ Feature: Receiving collections
""" """
{ {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
"id": "https://localhost:4123/activitypub/users/renate-oberdorfer/followers?page=true", "id": "http://localhost:4123/activitypub/users/renate-oberdorfer/followers?page=true",
"summary": "renate-oberdorfers followers collection", "summary": "renate-oberdorfers followers collection",
"type": "OrderedCollectionPage", "type": "OrderedCollectionPage",
"totalItems": 0, "totalItems": 0,
"partOf": "https://localhost:4123/activitypub/users/renate-oberdorfer/followers", "partOf": "http://localhost:4123/activitypub/users/renate-oberdorfer/followers",
"orderedItems": [] "orderedItems": []
} }
""" """

View File

@ -4,7 +4,7 @@ Feature: Webfinger discovery
In order to follow the actor In order to follow the actor
Background: Background:
Given our own server runs at "http://localhost:4100" Given our own server runs at "http://localhost:4123"
And we have the following users in our database: And we have the following users in our database:
| Slug | | Slug |
| peter-lustiger | | peter-lustiger |
@ -19,7 +19,7 @@ Feature: Webfinger discovery
{ {
"rel": "self", "rel": "self",
"type": "application/activity+json", "type": "application/activity+json",
"href": "https://localhost:4123/activitypub/users/peter-lustiger" "href": "http://localhost:4123/activitypub/users/peter-lustiger"
} }
] ]
} }
@ -44,21 +44,21 @@ Feature: Webfinger discovery
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1" "https://w3id.org/security/v1"
], ],
"id": "https://localhost:4123/activitypub/users/peter-lustiger", "id": "http://localhost:4123/activitypub/users/peter-lustiger",
"type": "Person", "type": "Person",
"preferredUsername": "peter-lustiger", "preferredUsername": "peter-lustiger",
"name": "peter-lustiger", "name": "peter-lustiger",
"following": "https://localhost:4123/activitypub/users/peter-lustiger/following", "following": "http://localhost:4123/activitypub/users/peter-lustiger/following",
"followers": "https://localhost:4123/activitypub/users/peter-lustiger/followers", "followers": "http://localhost:4123/activitypub/users/peter-lustiger/followers",
"inbox": "https://localhost:4123/activitypub/users/peter-lustiger/inbox", "inbox": "http://localhost:4123/activitypub/users/peter-lustiger/inbox",
"outbox": "https://localhost:4123/activitypub/users/peter-lustiger/outbox", "outbox": "http://localhost:4123/activitypub/users/peter-lustiger/outbox",
"url": "https://localhost:4123/activitypub/@peter-lustiger", "url": "http://localhost:4123/activitypub/@peter-lustiger",
"endpoints": { "endpoints": {
"sharedInbox": "https://localhost:4123/activitypub/inbox" "sharedInbox": "http://localhost:4123/activitypub/inbox"
}, },
"publicKey": { "publicKey": {
"id": "https://localhost:4123/activitypub/users/peter-lustiger#main-key", "id": "http://localhost:4123/activitypub/users/peter-lustiger#main-key",
"owner": "https://localhost:4123/activitypub/users/peter-lustiger", "owner": "http://localhost:4123/activitypub/users/peter-lustiger",
"publicKeyPem": "adglkjlk89235kjn8obn2384f89z5bv9..." "publicKeyPem": "adglkjlk89235kjn8obn2384f89z5bv9..."
} }
} }

View File

@ -133,7 +133,6 @@ module.exports = {
'/activitypub': { '/activitypub': {
// make this configurable (nuxt-dotenv) // make this configurable (nuxt-dotenv)
target: process.env.GRAPHQL_URI || 'http://localhost:4000', target: process.env.GRAPHQL_URI || 'http://localhost:4000',
pathRewrite: { '^/activitypub': '' },
toProxy: true, // cloudflare needs that toProxy: true, // cloudflare needs that
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',