From df950d2fc535e5d793cfc4d9f0f09a145ab47a57 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 15 Apr 2019 23:37:35 +0900 Subject: [PATCH 1/7] Clean up --- src/server/api/endpoints/notes/create.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index 83649015d..994dfb4dc 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -238,8 +238,6 @@ export default define(meta, async (ps, user, app) => { userId: user.id }) ))).filter(file => file != null) as DriveFile[]; - - files = files; } let renote: Note | undefined; From f44dc2dd0599d0a6e3661b77527d1cafaecacacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=B2=E3=82=8F=E3=81=974=EF=BC=88=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B31=EF=BC=89?= Date: Mon, 15 Apr 2019 23:39:09 +0900 Subject: [PATCH 2/7] Doc: Add "Init DB" section (#4695) Misskey 11.x requires database initialization. --- docs/docker.en.md | 8 +++++++- docs/docker.ja.md | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/docker.en.md b/docs/docker.en.md index 1b607f9ea..344279083 100644 --- a/docs/docker.en.md +++ b/docs/docker.en.md @@ -57,7 +57,13 @@ Build misskey with the following: `docker-compose build` -*5.* That is it. +*5.* Init DB +---------------------------------------------------------------- +``` shell +docker-compose run --rm web npm run init +``` + +*6.* That is it. ---------------------------------------------------------------- Well done! Now you have an environment to run Misskey. diff --git a/docs/docker.ja.md b/docs/docker.ja.md index ecc75fef2..9d702fa79 100644 --- a/docs/docker.ja.md +++ b/docs/docker.ja.md @@ -57,7 +57,13 @@ cp docker_example.env docker.env `docker-compose build` -*5.* 以上です! +*5.* データベースを初期化 +---------------------------------------------------------------- +``` shell +docker-compose run --rm web npm run init +``` + +*6.* 以上です! ---------------------------------------------------------------- お疲れ様でした。これでMisskeyを動かす準備は整いました。 From bce8c5a315330e6500faae37f559a5d114df69d3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Apr 2019 01:05:21 +0900 Subject: [PATCH 3/7] Refactor --- src/server/api/common/generate-native-user-token.ts | 2 +- src/server/api/common/is-native-token.ts | 2 +- src/server/api/endpoints/auth/accept.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/api/common/generate-native-user-token.ts b/src/server/api/common/generate-native-user-token.ts index 9d4488563..a372221a0 100644 --- a/src/server/api/common/generate-native-user-token.ts +++ b/src/server/api/common/generate-native-user-token.ts @@ -1,3 +1,3 @@ import rndstr from 'rndstr'; -export default () => `0${rndstr('a-zA-Z0-9', 15)}`; +export default () => rndstr('a-zA-Z0-9', 16); diff --git a/src/server/api/common/is-native-token.ts b/src/server/api/common/is-native-token.ts index 22af84aad..2833c570c 100644 --- a/src/server/api/common/is-native-token.ts +++ b/src/server/api/common/is-native-token.ts @@ -1 +1 @@ -export default (token: string) => token.startsWith('0'); +export default (token: string) => token.length === 16; diff --git a/src/server/api/endpoints/auth/accept.ts b/src/server/api/endpoints/auth/accept.ts index a584e7267..be7f3b546 100644 --- a/src/server/api/endpoints/auth/accept.ts +++ b/src/server/api/endpoints/auth/accept.ts @@ -39,7 +39,7 @@ export default define(meta, async (ps, user) => { } // Generate access token - const accessToken = '1' + rndstr('a-zA-Z0-9', 15); + const accessToken = rndstr('a-zA-Z0-9', 32); // Fetch exist access token const exist = await AccessTokens.findOne({ From 400cdf0f269fc3b035b897e10323371d4c79c751 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Apr 2019 01:11:20 +0900 Subject: [PATCH 4/7] Fix #4705 --- src/models/entities/access-token.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models/entities/access-token.ts b/src/models/entities/access-token.ts index d08930cf5..99d0c8b5f 100644 --- a/src/models/entities/access-token.ts +++ b/src/models/entities/access-token.ts @@ -25,7 +25,8 @@ export class AccessToken { }) public hash: string; - @RelationId((self: AccessToken) => self.user) + @Index() + @Column(id()) public userId: User['id']; @ManyToOne(type => User, { From 8fefb3a4c9d19a4b618b3b1040da98da6615127d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Apr 2019 01:20:28 +0900 Subject: [PATCH 5/7] Update authenticate.ts --- src/server/api/authenticate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/api/authenticate.ts b/src/server/api/authenticate.ts index ecf4a82c4..519ed7738 100644 --- a/src/server/api/authenticate.ts +++ b/src/server/api/authenticate.ts @@ -31,7 +31,9 @@ export default async (token: string): Promise<[User | null | undefined, App | nu .findOne(accessToken.appId); const user = await Users - .findOne(accessToken.userId); + .findOne({ + id: accessToken.userId // findOne(accessToken.userId) のように書かないのは後方互換性のため + }); return [user, app]; } From b711f0f9c636ec99a7b6ef5bf7032d56ad808cbe Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Apr 2019 01:22:48 +0900 Subject: [PATCH 6/7] Clean up --- src/models/entities/access-token.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/entities/access-token.ts b/src/models/entities/access-token.ts index 99d0c8b5f..137bf1444 100644 --- a/src/models/entities/access-token.ts +++ b/src/models/entities/access-token.ts @@ -1,4 +1,4 @@ -import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn, RelationId } from 'typeorm'; +import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; import { User } from './user'; import { App } from './app'; import { id } from '../id'; From 6d09aa86e98b9029b5e770e5bee765cb9e322ac9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Apr 2019 01:23:26 +0900 Subject: [PATCH 7/7] 11.1.3 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01115d3d2..7df2ea9b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ 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.3 (2019/04/16) +------------------- +### Fixes +* アプリからAPIにリクエストするときにランダムなユーザーがリクエストしたことになる問題を修正 + 11.1.2 (2019/04/15) ------------------- ### Fixes diff --git a/package.json b/package.json index 05a89e33c..4bca45293 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "11.1.2", + "version": "11.1.3", "codename": "daybreak", "repository": { "type": "git",