sharedInboxを提供

This commit is contained in:
syuilo 2018-04-23 15:37:27 +09:00
parent 02bb99ac02
commit 1131ce8a71
2 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@ export default user => {
id, id,
inbox: `${id}/inbox`, inbox: `${id}/inbox`,
outbox: `${id}/outbox`, outbox: `${id}/outbox`,
sharedInbox: `${config.url}/inbox`,
url: `${config.url}/@${user.username}`, url: `${config.url}/@${user.username}`,
preferredUsername: user.username, preferredUsername: user.username,
name: user.name, name: user.name,

View File

@ -1,4 +1,5 @@
import * as mongo from 'mongodb'; import * as mongo from 'mongodb';
import * as Koa from 'koa';
import * as Router from 'koa-router'; import * as Router from 'koa-router';
const json = require('koa-json-body'); const json = require('koa-json-body');
const httpSignature = require('http-signature'); const httpSignature = require('http-signature');
@ -19,8 +20,7 @@ const router = new Router();
//#region Routing //#region Routing
// inbox function inbox(ctx: Koa.Context) {
router.post('/users/:user/inbox', json(), ctx => {
let signature; let signature;
ctx.req.headers.authorization = 'Signature ' + ctx.req.headers.signature; ctx.req.headers.authorization = 'Signature ' + ctx.req.headers.signature;
@ -39,7 +39,11 @@ router.post('/users/:user/inbox', json(), ctx => {
}).save(); }).save();
ctx.status = 202; ctx.status = 202;
}); }
// inbox
router.post('/inbox', json(), inbox);
router.post('/users/:user/inbox', json(), inbox);
// note // note
router.get('/notes/:note', async (ctx, next) => { router.get('/notes/:note', async (ctx, next) => {