summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-03-16 09:54:40 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-03-16 09:54:40 +0900
commit556e2eba958416860dfed3765025edd85f959b7f (patch)
treeec93428ad26393ae3767fb093e9072c67875b6e7 /src/server
parentUpdate CONTRIBUTING.md (diff)
downloadmisskey-556e2eba958416860dfed3765025edd85f959b7f.tar.gz
misskey-556e2eba958416860dfed3765025edd85f959b7f.tar.bz2
misskey-556e2eba958416860dfed3765025edd85f959b7f.zip
Resolve #1727 (#4512)
Diffstat (limited to 'src/server')
-rw-r--r--src/server/activitypub.ts13
-rw-r--r--src/server/web/views/note.pug2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts
index 2151ada344..df5f5b141d 100644
--- a/src/server/activitypub.ts
+++ b/src/server/activitypub.ts
@@ -17,6 +17,7 @@ import Following from './activitypub/following';
import Featured from './activitypub/featured';
import renderQuestion from '../remote/activitypub/renderer/question';
import { inbox as processInbox } from '../queue';
+import { isSelfHost } from '../misc/convert-host';
// Init router
const router = new Router();
@@ -79,6 +80,16 @@ router.get('/notes/:note', async (ctx, next) => {
return;
}
+ // リモートだったらリダイレクト
+ if (note._user.host != null) {
+ if (note.uri == null || isSelfHost(note._user.host)) {
+ ctx.status = 500;
+ return;
+ }
+ ctx.redirect(note.uri);
+ return;
+ }
+
ctx.body = renderActivity(await renderNote(note, false));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
@@ -93,6 +104,7 @@ router.get('/notes/:note/activity', async ctx => {
const note = await Note.findOne({
_id: new ObjectID(ctx.params.note),
+ '_user.host': null,
visibility: { $in: ['public', 'home'] },
localOnly: { $ne: true }
});
@@ -116,6 +128,7 @@ router.get('/questions/:question', async (ctx, next) => {
const poll = await Note.findOne({
_id: new ObjectID(ctx.params.question),
+ '_user.host': null,
visibility: { $in: ['public', 'home'] },
localOnly: { $ne: true },
poll: {
diff --git a/src/server/web/views/note.pug b/src/server/web/views/note.pug
index 782a32a504..875d67e2f6 100644
--- a/src/server/web/views/note.pug
+++ b/src/server/web/views/note.pug
@@ -31,3 +31,5 @@ block meta
if !user.host
link(rel='alternate' href=url type='application/activity+json')
+ if note.uri
+ link(rel='alternate' href=note.uri type='application/activity+json')