From 653ec0cbb0cb1a14d0f48b4d10b91007e8876be8 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Thu, 22 Nov 2018 23:17:58 +0900 Subject: [PATCH 1/5] No cache /notes/:note (#3382) --- src/server/activitypub.ts | 2 +- src/server/web/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 888feb08c..0d4e24485 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -76,7 +76,7 @@ router.get('/notes/:note', async (ctx, next) => { } ctx.body = pack(await renderNote(note, false)); - ctx.set('Cache-Control', 'public, max-age=180'); + ctx.set('Cache-Control', 'private, max-age=0, must-revalidate'); setResponseType(ctx); }); diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 616aaa36b..42292cd39 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -111,7 +111,7 @@ router.get('/notes/:note', async ctx => { note: _note, summary: getNoteSummary(_note) }); - ctx.set('Cache-Control', 'public, max-age=180'); + ctx.set('Cache-Control', 'private, max-age=0, must-revalidate'); } else { ctx.status = 404; } From 2a0b62d26dd253779c0e02933259cf3fe35c5c99 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 22 Nov 2018 18:09:04 +0100 Subject: [PATCH 2/5] Fix #3343 (#3383) Setting "X-Forwarded-Proto: https" in the SSL proxy is the correct way to do this --- src/server/api/common/signin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/api/common/signin.ts b/src/server/api/common/signin.ts index 8d44b377f..3a5ba0ea0 100644 --- a/src/server/api/common/signin.ts +++ b/src/server/api/common/signin.ts @@ -9,8 +9,8 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { path: '/', domain: config.hostname, // SEE: https://github.com/koajs/koa/issues/974 - //secure: config.url.startsWith('https'), - secure: false, + // When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header + secure: config.url.startsWith('https'), httpOnly: false, expires: new Date(Date.now() + expires), maxAge: expires From 336b45b6f7c9a2174655e4c28c7944c7905768c7 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 23 Nov 2018 02:10:07 +0900 Subject: [PATCH 3/5] AP quote (#3384) --- src/remote/activitypub/models/note.ts | 9 ++++++++- src/remote/activitypub/renderer/note.ts | 13 +++++++++++++ src/remote/activitypub/type.ts | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 48a02e79b..c6bdd072a 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -96,6 +96,13 @@ export async function createNote(value: any, resolver?: Resolver, silent = false // リプライ const reply = note.inReplyTo ? await resolveNote(note.inReplyTo, resolver) : null; + // 引用 + let quote: INote; + + if (note._misskey_quote && typeof note._misskey_quote == 'string') { + quote = await resolveNote(note._misskey_quote).catch(() => null); + } + // テキストのパース const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content); @@ -112,7 +119,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false createdAt: new Date(note.published), files: files, reply, - renote: undefined, + renote: quote, cw: note.summary, text: text, viaMobile: false, diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index d6e2d612c..a854ad9f1 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -42,6 +42,18 @@ export default async function renderNote(note: INote, dive = true): Promise inReplyTo = null; } + let quote; + + if (note.renoteId) { + const renote = await Note.findOne({ + _id: note.renoteId, + }); + + if (renote) { + quote = renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`; + } + } + const user = await User.findOne({ _id: note.userId }); @@ -112,6 +124,7 @@ export default async function renderNote(note: INote, dive = true): Promise summary: note.cw, content, _misskey_content: text, + _misskey_quote: quote, published: note.createdAt.toISOString(), to, cc, diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts index 234403501..530aaa13d 100644 --- a/src/remote/activitypub/type.ts +++ b/src/remote/activitypub/type.ts @@ -41,6 +41,7 @@ export interface IOrderedCollection extends IObject { export interface INote extends IObject { type: 'Note'; _misskey_content: string; + _misskey_quote: string; } export interface IPerson extends IObject { From 6878f73a9fc6343a4f9693a04bc0fca791226a6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 23 Nov 2018 05:23:05 +0900 Subject: [PATCH 4/5] Update ws requirement from 6.1.0 to 6.1.2 (#3385) Updates the requirements on [ws](https://github.com/websockets/ws) to permit the latest version. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/commits/6.1.2) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e263ea25..806ac2f7f 100644 --- a/package.json +++ b/package.json @@ -237,7 +237,7 @@ "webpack": "4.26.0", "webpack-cli": "3.1.2", "websocket": "1.0.28", - "ws": "6.1.0", + "ws": "6.1.2", "xev": "2.0.1" } } From 214f7f06bb4141f38472de75e3217fa44e8d4638 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 23 Nov 2018 06:06:03 +0900 Subject: [PATCH 5/5] Update koa requirement from 2.6.1 to 2.6.2 (#3386) Updates the requirements on [koa](https://github.com/koajs/koa) to permit the latest version. - [Release notes](https://github.com/koajs/koa/releases) - [Changelog](https://github.com/koajs/koa/blob/master/History.md) - [Commits](https://github.com/koajs/koa/commits/2.6.2) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 806ac2f7f..767de2559 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "json5": "2.1.0", "json5-loader": "1.0.1", "katex": "0.10.0", - "koa": "2.6.1", + "koa": "2.6.2", "koa-bodyparser": "4.2.1", "koa-compress": "3.0.0", "koa-favicon": "2.0.1",