Resolve #1669
This commit is contained in:
parent
d355f3f77c
commit
7ed3448e13
@ -15,6 +15,7 @@ Misskey v12では、クライアントが設計し直され、全く新しいUI
|
||||
### ⚠Breaking Changes
|
||||
* お知らせがリセットされます。
|
||||
* 通知がリセットされます。
|
||||
* アカウントの外部サービス連携情報がリセットされます。
|
||||
* インスタンスの閉鎖情報がリセットされます。
|
||||
* モデレーターがインスタンス設定を閲覧したり変更したりできなくなります(それらができるのはAdminのみになります)。
|
||||
* モデレーターが出来るのは、ユーザーのサイレンス/凍結などに限られます。
|
||||
@ -56,6 +57,8 @@ Misskey v12では、クライアントが設計し直され、全く新しいUI
|
||||
* Elasticsearchをインストールしなくても全文検索できるように
|
||||
* リモートのカスタム絵文字をコピーしてくる機能を追加
|
||||
* 自分の送ったフォローリクエストが承認されたときの通知を追加
|
||||
* 外部サービス連携情報をプロフィールに表示しないように
|
||||
* 今後個別に表示するかどうか設定できるようになる予定
|
||||
* ハイライト投稿の並びを人気順ではなく投稿日時順に
|
||||
* AIDのノイズがあまりよくないのを改善
|
||||
* WebAuthNで internal というタイプもあるようなのでそれも使えるように
|
||||
|
46
migration/1580508795118-v12-12.ts
Normal file
46
migration/1580508795118-v12-12.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
export class v12121580508795118 implements MigrationInterface {
|
||||
name = 'v12121580508795118'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitter"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessToken"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessTokenSecret"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterUserId"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "twitterScreenName"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "github"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubAccessToken"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubId"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "githubLogin"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discord"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordAccessToken"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordRefreshToken"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordExpiresDate"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordId"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordUsername"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "discordDiscriminator"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "integrations" jsonb NOT NULL DEFAULT '{}'`, undefined);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "integrations"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordDiscriminator" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordUsername" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordId" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordExpiresDate" character varying(64)`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordRefreshToken" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discordAccessToken" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "discord" boolean NOT NULL DEFAULT false`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubLogin" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubId" character varying(64)`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "githubAccessToken" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "github" boolean NOT NULL DEFAULT false`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterScreenName" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterUserId" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterAccessTokenSecret" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitterAccessToken" character varying(64) DEFAULT NULL`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "twitter" boolean NOT NULL DEFAULT false`, undefined);
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <syuilotan@yahoo.co.jp>",
|
||||
"version": "12.0.0-alpha.12",
|
||||
"version": "12.0.0-alpha.13",
|
||||
"codename": "indigo",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,24 +1,25 @@
|
||||
<template>
|
||||
<section class="_card" v-if="enableTwitterIntegration || enableDiscordIntegration || enableGithubIntegration">
|
||||
<div class="_title"><fa :icon="faShareAlt"/> {{ $t('integration') }}</div>
|
||||
|
||||
<div class="_content" v-if="enableTwitterIntegration">
|
||||
<header><fa :icon="faTwitter"/> Twitter</header>
|
||||
<p v-if="$store.state.i.twitter">{{ $t('connectedTo') }}: <a :href="`https://twitter.com/${$store.state.i.twitter.screenName}`" rel="nofollow noopener" target="_blank">@{{ $store.state.i.twitter.screenName }}</a></p>
|
||||
<mk-button v-if="$store.state.i.twitter" @click="disconnectTwitter">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<p v-if="integrations.twitter">{{ $t('connectedTo') }}: <a :href="`https://twitter.com/${integrations.twitter.screenName}`" rel="nofollow noopener" target="_blank">@{{ integrations.twitter.screenName }}</a></p>
|
||||
<mk-button v-if="integrations.twitter" @click="disconnectTwitter">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<mk-button v-else @click="connectTwitter">{{ $t('connectSerice') }}</mk-button>
|
||||
</div>
|
||||
|
||||
<div class="_content" v-if="enableDiscordIntegration">
|
||||
<header><fa :icon="faDiscord"/> Discord</header>
|
||||
<p v-if="$store.state.i.discord">{{ $t('connectedTo') }}: <a :href="`https://discordapp.com/users/${$store.state.i.discord.id}`" rel="nofollow noopener" target="_blank">@{{ $store.state.i.discord.username }}#{{ $store.state.i.discord.discriminator }}</a></p>
|
||||
<mk-button v-if="$store.state.i.discord" @click="disconnectDiscord">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<p v-if="integrations.discord">{{ $t('connectedTo') }}: <a :href="`https://discordapp.com/users/${integrations.discord.id}`" rel="nofollow noopener" target="_blank">@{{ integrations.discord.username }}#{{ integrations.discord.discriminator }}</a></p>
|
||||
<mk-button v-if="integrations.discord" @click="disconnectDiscord">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<mk-button v-else @click="connectDiscord">{{ $t('connectSerice') }}</mk-button>
|
||||
</div>
|
||||
|
||||
<div class="_content" v-if="enableGithubIntegration">
|
||||
<header><fa :icon="faGithub"/> GitHub</header>
|
||||
<p v-if="$store.state.i.github">{{ $t('connectedTo') }}: <a :href="`https://github.com/${$store.state.i.github.login}`" rel="nofollow noopener" target="_blank">@{{ $store.state.i.github.login }}</a></p>
|
||||
<mk-button v-if="$store.state.i.github" @click="disconnectGithub">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<p v-if="integrations.github">{{ $t('connectedTo') }}: <a :href="`https://github.com/${integrations.github.login}`" rel="nofollow noopener" target="_blank">@{{ integrations.github.login }}</a></p>
|
||||
<mk-button v-if="integrations.github" @click="disconnectGithub">{{ $t('disconnectSerice') }}</mk-button>
|
||||
<mk-button v-else @click="connectGithub">{{ $t('connectSerice') }}</mk-button>
|
||||
</div>
|
||||
</section>
|
||||
@ -52,6 +53,12 @@ export default Vue.extend({
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
integrations() {
|
||||
return this.$store.state.i.integrations;
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.enableTwitterIntegration = meta.enableTwitterIntegration;
|
||||
@ -66,14 +73,14 @@ export default Vue.extend({
|
||||
` domain=${document.location.hostname}; max-age=31536000;` +
|
||||
(document.location.protocol.startsWith('https') ? ' secure' : '');
|
||||
}
|
||||
this.$watch('$store.state.i', () => {
|
||||
if (this.$store.state.i.twitter) {
|
||||
this.$watch('integrations', () => {
|
||||
if (this.integrations.twitter) {
|
||||
if (this.twitterForm) this.twitterForm.close();
|
||||
}
|
||||
if (this.$store.state.i.discord) {
|
||||
if (this.integrations.discord) {
|
||||
if (this.discordForm) this.discordForm.close();
|
||||
}
|
||||
if (this.$store.state.i.github) {
|
||||
if (this.integrations.github) {
|
||||
if (this.githubForm) this.githubForm.close();
|
||||
}
|
||||
}, {
|
||||
|
@ -137,87 +137,10 @@ export class UserProfile {
|
||||
@JoinColumn()
|
||||
public pinnedPage: Page | null;
|
||||
|
||||
//#region Linking
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
@Column('jsonb', {
|
||||
default: {}
|
||||
})
|
||||
public twitter: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public twitterAccessToken: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public twitterAccessTokenSecret: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public twitterUserId: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public twitterScreenName: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public github: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public githubAccessToken: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public githubId: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public githubLogin: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public discord: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordAccessToken: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordRefreshToken: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordExpiresDate: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordId: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordUsername: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true, default: null,
|
||||
})
|
||||
public discordDiscriminator: string | null;
|
||||
//#endregion
|
||||
public integrations: Record<string, any>;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
|
@ -213,19 +213,6 @@ export class UserRepository extends Repository<User> {
|
||||
userId: user.id
|
||||
}).then(result => result >= 1)
|
||||
: false,
|
||||
twitter: profile!.twitter ? {
|
||||
id: profile!.twitterUserId,
|
||||
screenName: profile!.twitterScreenName
|
||||
} : null,
|
||||
github: profile!.github ? {
|
||||
id: profile!.githubId,
|
||||
login: profile!.githubLogin
|
||||
} : null,
|
||||
discord: profile!.discord ? {
|
||||
id: profile!.discordId,
|
||||
username: profile!.discordUsername,
|
||||
discriminator: profile!.discordDiscriminator
|
||||
} : null,
|
||||
} : {}),
|
||||
|
||||
...(opts.detail && meId === user.id ? {
|
||||
@ -242,6 +229,7 @@ export class UserRepository extends Repository<User> {
|
||||
pendingReceivedFollowRequestsCount: FollowRequests.count({
|
||||
followeeId: user.id
|
||||
}),
|
||||
integrations: profile?.integrations,
|
||||
} : {}),
|
||||
|
||||
...(opts.includeSecrets ? {
|
||||
|
@ -306,7 +306,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
||||
|
||||
const emojiNames = emojis.map(emoji => emoji.name);
|
||||
|
||||
const { fields, services } = analyzeAttachments(person.attachment || []);
|
||||
const { fields } = analyzeAttachments(person.attachment || []);
|
||||
|
||||
const tags = extractHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32);
|
||||
|
||||
@ -347,13 +347,6 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
||||
url: person.url,
|
||||
fields,
|
||||
description: person.summary ? fromHtml(person.summary) : null,
|
||||
twitterUserId: services.twitter ? services.twitter.userId : null,
|
||||
twitterScreenName: services.twitter ? services.twitter.screenName : null,
|
||||
githubId: services.github ? services.github.id : null,
|
||||
githubLogin: services.github ? services.github.login : null,
|
||||
discordId: services.discord ? services.discord.id : null,
|
||||
discordUsername: services.discord ? services.discord.username : null,
|
||||
discordDiscriminator: services.discord ? services.discord.discriminator : null,
|
||||
});
|
||||
|
||||
// ハッシュタグ更新
|
||||
|
@ -39,45 +39,6 @@ export async function renderPerson(user: ILocalUser) {
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.twitter) {
|
||||
attachment.push({
|
||||
type: 'PropertyValue',
|
||||
name: 'Twitter',
|
||||
value: `<a href="https://twitter.com/intent/user?user_id=${profile.twitterUserId}" rel="me nofollow noopener" target="_blank"><span>@${profile.twitterScreenName}</span></a>`,
|
||||
identifier: {
|
||||
type: 'PropertyValue',
|
||||
name: 'misskey:authentication:twitter',
|
||||
value: `${profile.twitterUserId}@${profile.twitterScreenName}`
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (profile.github) {
|
||||
attachment.push({
|
||||
type: 'PropertyValue',
|
||||
name: 'GitHub',
|
||||
value: `<a href="https://github.com/${profile.githubLogin}" rel="me nofollow noopener" target="_blank"><span>@${profile.githubLogin}</span></a>`,
|
||||
identifier: {
|
||||
type: 'PropertyValue',
|
||||
name: 'misskey:authentication:github',
|
||||
value: `${profile.githubId}@${profile.githubLogin}`
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (profile.discord) {
|
||||
attachment.push({
|
||||
type: 'PropertyValue',
|
||||
name: 'Discord',
|
||||
value: `<a href="https://discordapp.com/users/${profile.discordId}" rel="me nofollow noopener" target="_blank"><span>${profile.discordUsername}#${profile.discordDiscriminator}</span></a>`,
|
||||
identifier: {
|
||||
type: 'PropertyValue',
|
||||
name: 'misskey:authentication:discord',
|
||||
value: `${profile.discordId}@${profile.discordUsername}#${profile.discordDiscriminator}`
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const emojis = await getEmojis(user.emojis);
|
||||
const apemojis = emojis.map(emoji => renderEmoji(emoji));
|
||||
|
||||
|
@ -35,7 +35,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new Error('not verified');
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: profile.twoFactorTempSecret,
|
||||
twoFactorEnabled: true
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => {
|
||||
length: 32
|
||||
});
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorTempSecret: secret.base32
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new Error('incorrect password');
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: null,
|
||||
twoFactorEnabled: false
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => {
|
||||
const salt = await bcrypt.genSalt(8);
|
||||
const hash = await bcrypt.hash(ps.newPassword, salt);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
password: hash
|
||||
});
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new ApiError(meta.errors.incorrectPassword);
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
email: ps.email,
|
||||
emailVerified: false,
|
||||
emailVerifyCode: null
|
||||
@ -66,7 +66,7 @@ export default define(meta, async (ps, user) => {
|
||||
if (ps.email != null) {
|
||||
const code = rndstr('a-z0-9', 16);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
emailVerifyCode: code
|
||||
});
|
||||
|
||||
|
@ -268,7 +268,7 @@ export default define(meta, async (ps, user, app) => {
|
||||
//#endregion
|
||||
|
||||
if (Object.keys(updates).length > 0) await Users.update(user.id, updates);
|
||||
if (Object.keys(profileUpdates).length > 0) await UserProfiles.update({ userId: user.id }, profileUpdates);
|
||||
if (Object.keys(profileUpdates).length > 0) await UserProfiles.update(user.id, profileUpdates);
|
||||
|
||||
const iObj = await Users.pack(user.id, user, {
|
||||
detail: true,
|
||||
|
@ -54,7 +54,7 @@ export default define(meta, async (ps, me) => {
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
if (profile.room.furnitures == null) {
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
furnitures: [],
|
||||
...profile.room
|
||||
@ -66,7 +66,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
if (profile.room.roomType == null) {
|
||||
const initialType = 'default';
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
roomType: initialType as any,
|
||||
...profile.room
|
||||
@ -78,7 +78,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
if (profile.room.carpetColor == null) {
|
||||
const initialColor = '#85CAF0';
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
carpetColor: initialColor as any,
|
||||
...profile.room
|
||||
|
@ -32,7 +32,7 @@ export const meta = {
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: ps.room as any
|
||||
});
|
||||
|
||||
|
@ -46,16 +46,12 @@ router.get('/disconnect/discord', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({
|
||||
userId: user.id
|
||||
}, {
|
||||
discord: false,
|
||||
discordAccessToken: null,
|
||||
discordRefreshToken: null,
|
||||
discordExpiresDate: null,
|
||||
discordId: null,
|
||||
discordUsername: null,
|
||||
discordDiscriminator: null,
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
delete profile.integrations.discord;
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: profile.integrations,
|
||||
});
|
||||
|
||||
ctx.body = `Discordの連携を解除しました :v:`;
|
||||
@ -203,7 +199,7 @@ router.get('/dc/cb', async ctx => {
|
||||
}
|
||||
|
||||
const profile = await UserProfiles.createQueryBuilder()
|
||||
.where('"discordId" = :id', { id: id })
|
||||
.where('"integrations"->"discord"->"id" = :id', { id: id })
|
||||
.andWhere('"userHost" IS NULL')
|
||||
.getOne();
|
||||
|
||||
@ -212,13 +208,17 @@ router.get('/dc/cb', async ctx => {
|
||||
return;
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: profile.userId }, {
|
||||
discord: true,
|
||||
discordAccessToken: accessToken,
|
||||
discordRefreshToken: refreshToken,
|
||||
discordExpiresDate: expiresDate,
|
||||
discordUsername: username,
|
||||
discordDiscriminator: discriminator
|
||||
await UserProfiles.update(profile.userId, {
|
||||
integrations: {
|
||||
...profile.integrations,
|
||||
discord: {
|
||||
accessToken: accessToken,
|
||||
refreshToken: refreshToken,
|
||||
expiresDate: expiresDate,
|
||||
username: username,
|
||||
discriminator: discriminator
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
signin(ctx, await Users.findOne(profile.userId) as ILocalUser, true);
|
||||
@ -284,14 +284,20 @@ router.get('/dc/cb', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
discord: true,
|
||||
discordAccessToken: accessToken,
|
||||
discordRefreshToken: refreshToken,
|
||||
discordExpiresDate: expiresDate,
|
||||
discordId: id,
|
||||
discordUsername: username,
|
||||
discordDiscriminator: discriminator
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: {
|
||||
...profile.integrations,
|
||||
discord: {
|
||||
accessToken: accessToken,
|
||||
refreshToken: refreshToken,
|
||||
expiresDate: expiresDate,
|
||||
id: id,
|
||||
username: username,
|
||||
discriminator: discriminator
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ctx.body = `Discord: @${username}#${discriminator} を、Misskey: @${user.username} に接続しました!`;
|
||||
|
@ -46,13 +46,12 @@ router.get('/disconnect/github', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({
|
||||
userId: user.id
|
||||
}, {
|
||||
github: false,
|
||||
githubAccessToken: null,
|
||||
githubId: null,
|
||||
githubLogin: null,
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
delete profile.integrations.github;
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: profile.integrations,
|
||||
});
|
||||
|
||||
ctx.body = `GitHubの連携を解除しました :v:`;
|
||||
@ -193,7 +192,7 @@ router.get('/gh/cb', async ctx => {
|
||||
}
|
||||
|
||||
const link = await UserProfiles.createQueryBuilder()
|
||||
.where('"githubId" = :id', { id: id })
|
||||
.where('"integrations"->"github"->"id" = :id', { id: id })
|
||||
.andWhere('"userHost" IS NULL')
|
||||
.getOne();
|
||||
|
||||
@ -260,11 +259,17 @@ router.get('/gh/cb', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
github: true,
|
||||
githubAccessToken: accessToken,
|
||||
githubId: id,
|
||||
githubLogin: login,
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: {
|
||||
...profile.integrations,
|
||||
github: {
|
||||
accessToken: accessToken,
|
||||
id: id,
|
||||
login: login,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ctx.body = `GitHub: @${login} を、Misskey: @${user.username} に接続しました!`;
|
||||
|
@ -45,14 +45,12 @@ router.get('/disconnect/twitter', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({
|
||||
userId: user.id
|
||||
}, {
|
||||
twitter: false,
|
||||
twitterAccessToken: null,
|
||||
twitterAccessTokenSecret: null,
|
||||
twitterUserId: null,
|
||||
twitterScreenName: null,
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
delete profile.integrations.twitter;
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: profile.integrations,
|
||||
});
|
||||
|
||||
ctx.body = `Twitterの連携を解除しました :v:`;
|
||||
@ -141,7 +139,7 @@ router.get('/tw/cb', async ctx => {
|
||||
const result = await twAuth!.done(JSON.parse(twCtx), ctx.query.oauth_verifier);
|
||||
|
||||
const link = await UserProfiles.createQueryBuilder()
|
||||
.where('"twitterUserId" = :id', { id: result.userId })
|
||||
.where('"integrations"->"twitter"->"userId" = :id', { id: result.userId })
|
||||
.andWhere('"userHost" IS NULL')
|
||||
.getOne();
|
||||
|
||||
@ -174,12 +172,18 @@ router.get('/tw/cb', async ctx => {
|
||||
token: userToken
|
||||
}).then(ensure);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
twitter: true,
|
||||
twitterAccessToken: result.accessToken,
|
||||
twitterAccessTokenSecret: result.accessTokenSecret,
|
||||
twitterUserId: result.userId,
|
||||
twitterScreenName: result.screenName,
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
integrations: {
|
||||
...profile.integrations,
|
||||
twitter: {
|
||||
accessToken: result.accessToken,
|
||||
accessTokenSecret: result.accessTokenSecret,
|
||||
userId: result.userId,
|
||||
screenName: result.screenName,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
ctx.body = `Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`;
|
||||
|
Loading…
Reference in New Issue
Block a user