From 792ec23d7a353939679f2c03c8669a04e879d263 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 15 Apr 2019 22:58:04 +0900 Subject: [PATCH 1/5] Use pureimage instead of canvas --- package.json | 2 +- src/misc/gen-avatar.ts | 11 ++++++----- src/server/index.ts | 8 +++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 7754832512..65067d068c 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,6 @@ "bootstrap-vue": "2.0.0-rc.13", "bull": "3.7.0", "cafy": "15.1.1", - "canvas": "2.4.1", "chai": "4.2.0", "chalk": "2.4.2", "cli-highlight": "2.1.0", @@ -189,6 +188,7 @@ "promise-sequential": "1.1.1", "pug": "2.0.3", "punycode": "2.1.1", + "pureimage": "0.1.6", "qrcode": "1.3.3", "random-seed": "0.3.0", "randomcolor": "0.5.4", diff --git a/src/misc/gen-avatar.ts b/src/misc/gen-avatar.ts index 7d22ee98e2..14c01a9bd9 100644 --- a/src/misc/gen-avatar.ts +++ b/src/misc/gen-avatar.ts @@ -2,10 +2,11 @@ * Random avatar generator */ -import { createCanvas } from 'canvas'; +const p = require('pureimage'); import * as gen from 'random-seed'; +import { WriteStream } from 'fs'; -const size = 512; // px +const size = 256; // px const n = 5; // resolution const margin = (size / n) / 1.5; const colors = [ @@ -35,9 +36,9 @@ const sideN = Math.floor(n / 2); /** * Generate buffer of random avatar by seed */ -export function genAvatar(seed: string) { +export function genAvatar(seed: string, stream: WriteStream): Promise { const rand = gen.create(seed); - const canvas = createCanvas(size, size); + const canvas = p.make(size, size); const ctx = canvas.getContext('2d'); ctx.fillStyle = bg; @@ -85,5 +86,5 @@ export function genAvatar(seed: string) { } } - return canvas.toBuffer(); + return p.encodePNGToStream(canvas, stream); } diff --git a/src/server/index.ts b/src/server/index.ts index 7d8938d584..b3ca47f232 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -26,6 +26,7 @@ import { program } from '../argv'; import { UserProfiles } from '../models'; import { networkChart } from '../services/chart'; import { genAvatar } from '../misc/gen-avatar'; +import { createTemp } from '../misc/create-temp'; export const serverLogger = new Logger('server', 'gray', false); @@ -73,10 +74,11 @@ router.use(activityPub.routes()); router.use(nodeinfo.routes()); router.use(wellKnown.routes()); -router.get('/avatar/:x', ctx => { - const avatar = genAvatar(ctx.params.x); +router.get('/avatar/:x', async ctx => { + const [temp] = await createTemp(); + await genAvatar(ctx.params.x, fs.createWriteStream(temp)); ctx.set('Content-Type', 'image/png'); - ctx.body = avatar; + ctx.body = fs.createReadStream(temp); }); router.get('/verify-email/:code', async ctx => { From 168c22fc9865256c3f49ed1e591da56fe8f88173 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 15 Apr 2019 23:00:39 +0900 Subject: [PATCH 2/5] Fix bug --- src/services/drive/add-file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index c79dfee103..cdb1a60092 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -212,7 +212,7 @@ async function deleteOldFile(user: IRemoteUser) { q.andWhere('file.id != :bannerId', { bannerId: user.bannerId }); } - q.orderBy('file.id', 'DESC'); + q.orderBy('file.id', 'ASC'); const oldFile = await q.getOne(); From 71df3e15660026ddfba775aeff35cf83715f72eb Mon Sep 17 00:00:00 2001 From: YuzuRyo61 Date: Mon, 15 Apr 2019 23:26:20 +0900 Subject: [PATCH 3/5] =?UTF-8?q?API=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AE=E8=AA=AC=E6=98=8E=E3=81=A8=E3=81=8B?= =?UTF-8?q?=E4=B8=80=E9=83=A8=E8=BF=BD=E8=A8=98=20(#4702)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Define description in generate.ts * Add description in create.ts --- src/server/api/endpoints/app/create.ts | 52 +++++++++++++++++-- .../api/endpoints/auth/session/generate.ts | 5 ++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts index ba366cdeb8..9db60d2661 100644 --- a/src/server/api/endpoints/app/create.ts +++ b/src/server/api/endpoints/app/create.ts @@ -9,25 +9,69 @@ export const meta = { tags: ['app'], requireCredential: false, + + desc: { + 'ja-JP': 'アプリを作成します。', + 'en-US': 'Create a application.' + }, params: { name: { - validator: $.str + validator: $.str, + desc: { + 'ja-JP': 'アプリの名前', + 'en-US': 'Name of application' + } }, description: { - validator: $.str + validator: $.str, + desc: { + 'ja-JP': 'アプリの説明', + 'en-US': 'Description of application' + } }, permission: { - validator: $.arr($.str).unique() + validator: $.arr($.str).unique(), + desc: { + 'ja-JP': 'このアプリに割り当てる権限(権限については"Permissions"を参照)', + 'en-US': 'Permissions assigned to this app (see "Permissions" for the permissions)' + } }, // TODO: Check it is valid url callbackUrl: { validator: $.optional.nullable.str, - default: null as any + default: null as any, + desc: { + 'ja-JP': 'アプリ認証時にコールバックするURL', + 'en-US': 'URL to call back at app authentication' + } }, + }, + + res: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'アプリケーションのID' + }, + name: { + type: 'string', + description: 'アプリケーションの名前' + }, + callbackUrl: { + type: 'string', + nullable: true, + description: 'コールバックするURL' + }, + secret: { + type: 'string', + description: 'アプリケーションのシークレットキー' + } + } } }; diff --git a/src/server/api/endpoints/auth/session/generate.ts b/src/server/api/endpoints/auth/session/generate.ts index 5a9bfe6451..bca8d33483 100644 --- a/src/server/api/endpoints/auth/session/generate.ts +++ b/src/server/api/endpoints/auth/session/generate.ts @@ -10,6 +10,11 @@ export const meta = { tags: ['auth'], requireCredential: false, + + desc: { + 'ja-JP': 'アプリを認証するためのトークンを作成します。', + 'en-US': 'Generate a token for authorize application.' + }, params: { appSecret: { From fc66231f8e00454c161cccaf660067d7b660d467 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 15 Apr 2019 23:29:26 +0900 Subject: [PATCH 4/5] Fix #4701 --- src/server/api/endpoints/users/notes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index da23be3c55..d3f17bd787 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -196,5 +196,5 @@ export default define(meta, async (ps, me) => { const timeline = await query.take(ps.limit!).getMany(); - return await Notes.packMany(timeline, user); + return await Notes.packMany(timeline, me); }); From 15de89f2f90cfd2c0bcb0d66a07ee69fe3a2bd34 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 15 Apr 2019 23:32:26 +0900 Subject: [PATCH 5/5] 11.1.2 --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd2cd6a0fc..01115d3d21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ If you encounter any problems with updating, please try the following: 1. `npm run clean` or `npm run cleanall` 2. Retry update (Don't forget `npm i`) +11.1.2 (2019/04/15) +------------------- +### Fixes +* 画像描画の依存関係を変更 +* リモートユーザーのファイルを削除するときに古い方からではなく新しい方から削除されるのを修正 +* リアクションしてないのにリアクションしたことになる問題を修正 +* APIドキュメントの修正 + 11.1.1 (2019/04/15) ------------------- ### Fixes diff --git a/package.json b/package.json index 65067d068c..05a89e33cd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "11.1.1", + "version": "11.1.2", "codename": "daybreak", "repository": { "type": "git",