From 6b753b05d61f8583ea9b9f04cacb0d7cf5a69764 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 22 Mar 2021 22:28:09 +0900 Subject: [PATCH 01/18] perf(server): Cache user instance actor --- src/services/instance-actor.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/services/instance-actor.ts b/src/services/instance-actor.ts index 74591846f..a6dadb0cd 100644 --- a/src/services/instance-actor.ts +++ b/src/services/instance-actor.ts @@ -1,17 +1,27 @@ import { createSystemUser } from './create-system-user'; import { ILocalUser } from '../models/entities/user'; import { Users } from '../models'; +import { Cache } from '../misc/cache'; const ACTOR_USERNAME = 'instance.actor' as const; +const cache = new Cache(Infinity); + export async function getInstanceActor(): Promise { + const cached = cache.get(null); + if (cached) return cached; + const user = await Users.findOne({ host: null, username: ACTOR_USERNAME - }); + }) as ILocalUser | undefined; - if (user) return user as ILocalUser; - - const created = await createSystemUser(ACTOR_USERNAME); - return created as ILocalUser; + if (user) { + cache.set(null, user); + return user; + } else { + const created = await createSystemUser(ACTOR_USERNAME) as ILocalUser; + cache.set(null, created); + return created; + } } From 48ea805999c6cb8e900aeaec6edaf68788bd51e0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 11:53:25 +0900 Subject: [PATCH 02/18] =?UTF-8?q?perf(server):=20Redis=E6=8E=A5=E7=B6=9A?= =?UTF-8?q?=E3=82=92=E3=82=B9=E3=83=88=E3=83=AA=E3=83=BC=E3=83=9F=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E6=8E=A5=E7=B6=9A=E3=81=94=E3=81=A8=E3=81=AB=E4=BD=9C?= =?UTF-8?q?=E3=82=89=E3=81=9A=E3=80=81=E3=83=97=E3=83=AD=E3=82=BB=E3=82=B9?= =?UTF-8?q?=E5=85=A8=E4=BD=93=E3=81=A7=E5=85=B1=E6=9C=89=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/redis.ts | 6 +++++- src/server/api/streaming.ts | 33 ++++++++------------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/db/redis.ts b/src/db/redis.ts index 41d030149..7570aa59b 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -1,7 +1,7 @@ import * as redis from 'redis'; import config from '../config'; -export default redis.createClient( +const client = redis.createClient( config.redis.port, config.redis.host, { @@ -10,3 +10,7 @@ export default redis.createClient( db: config.redis.db || 0 } ); + +client.subscribe(config.host); + +export default client; diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index 10f2a70ba..4ec0c5137 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -1,12 +1,11 @@ import * as http from 'http'; import * as websocket from 'websocket'; -import * as redis from 'redis'; import MainStreamConnection from './stream'; import { ParsedUrlQuery } from 'querystring'; import authenticate from './authenticate'; import { EventEmitter } from 'events'; -import config from '../../config'; +import redisClient from '../../db/redis'; module.exports = (server: http.Server) => { // Init websocket server @@ -24,37 +23,21 @@ module.exports = (server: http.Server) => { const connection = request.accept(); - let ev: EventEmitter; + const ev = new EventEmitter(); - // Connect to Redis - const subscriber = redis.createClient( - config.redis.port, - config.redis.host, - { - password: config.redis.pass - } - ); + async function onRedisMessage(_: string, data: string) { + const parsed = JSON.parse(data); + ev.emit(parsed.channel, parsed.message); + } - subscriber.subscribe(config.host); - - ev = new EventEmitter(); - - subscriber.on('message', async (_, data) => { - const obj = JSON.parse(data); - - ev.emit(obj.channel, obj.message); - }); - - connection.once('close', () => { - subscriber.unsubscribe(); - subscriber.quit(); - }); + redisClient.on('message', onRedisMessage); const main = new MainStreamConnection(connection, ev, user, app); connection.once('close', () => { ev.removeAllListeners(); main.dispose(); + redisClient.off('message', onRedisMessage); }); connection.on('message', async (data) => { From 5c3a56b2832ac625552a7d261cd38fb118d813f4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 14:54:09 +0900 Subject: [PATCH 03/18] fix bug https://github.com/syuilo/misskey/commit/48ea805999c6cb8e900aeaec6edaf68788bd51e0#commitcomment-48584326 --- src/db/redis.ts | 25 +++++++++++-------- src/misc/app-lock.ts | 6 ++--- src/server/api/endpoints/admin/server-info.ts | 4 +-- .../api/endpoints/get-online-users-count.ts | 4 +-- src/server/api/limiter.ts | 6 ++--- src/server/api/service/discord.ts | 10 ++++---- src/server/api/service/github.ts | 10 ++++---- src/server/api/service/twitter.ts | 10 ++++---- src/server/api/streaming.ts | 2 +- src/server/web/index.ts | 4 +-- 10 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/db/redis.ts b/src/db/redis.ts index 7570aa59b..5b6fc05df 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -1,16 +1,19 @@ import * as redis from 'redis'; import config from '../config'; -const client = redis.createClient( - config.redis.port, - config.redis.host, - { - password: config.redis.pass, - prefix: config.redis.prefix, - db: config.redis.db || 0 - } -); +export function createConnection() { + return redis.createClient( + config.redis.port, + config.redis.host, + { + password: config.redis.pass, + prefix: config.redis.prefix, + db: config.redis.db || 0 + } + ); +} -client.subscribe(config.host); +export const subsdcriber = createConnection(); +subsdcriber.subscribe(config.host); -export default client; +export const redisClient = createConnection(); diff --git a/src/misc/app-lock.ts b/src/misc/app-lock.ts index 847299b46..9ae2cba47 100644 --- a/src/misc/app-lock.ts +++ b/src/misc/app-lock.ts @@ -1,4 +1,4 @@ -import redis from '../db/redis'; +import { redisClient } from '../db/redis'; import { promisify } from 'util'; /** @@ -7,8 +7,8 @@ import { promisify } from 'util'; const retryDelay = 100; const lock: (key: string, timeout?: number) => Promise<() => void> - = redis - ? promisify(require('redis-lock')(redis, retryDelay)) + = redisClient + ? promisify(require('redis-lock')(redisClient, retryDelay)) : async () => () => { }; /** diff --git a/src/server/api/endpoints/admin/server-info.ts b/src/server/api/endpoints/admin/server-info.ts index 3b48a811e..33e619097 100644 --- a/src/server/api/endpoints/admin/server-info.ts +++ b/src/server/api/endpoints/admin/server-info.ts @@ -2,7 +2,7 @@ import * as os from 'os'; import * as si from 'systeminformation'; import { getConnection } from 'typeorm'; import define from '../../define'; -import redis from '../../../../db/redis'; +import { redisClient } from '../../../../db/redis'; export const meta = { requireCredential: true as const, @@ -115,7 +115,7 @@ export default define(meta, async () => { os: os.platform(), node: process.version, psql: await getConnection().query('SHOW server_version').then(x => x[0].server_version), - redis: redis.server_info.redis_version, + redis: redisClient.server_info.redis_version, cpu: { model: os.cpus()[0].model, cores: os.cpus().length diff --git a/src/server/api/endpoints/get-online-users-count.ts b/src/server/api/endpoints/get-online-users-count.ts index 752110488..520948ac6 100644 --- a/src/server/api/endpoints/get-online-users-count.ts +++ b/src/server/api/endpoints/get-online-users-count.ts @@ -1,5 +1,5 @@ import define from '../define'; -import redis from '../../../db/redis'; +import { redisClient } from '../../../db/redis'; import config from '../../../config'; export const meta = { @@ -13,7 +13,7 @@ export const meta = { export default define(meta, (ps, user) => { return new Promise((res, rej) => { - redis.pubsub('numsub', config.host, (_, x) => { + redisClient.pubsub('numsub', config.host, (_, x) => { res({ count: x[1] }); diff --git a/src/server/api/limiter.ts b/src/server/api/limiter.ts index 48d12d3cc..de4115858 100644 --- a/src/server/api/limiter.ts +++ b/src/server/api/limiter.ts @@ -1,5 +1,5 @@ import * as Limiter from 'ratelimiter'; -import limiterDB from '../../db/redis'; +import { redisClient } from '../../db/redis'; import { IEndpoint } from './endpoints'; import getAcct from '../../misc/acct/render'; import { User } from '../../models/entities/user'; @@ -35,7 +35,7 @@ export default (endpoint: IEndpoint, user: User) => new Promise((ok, reject) => id: `${user.id}:${key}:min`, duration: limitation.minInterval, max: 1, - db: limiterDB! + db: redisClient }); minIntervalLimiter.get((err, info) => { @@ -63,7 +63,7 @@ export default (endpoint: IEndpoint, user: User) => new Promise((ok, reject) => id: `${user.id}:${key}`, duration: limitation.duration, max: limitation.max, - db: limiterDB! + db: redisClient }); limiter.get((err, info) => { diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts index fce840cde..0ee268e77 100644 --- a/src/server/api/service/discord.ts +++ b/src/server/api/service/discord.ts @@ -4,7 +4,7 @@ import { getJson } from '../../../misc/fetch'; import { OAuth2 } from 'oauth'; import config from '../../../config'; import { publishMainStream } from '../../../services/stream'; -import redis from '../../../db/redis'; +import { redisClient } from '../../../db/redis'; import { v4 as uuid } from 'uuid'; import signin from '../common/signin'; import { fetchMeta } from '../../../misc/fetch-meta'; @@ -96,7 +96,7 @@ router.get('/connect/discord', async ctx => { response_type: 'code' }; - redis.set(userToken, JSON.stringify(params)); + redisClient.set(userToken, JSON.stringify(params)); const oauth2 = await getOAuth2(); ctx.redirect(oauth2!.getAuthorizeUrl(params)); @@ -118,7 +118,7 @@ router.get('/signin/discord', async ctx => { httpOnly: true }); - redis.set(sessid, JSON.stringify(params)); + redisClient.set(sessid, JSON.stringify(params)); const oauth2 = await getOAuth2(); ctx.redirect(oauth2!.getAuthorizeUrl(params)); @@ -145,7 +145,7 @@ router.get('/dc/cb', async ctx => { } const { redirect_uri, state } = await new Promise((res, rej) => { - redis.get(sessid, async (_, state) => { + redisClient.get(sessid, async (_, state) => { res(JSON.parse(state)); }); }); @@ -216,7 +216,7 @@ router.get('/dc/cb', async ctx => { } const { redirect_uri, state } = await new Promise((res, rej) => { - redis.get(userToken, async (_, state) => { + redisClient.get(userToken, async (_, state) => { res(JSON.parse(state)); }); }); diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts index 2b10fa02a..7ca95fc11 100644 --- a/src/server/api/service/github.ts +++ b/src/server/api/service/github.ts @@ -4,7 +4,7 @@ import { getJson } from '../../../misc/fetch'; import { OAuth2 } from 'oauth'; import config from '../../../config'; import { publishMainStream } from '../../../services/stream'; -import redis from '../../../db/redis'; +import { redisClient } from '../../../db/redis'; import { v4 as uuid } from 'uuid'; import signin from '../common/signin'; import { fetchMeta } from '../../../misc/fetch-meta'; @@ -95,7 +95,7 @@ router.get('/connect/github', async ctx => { state: uuid() }; - redis.set(userToken, JSON.stringify(params)); + redisClient.set(userToken, JSON.stringify(params)); const oauth2 = await getOath2(); ctx.redirect(oauth2!.getAuthorizeUrl(params)); @@ -116,7 +116,7 @@ router.get('/signin/github', async ctx => { httpOnly: true }); - redis.set(sessid, JSON.stringify(params)); + redisClient.set(sessid, JSON.stringify(params)); const oauth2 = await getOath2(); ctx.redirect(oauth2!.getAuthorizeUrl(params)); @@ -143,7 +143,7 @@ router.get('/gh/cb', async ctx => { } const { redirect_uri, state } = await new Promise((res, rej) => { - redis.get(sessid, async (_, state) => { + redisClient.get(sessid, async (_, state) => { res(JSON.parse(state)); }); }); @@ -194,7 +194,7 @@ router.get('/gh/cb', async ctx => { } const { redirect_uri, state } = await new Promise((res, rej) => { - redis.get(userToken, async (_, state) => { + redisClient.get(userToken, async (_, state) => { res(JSON.parse(state)); }); }); diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts index 97e9d3a7f..7985042d2 100644 --- a/src/server/api/service/twitter.ts +++ b/src/server/api/service/twitter.ts @@ -2,7 +2,7 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; import { v4 as uuid } from 'uuid'; import autwh from 'autwh'; -import redis from '../../../db/redis'; +import { redisClient } from '../../../db/redis'; import { publishMainStream } from '../../../services/stream'; import config from '../../../config'; import signin from '../common/signin'; @@ -89,7 +89,7 @@ router.get('/connect/twitter', async ctx => { const twAuth = await getTwAuth(); const twCtx = await twAuth!.begin(); - redis.set(userToken, JSON.stringify(twCtx)); + redisClient.set(userToken, JSON.stringify(twCtx)); ctx.redirect(twCtx.url); }); @@ -99,7 +99,7 @@ router.get('/signin/twitter', async ctx => { const sessid = uuid(); - redis.set(sessid, JSON.stringify(twCtx)); + redisClient.set(sessid, JSON.stringify(twCtx)); ctx.cookies.set('signin_with_twitter_sid', sessid, { path: '/', @@ -124,7 +124,7 @@ router.get('/tw/cb', async ctx => { } const get = new Promise((res, rej) => { - redis.get(sessid, async (_, twCtx) => { + redisClient.get(sessid, async (_, twCtx) => { res(twCtx); }); }); @@ -153,7 +153,7 @@ router.get('/tw/cb', async ctx => { } const get = new Promise((res, rej) => { - redis.get(userToken, async (_, twCtx) => { + redisClient.get(userToken, async (_, twCtx) => { res(twCtx); }); }); diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index 4ec0c5137..81b83edcf 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -5,7 +5,7 @@ import MainStreamConnection from './stream'; import { ParsedUrlQuery } from 'querystring'; import authenticate from './authenticate'; import { EventEmitter } from 'events'; -import redisClient from '../../db/redis'; +import { subsdcriber as redisClient } from '../../db/redis'; module.exports = (server: http.Server) => { // Init websocket server diff --git a/src/server/web/index.ts b/src/server/web/index.ts index ea356206f..655862743 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -21,7 +21,7 @@ import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips } from '../. import parseAcct from '../../misc/acct/parse'; import { getNoteSummary } from '../../misc/get-note-summary'; import { getConnection } from 'typeorm'; -import redis from '../../db/redis'; +import { redisClient } from '../../db/redis'; import locales = require('../../../locales'); const markdown = MarkdownIt({ @@ -379,7 +379,7 @@ router.get('/info', async ctx => { os: os.platform(), node: process.version, psql: await getConnection().query('SHOW server_version').then(x => x[0].server_version), - redis: redis.server_info.redis_version, + redis: redisClient.server_info.redis_version, cpu: { model: os.cpus()[0].model, cores: os.cpus().length From 00bc097abb924e4ddf88c224e353ff2f9b6c97e6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 14:56:01 +0900 Subject: [PATCH 04/18] =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88?= =?UTF-8?q?=E5=BF=98=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/stream.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/stream.ts b/src/services/stream.ts index 75385847c..a8855b62e 100644 --- a/src/services/stream.ts +++ b/src/services/stream.ts @@ -1,4 +1,4 @@ -import redis from '../db/redis'; +import { redisClient } from '../db/redis'; import { User } from '../models/entities/user'; import { Note } from '../models/entities/note'; import { UserList } from '../models/entities/user-list'; @@ -14,7 +14,7 @@ class Publisher { { type: type, body: null } : { type: type, body: value }; - redis.publish(config.host, JSON.stringify({ + redisClient.publish(config.host, JSON.stringify({ channel: channel, message: message })); From 7e4a800352dd1de91a7a6c457b39f297d76fd9bf Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 15:06:56 +0900 Subject: [PATCH 05/18] =?UTF-8?q?note=E3=81=AEread=E5=87=A6=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/misc/antenna-cache.ts | 36 ++++++++++ src/misc/check-hit-antenna.ts | 14 ++-- src/models/repositories/user.ts | 7 +- src/server/api/endpoints/antennas/create.ts | 7 +- src/server/api/endpoints/antennas/delete.ts | 3 + src/server/api/endpoints/antennas/update.ts | 3 + src/server/api/stream/index.ts | 15 ++-- src/services/note/create.ts | 20 +++--- src/services/note/read.ts | 79 ++++++++++++++------- src/services/stream.ts | 5 ++ 10 files changed, 132 insertions(+), 57 deletions(-) create mode 100644 src/misc/antenna-cache.ts diff --git a/src/misc/antenna-cache.ts b/src/misc/antenna-cache.ts new file mode 100644 index 000000000..6be1c18db --- /dev/null +++ b/src/misc/antenna-cache.ts @@ -0,0 +1,36 @@ +import { Antennas } from '../models'; +import { Antenna } from '../models/entities/antenna'; +import { subsdcriber } from '../db/redis'; + +let antennasFetched = false; +let antennas: Antenna[] = []; + +export async function getAntennas() { + if (!antennasFetched) { + antennas = await Antennas.find(); + antennasFetched = true; + } + + return antennas; +} + +subsdcriber.on('message', async (_, data) => { + const obj = JSON.parse(data); + + if (obj.channel === 'internal') { + const { type, body } = obj.message; + switch (type) { + case 'antennaCreated': + antennas.push(body); + break; + case 'antennaUpdated': + antennas[antennas.findIndex(a => a.id === body.id)] = body; + break; + case 'antennaDeleted': + antennas = antennas.filter(a => a.id !== body.id); + break; + default: + break; + } + } +}); diff --git a/src/misc/check-hit-antenna.ts b/src/misc/check-hit-antenna.ts index 0464f1413..9897dd414 100644 --- a/src/misc/check-hit-antenna.ts +++ b/src/misc/check-hit-antenna.ts @@ -4,18 +4,24 @@ import { User } from '../models/entities/user'; import { UserListJoinings, UserGroupJoinings } from '../models'; import parseAcct from './acct/parse'; import { getFullApAccount } from './convert-host'; +import { PackedNote } from '../models/repositories/note'; -export async function checkHitAntenna(antenna: Antenna, note: Note, noteUser: User, followers: User['id'][]): Promise { +/** + * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい + */ +export async function checkHitAntenna(antenna: Antenna, note: (Note | PackedNote), noteUser: { username: string; host: string | null; }, noteUserFollowers?: User['id'][], antennaUserFollowing?: User['id'][]): Promise { if (note.visibility === 'specified') return false; if (note.visibility === 'followers') { - if (!followers.includes(antenna.userId)) return false; + if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) return false; + if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; } if (!antenna.withReplies && note.replyId != null) return false; if (antenna.src === 'home') { - if (!followers.includes(antenna.userId)) return false; + if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) return false; + if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; } else if (antenna.src === 'list') { const listUsers = (await UserListJoinings.find({ userListId: antenna.userListId! @@ -75,7 +81,7 @@ export async function checkHitAntenna(antenna: Antenna, note: Note, noteUser: Us } if (antenna.withFile) { - if (note.fileIds.length === 0) return false; + if (note.fileIds && note.fileIds.length === 0) return false; } // TODO: eval expression diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 53c06f3f1..3d897e166 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -6,6 +6,7 @@ import config from '../../config'; import { SchemaType } from '../../misc/schema'; import { awaitAll } from '../../prelude/await-all'; import { populateEmojis } from '../../misc/populate-emojis'; +import { getAntennas } from '../../misc/antenna-cache'; export type PackedUser = SchemaType; @@ -97,10 +98,10 @@ export class UserRepository extends Repository { } public async getHasUnreadAntenna(userId: User['id']): Promise { - const antennas = await Antennas.find({ userId }); + const myAntennas = (await getAntennas()).filter(a => a.userId === userId); - const unread = antennas.length > 0 ? await AntennaNotes.findOne({ - antennaId: In(antennas.map(x => x.id)), + const unread = myAntennas.length > 0 ? await AntennaNotes.findOne({ + antennaId: In(myAntennas.map(x => x.id)), read: false }) : null; diff --git a/src/server/api/endpoints/antennas/create.ts b/src/server/api/endpoints/antennas/create.ts index b5f0eead2..7210c992c 100644 --- a/src/server/api/endpoints/antennas/create.ts +++ b/src/server/api/endpoints/antennas/create.ts @@ -4,6 +4,7 @@ import { genId } from '../../../../misc/gen-id'; import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; import { ID } from '../../../../misc/cafy-id'; import { ApiError } from '../../error'; +import { publishInternalEvent } from '../../../../services/stream'; export const meta = { desc: { @@ -108,7 +109,7 @@ export default define(meta, async (ps, user) => { } } - const antenna = await Antennas.save({ + const antenna = await Antennas.insert({ id: genId(), createdAt: new Date(), userId: user.id, @@ -123,7 +124,9 @@ export default define(meta, async (ps, user) => { withReplies: ps.withReplies, withFile: ps.withFile, notify: ps.notify, - }); + }).then(x => Antennas.findOneOrFail(x.identifiers[0])); + + publishInternalEvent('antennaCreated', antenna); return await Antennas.pack(antenna); }); diff --git a/src/server/api/endpoints/antennas/delete.ts b/src/server/api/endpoints/antennas/delete.ts index 9008c37c8..adaf2d0d8 100644 --- a/src/server/api/endpoints/antennas/delete.ts +++ b/src/server/api/endpoints/antennas/delete.ts @@ -3,6 +3,7 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Antennas } from '../../../../models'; +import { publishInternalEvent } from '../../../../services/stream'; export const meta = { desc: { @@ -42,4 +43,6 @@ export default define(meta, async (ps, user) => { } await Antennas.delete(antenna.id); + + publishInternalEvent('antennaDeleted', antenna); }); diff --git a/src/server/api/endpoints/antennas/update.ts b/src/server/api/endpoints/antennas/update.ts index 58f4e68c8..22764b741 100644 --- a/src/server/api/endpoints/antennas/update.ts +++ b/src/server/api/endpoints/antennas/update.ts @@ -3,6 +3,7 @@ import { ID } from '../../../../misc/cafy-id'; import define from '../../define'; import { ApiError } from '../../error'; import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; +import { publishInternalEvent } from '../../../../services/stream'; export const meta = { desc: { @@ -141,5 +142,7 @@ export default define(meta, async (ps, user) => { notify: ps.notify, }); + publishInternalEvent('antennaUpdated', Antennas.findOneOrFail(antenna.id)); + return await Antennas.pack(antenna.id); }); diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 99ae55869..1dcc31d32 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -168,17 +168,10 @@ export default class Connection { if (note == null) return; if (this.user && (note.userId !== this.user.id)) { - if (note.mentions && note.mentions.includes(this.user.id)) { - readNote(this.user.id, [note]); - } else if (note.visibleUserIds && note.visibleUserIds.includes(this.user.id)) { - readNote(this.user.id, [note]); - } - - if (this.followingChannels.has(note.channelId)) { - // TODO - } - - // TODO: アンテナの既読処理 + readNote(this.user.id, [note], { + following: this.following, + followingChannels: this.followingChannels, + }); } } diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 4a737e851..b9c1676c5 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -33,6 +33,7 @@ import { countSameRenotes } from '../../misc/count-same-renotes'; import { deliverToRelays } from '../relay'; import { Channel } from '../../models/entities/channel'; import { normalizeForSearch } from '../../misc/normalize-for-search'; +import { getAntennas } from '../../misc/antenna-cache'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -241,6 +242,7 @@ export default async (user: User, data: Option, silent = false) => new Promise { @@ -262,17 +264,15 @@ export default async (user: User, data: Option, silent = false) => new Promise { + .then(async followings => { const followers = followings.map(f => f.followerId); - Antennas.find().then(async antennas => { - for (const antenna of antennas) { - checkHitAntenna(antenna, note, user, followers).then(hit => { - if (hit) { - addNoteToAntenna(antenna, note, user); - } - }); - } - }); + for (const antenna of (await getAntennas())) { + checkHitAntenna(antenna, note, user, followers).then(hit => { + if (hit) { + addNoteToAntenna(antenna, note, user); + } + }); + } }); // Channel diff --git a/src/services/note/read.ts b/src/services/note/read.ts index 35279db41..91b523bd1 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -1,23 +1,59 @@ import { publishMainStream } from '../stream'; import { Note } from '../../models/entities/note'; import { User } from '../../models/entities/user'; -import { NoteUnreads, Antennas, AntennaNotes, Users } from '../../models'; +import { NoteUnreads, AntennaNotes, Users } from '../../models'; import { Not, IsNull, In } from 'typeorm'; +import { Channel } from '../../models/entities/channel'; +import { checkHitAntenna } from '../../misc/check-hit-antenna'; +import { getAntennas } from '../../misc/antenna-cache'; +import { PackedNote } from '../../models/repositories/note'; /** * Mark notes as read */ export default async function( userId: User['id'], - noteIds: Note['id'][] + notes: (Note | PackedNote)[], + info: { + following: Set; + followingChannels: Set; + } ) { - async function careNoteUnreads() { + const myAntennas = (await getAntennas()).filter(a => a.userId === userId); + const readMentions: (Note | PackedNote)[] = []; + const readSpecifiedNotes: (Note | PackedNote)[] = []; + const readChannelNotes: (Note | PackedNote)[] = []; + const readAntennaNotes: (Note | PackedNote)[] = []; + + for (const note of notes) { + if (note.mentions && note.mentions.includes(userId)) { + readMentions.push(note); + } else if (note.visibleUserIds && note.visibleUserIds.includes(userId)) { + readSpecifiedNotes.push(note); + } + + if (note.channelId && info.followingChannels.has(note.channelId)) { + readChannelNotes.push(note); + } + + if (note.user != null) { // たぶんnullになることは無いはずだけど一応 + for (const antenna of myAntennas) { + if (checkHitAntenna(antenna, note, note.user as any, undefined, Array.from(info.following))) { + readAntennaNotes.push(note); + } + } + } + } + + if ((readMentions.length > 0) || (readSpecifiedNotes.length > 0) || (readChannelNotes.length > 0)) { // Remove the record await NoteUnreads.delete({ userId: userId, - noteId: In(noteIds), + noteId: In([...readMentions.map(n => n.id), ...readSpecifiedNotes.map(n => n.id), ...readChannelNotes.map(n => n.id)]), }); + // TODO: ↓まとめてクエリしたい + NoteUnreads.count({ userId: userId, isMentioned: true @@ -49,33 +85,25 @@ export default async function( }); } - async function careAntenna() { - const antennas = await Antennas.find({ userId }); + if (readAntennaNotes.length > 0) { + await AntennaNotes.update({ + antennaId: In(myAntennas.map(a => a.id)), + noteId: In(readAntennaNotes.map(n => n.id)) + }, { + read: true + }); - await Promise.all(antennas.map(async antenna => { - const countBefore = await AntennaNotes.count({ + // TODO: まとめてクエリしたい + for (const antenna of myAntennas) { + const count = await AntennaNotes.count({ antennaId: antenna.id, read: false }); - if (countBefore === 0) return; - - await AntennaNotes.update({ - antennaId: antenna.id, - noteId: In(noteIds) - }, { - read: true - }); - - const countAfter = await AntennaNotes.count({ - antennaId: antenna.id, - read: false - }); - - if (countAfter === 0) { + if (count === 0) { publishMainStream(userId, 'readAntenna', antenna); } - })); + } Users.getHasUnreadAntenna(userId).then(unread => { if (!unread) { @@ -83,7 +111,4 @@ export default async function( } }); } - - careNoteUnreads(); - careAntenna(); } diff --git a/src/services/stream.ts b/src/services/stream.ts index a8855b62e..6d7c2c492 100644 --- a/src/services/stream.ts +++ b/src/services/stream.ts @@ -20,6 +20,10 @@ class Publisher { })); } + public publishInternalEvent = (type: string, value?: any): void => { + this.publish('internal', type, typeof value === 'undefined' ? null : value); + } + public publishUserEvent = (userId: User['id'], type: string, value?: any): void => { this.publish(`user:${userId}`, type, typeof value === 'undefined' ? null : value); } @@ -88,6 +92,7 @@ const publisher = new Publisher(); export default publisher; +export const publishInternalEvent = publisher.publishInternalEvent; export const publishUserEvent = publisher.publishUserEvent; export const publishBroadcastStream = publisher.publishBroadcastStream; export const publishMainStream = publisher.publishMainStream; From cd4680b422f1740ce212ff50925632b0d55db398 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 15:12:47 +0900 Subject: [PATCH 06/18] fix --- src/server/api/endpoints/notes/mentions.ts | 2 +- src/services/note/read.ts | 23 +++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index 30368ea57..32e71acc0 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -83,7 +83,7 @@ export default define(meta, async (ps, user) => { const mentions = await query.take(ps.limit!).getMany(); - read(user.id, mentions.map(note => note.id)); + read(user.id, mentions); return await Notes.packMany(mentions, user); }); diff --git a/src/services/note/read.ts b/src/services/note/read.ts index 91b523bd1..4e8c76cbe 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -1,7 +1,7 @@ import { publishMainStream } from '../stream'; import { Note } from '../../models/entities/note'; import { User } from '../../models/entities/user'; -import { NoteUnreads, AntennaNotes, Users } from '../../models'; +import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '../../models'; import { Not, IsNull, In } from 'typeorm'; import { Channel } from '../../models/entities/channel'; import { checkHitAntenna } from '../../misc/check-hit-antenna'; @@ -14,11 +14,24 @@ import { PackedNote } from '../../models/repositories/note'; export default async function( userId: User['id'], notes: (Note | PackedNote)[], - info: { - following: Set; + info?: { + following: Set; followingChannels: Set; } ) { + const following = info?.following ? info.following : new Set((await Followings.find({ + where: { + followerId: userId + }, + select: ['followeeId'] + })).map(x => x.followeeId)); + const followingChannels = info?.followingChannels ? info.followingChannels : new Set((await ChannelFollowings.find({ + where: { + followerId: userId + }, + select: ['followeeId'] + })).map(x => x.followeeId)); + const myAntennas = (await getAntennas()).filter(a => a.userId === userId); const readMentions: (Note | PackedNote)[] = []; const readSpecifiedNotes: (Note | PackedNote)[] = []; @@ -32,13 +45,13 @@ export default async function( readSpecifiedNotes.push(note); } - if (note.channelId && info.followingChannels.has(note.channelId)) { + if (note.channelId && followingChannels.has(note.channelId)) { readChannelNotes.push(note); } if (note.user != null) { // たぶんnullになることは無いはずだけど一応 for (const antenna of myAntennas) { - if (checkHitAntenna(antenna, note, note.user as any, undefined, Array.from(info.following))) { + if (checkHitAntenna(antenna, note, note.user as any, undefined, Array.from(following))) { readAntennaNotes.push(note); } } From 94fd5485b6cc5d69bfbb706d5d65e48ccfa45ea8 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 23 Mar 2021 15:22:31 +0900 Subject: [PATCH 07/18] Use TRUNCATE (#7385) --- src/server/api/endpoints/admin/delete-logs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/api/endpoints/admin/delete-logs.ts b/src/server/api/endpoints/admin/delete-logs.ts index 371938731..1caea46ea 100644 --- a/src/server/api/endpoints/admin/delete-logs.ts +++ b/src/server/api/endpoints/admin/delete-logs.ts @@ -14,5 +14,5 @@ export const meta = { }; export default define(meta, async (ps) => { - await Logs.delete({}); + await Logs.clear(); // TRUNCATE }); From 8432c2c9eab5f40b8add842240224129cc2f9c54 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 17:24:40 +0900 Subject: [PATCH 08/18] =?UTF-8?q?refactor(build):=20gulp=E3=82=92=E7=B5=8C?= =?UTF-8?q?=E7=94=B1=E3=81=97=E3=81=AA=E3=81=84=E3=81=A7TypeScript?= =?UTF-8?q?=E3=81=AE=E3=83=93=E3=83=AB=E3=83=89=E3=82=92=E8=A1=8C=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit path aliasをサーバーサイドでも使ったりしたいため --- gulpfile.ts | 12 -- package.json | 12 +- src/@types/meta.json.d.ts | 3 - src/boot/master.ts | 2 +- src/config/load.ts | 2 +- .../client => src/server/web}/manifest.json | 0 src/server/web/manifest.ts | 2 +- src/tsconfig.json | 3 + yarn.lock | 120 ++++++++++++++---- 9 files changed, 106 insertions(+), 50 deletions(-) delete mode 100644 src/@types/meta.json.d.ts rename {assets/client => src/server/web}/manifest.json (100%) diff --git a/gulpfile.ts b/gulpfile.ts index 771a5c0e3..bcd50890e 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -4,7 +4,6 @@ import * as fs from 'fs'; import * as gulp from 'gulp'; -import * as ts from 'gulp-typescript'; import * as rimraf from 'rimraf'; import * as replace from 'gulp-replace'; const terser = require('gulp-terser'); @@ -13,16 +12,6 @@ const cssnano = require('gulp-cssnano'); const locales: { [x: string]: any } = require('./locales'); const meta = require('./package.json'); -gulp.task('build:ts', () => { - const tsProject = ts.createProject('./src/tsconfig.json'); - - return tsProject - .src() - .pipe(tsProject()) - .on('error', () => {}) - .pipe(gulp.dest('./built/')); -}); - gulp.task('build:copy:views', () => gulp.src('./src/server/web/views/**/*').pipe(gulp.dest('./built/server/web/views')) ); @@ -78,7 +67,6 @@ gulp.task('cleanall', gulp.parallel('clean', cb => )); gulp.task('build', gulp.parallel( - 'build:ts', 'build:copy', )); diff --git a/package.json b/package.json index 0f40837a6..299fe4e5f 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,13 @@ "ormconfig": "node ./built/ormconfig.js", "migrate": "ts-node ./node_modules/typeorm/cli.js migration:run", "migrateandstart": "npm run migrate && npm run start", - "build": "npm run build-webpack && npm run build-gulp", + "build": "npm run build-webpack && npm run build-ts && npm run build-gulp", "build-webpack": "webpack", + "build-ts": "tsc -p src/tsconfig.json || echo done. && tsc-alias -p src/tsconfig.json", "build-gulp": "gulp build", "watch": "concurrently \"npm:watch-*\"", "watch-webpack": "webpack --watch", + "watch-ts": "tsc -w -p src/tsconfig.json && tsc-alias -w -p src/tsconfig.json", "watch-gulp": "gulp watch", "clean": "gulp clean", "cleanall": "gulp cleanall", @@ -64,6 +66,9 @@ "@types/jsonld": "1.5.5", "@types/katex": "0.11.0", "@types/koa": "2.13.1", + "@types/koa__cors": "3.0.2", + "@types/koa__multer": "2.0.2", + "@types/koa__router": "8.0.4", "@types/koa-bodyparser": "4.3.0", "@types/koa-cors": "0.0.0", "@types/koa-favicon": "2.0.19", @@ -71,9 +76,6 @@ "@types/koa-mount": "4.0.0", "@types/koa-send": "4.1.2", "@types/koa-views": "2.0.4", - "@types/koa__cors": "3.0.2", - "@types/koa__multer": "2.0.2", - "@types/koa__router": "8.0.4", "@types/markdown-it": "12.0.1", "@types/matter-js": "0.14.10", "@types/mocha": "8.2.1", @@ -148,7 +150,6 @@ "gulp-replace": "1.0.0", "gulp-terser": "2.0.1", "gulp-tslint": "8.1.4", - "gulp-typescript": "6.0.0-alpha.1", "hard-source-webpack-plugin": "0.13.1", "html-minifier": "4.0.0", "http-proxy-agent": "4.0.1", @@ -234,6 +235,7 @@ "tmp": "0.2.1", "ts-loader": "8.0.18", "ts-node": "9.1.1", + "tsc-alias": "1.2.8", "tslint": "6.1.3", "tslint-sonarts": "1.9.0", "typeorm": "0.2.31", diff --git a/src/@types/meta.json.d.ts b/src/@types/meta.json.d.ts deleted file mode 100644 index ab812682b..000000000 --- a/src/@types/meta.json.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module '*/meta.json' { - const version: string; -} diff --git a/src/boot/master.ts b/src/boot/master.ts index aded10291..33ccec55d 100644 --- a/src/boot/master.ts +++ b/src/boot/master.ts @@ -12,7 +12,7 @@ import { lessThan } from '../prelude/array'; import { program } from '../argv'; import { showMachineInfo } from '../misc/show-machine-info'; import { initDb } from '../db/postgre'; -import * as meta from '../meta.json'; +const meta = require('../meta.json'); const logger = new Logger('core', 'cyan'); const bootLogger = logger.createSubLogger('boot', 'magenta', false); diff --git a/src/config/load.ts b/src/config/load.ts index 558bc68e1..0929e8041 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as yaml from 'js-yaml'; import { Source, Mixin } from './types'; -import * as meta from '../meta.json'; +const meta = require('../meta.json'); /** * Path of configuration directory diff --git a/assets/client/manifest.json b/src/server/web/manifest.json similarity index 100% rename from assets/client/manifest.json rename to src/server/web/manifest.json diff --git a/src/server/web/manifest.ts b/src/server/web/manifest.ts index 2f3eb8903..167230330 100644 --- a/src/server/web/manifest.ts +++ b/src/server/web/manifest.ts @@ -1,5 +1,5 @@ import * as Koa from 'koa'; -import * as manifest from '../../../assets/client/manifest.json'; +import * as manifest from './manifest.json'; import { fetchMeta } from '../../misc/fetch-meta'; module.exports = async (ctx: Koa.Context) => { diff --git a/src/tsconfig.json b/src/tsconfig.json index 95cb35fc5..527acb859 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -21,6 +21,9 @@ "emitDecoratorMetadata": true, "resolveJsonModule": true, "isolatedModules": true, + "rootDir": "./", + "baseUrl": "./", + "outDir": "../built", "typeRoots": [ "../node_modules/@types", "./@types" diff --git a/yarn.lock b/yarn.lock index eecd562aa..2cca0a7eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -239,6 +239,22 @@ resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.0-3.tgz#b658a7c1f35d4eb04ac85749da693be483442b25" integrity sha512-fCM7+R9M7Y/ipKC5n9hukGpJHhe53JOENGqtku/KWtpXsnbGik3AS5zfJYEupV2uXOw/5S0RSSfttQ2hNIrmFA== +"@jfonx/console-utils@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@jfonx/console-utils/-/console-utils-1.0.3.tgz#cbb7f911e4191a4a2fe1ba4807d29f100b5d099f" + integrity sha512-/XbnqjWc7yNZVLAJJO9rimfIz9DYte+cj3EF9hwhIv7vw6ok2t3cjl0huYsmD89srKH03vWjeqAcIH86CuYj3g== + dependencies: + colors "^1.3.3" + +"@jfonx/file-utils@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@jfonx/file-utils/-/file-utils-3.0.1.tgz#8d3d6e931a283420fe29802ea71c28dd397cd8d3" + integrity sha512-qwH0CuzWmghtTHGMyuPHj6SJPQgWeiXFJBfrxCWMbzxVCa3aLZPEfzSdlSnC/UABsk6feRkNdHXw59rVshNPqw== + dependencies: + "@jfonx/console-utils" "^1.0.3" + comment-json "^4.1.0" + find-up "^4.1.0" + "@koa/cors@3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-3.1.0.tgz#618bb073438cfdbd3ebd0e648a76e33b84f3a3b2" @@ -1707,6 +1723,11 @@ array-sort@^1.0.0: get-value "^2.0.6" kind-of "^5.0.2" +array-timsort@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-timsort/-/array-timsort-1.0.3.tgz#3c9e4199e54fb2b9c3fe5976396a21614ef0d926" + integrity sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -2453,7 +2474,7 @@ cheerio@^0.22.0: lodash.reject "^4.4.0" lodash.some "^4.4.0" -chokidar@3.5.1, "chokidar@>=2.0.0 <4.0.0", chokidar@^2.0.0, chokidar@^3.3.1: +chokidar@3.5.1, "chokidar@>=2.0.0 <4.0.0", chokidar@^2.0.0, chokidar@^3.3.1, chokidar@^3.5.0: version "3.3.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== @@ -2793,7 +2814,7 @@ commander@^2.12.1, commander@^2.19.0, commander@^2.20.0, commander@~2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^6.0.0: +commander@^6.0.0, commander@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== @@ -2803,6 +2824,17 @@ commander@^7.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2" integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA== +comment-json@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.1.0.tgz#09d08f0fbc4ad5eeccbac20f469adbb967dcbd2c" + integrity sha512-WEghmVYaNq9NlWbrkzQTSsya9ycLyxJxpTQfZEan6a5Jomnjw18zS3Podf8q1Zf9BvonvQd/+Z7Z39L7KKzzdQ== + dependencies: + array-timsort "^1.0.3" + core-util-is "^1.0.2" + esprima "^4.0.1" + has-own-prop "^2.0.0" + repeat-string "^1.6.1" + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2946,7 +2978,7 @@ core-js@3.9.1: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.9.1.tgz#cec8de593db8eb2a85ffb0dbdeb312cb6e5460ae" integrity sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg== -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= @@ -4259,6 +4291,14 @@ find-cache-dir@^2.0.0: make-dir "^2.0.0" pkg-dir "^3.0.0" +find-node-modules@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/find-node-modules/-/find-node-modules-2.1.2.tgz#57565a3455baf671b835bc6b2134a9b938b9c53c" + integrity sha512-x+3P4mbtRPlSiVE1Qco0Z4YLU8WFiFcuWTf3m75OV9Uzcfs2Bg+O9N+r/K0AnmINBW06KpfqKwYJbFlFq4qNug== + dependencies: + findup-sync "^4.0.0" + merge "^2.1.0" + find-up@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" @@ -4282,7 +4322,7 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -find-up@^4.0.0: +find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -4310,6 +4350,16 @@ findup-sync@^3.0.0: micromatch "^3.0.4" resolve-dir "^1.0.1" +findup-sync@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-4.0.0.tgz#956c9cdde804052b881b428512905c4a5f2cdef0" + integrity sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ== + dependencies: + detect-file "^1.0.0" + is-glob "^4.0.0" + micromatch "^4.0.2" + resolve-dir "^1.0.1" + fined@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/fined/-/fined-1.2.0.tgz#d00beccf1aa2b475d16d423b0238b713a2c4a37b" @@ -4652,6 +4702,18 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" +globby@^11.0.2: + version "11.0.3" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb" + integrity sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + glogg@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.2.tgz#2d7dd702beda22eb3bffadf880696da6d846313f" @@ -4764,18 +4826,6 @@ gulp-tslint@8.1.4: plugin-error "1.0.1" through "~2.3.8" -gulp-typescript@6.0.0-alpha.1: - version "6.0.0-alpha.1" - resolved "https://registry.yarnpkg.com/gulp-typescript/-/gulp-typescript-6.0.0-alpha.1.tgz#fcb0dbbc79c34201f0945c6323c194a8f5455a04" - integrity sha512-KoT0TTfjfT7w3JItHkgFH1T/zK4oXWC+a8xxKfniRfVcA0Fa1bKrIhztYelYmb+95RB80OLMBreknYkdwzdi2Q== - dependencies: - ansi-colors "^4.1.1" - plugin-error "^1.0.1" - source-map "^0.7.3" - through2 "^3.0.1" - vinyl "^2.2.0" - vinyl-fs "^3.0.3" - gulp@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/gulp/-/gulp-4.0.2.tgz#543651070fd0f6ab0a0650c6a3e6ff5a7cb09caa" @@ -4847,6 +4897,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-own-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" + integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== + has-symbols@^1.0.0, has-symbols@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" @@ -6533,6 +6588,11 @@ merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +merge@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-2.1.1.tgz#59ef4bf7e0b3e879186436e8481c06a6c162ca98" + integrity sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w== + methods@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -8689,7 +8749,7 @@ readable-stream@1.1.x: isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: +readable-stream@3, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -9503,7 +9563,7 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3, source-map@~0.7.2: +source-map@~0.7.2: version "0.7.3" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== @@ -10168,13 +10228,6 @@ through2@^2.0.0, through2@^2.0.3, through2@~2.0.0: readable-stream "~2.3.6" xtend "~4.0.1" -through2@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a" - integrity sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww== - dependencies: - readable-stream "2 || 3" - through2@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" @@ -10358,6 +10411,19 @@ ts-node@9.1.1: source-map-support "^0.5.17" yn "3.1.1" +tsc-alias@1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/tsc-alias/-/tsc-alias-1.2.8.tgz#d88bfce778c0b31d095a132209b4eefe7e16cc16" + integrity sha512-29WMSalu0cW/VuNeTEs/CPjz5z5Ae2ZBlTV0gjeoQwJNjZ5sDyPmu1C0rDmvOLPEJyo/iwqOMtNAlG17fEqBCw== + dependencies: + "@jfonx/console-utils" "^1.0.3" + "@jfonx/file-utils" "^3.0.1" + chokidar "^3.5.0" + commander "^6.2.1" + find-node-modules "^2.1.0" + globby "^11.0.2" + normalize-path "^3.0.0" + tslib@^1.13.0: version "1.13.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" @@ -10772,7 +10838,7 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vinyl-fs@^3.0.0, vinyl-fs@^3.0.3: +vinyl-fs@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.3.tgz#c85849405f67428feabbbd5c5dbdd64f47d31bc7" integrity sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng== @@ -10815,7 +10881,7 @@ vinyl-sourcemaps-apply@^0.2.1: dependencies: source-map "^0.5.1" -vinyl@^2.0.0, vinyl@^2.2.0: +vinyl@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg== From 8b327fbc82b3e8b2781fcffac28f002873775a04 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 23 Mar 2021 08:27:29 +0000 Subject: [PATCH 09/18] build(deps): bump webpack from 5.26.3 to 5.27.2 Bumps [webpack](https://github.com/webpack/webpack) from 5.26.3 to 5.27.2. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.26.3...v5.27.2) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 299fe4e5f..0e9e5191e 100644 --- a/package.json +++ b/package.json @@ -254,7 +254,7 @@ "vue-style-loader": "4.1.3", "vuedraggable": "4.0.1", "web-push": "3.4.4", - "webpack": "5.26.3", + "webpack": "5.27.2", "webpack-cli": "4.5.0", "websocket": "1.0.33", "ws": "7.4.4", diff --git a/yarn.lock b/yarn.lock index 2cca0a7eb..1ca450426 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11056,10 +11056,10 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@5.26.3: - version "5.26.3" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.26.3.tgz#bafd439abac08fbb82657ec855d038743b725ab8" - integrity sha512-z/F2lt2N1fZqaud1B4SzjL3OW03eULThbBXQ2OX4LSrZX4N9k1A5d0Rje3zS2g887DTWyAV0KGqEf64ois2dhg== +webpack@5.27.2: + version "5.27.2" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.27.2.tgz#44442219e1469ebe00292703b848580faae03f07" + integrity sha512-brNF3N/EdvMzkaZ/Xzb8sqPn5Si3iw6meqCnmNFtcnkorZsFZCBFMa2ElpIMjx6sKWYsnUpBO2dnX+7xgj+mjg== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" From d6e23b803b10a471bb5b1054b357c70a16e8f6da Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Mar 2021 17:30:14 +0900 Subject: [PATCH 10/18] refactor: Tweak path alias of client --- src/client/account.ts | 6 +- src/client/components/abuse-report-window.vue | 8 +-- src/client/components/analog-clock.vue | 2 +- src/client/components/autocomplete.vue | 8 +-- src/client/components/avatars.vue | 2 +- .../components/channel-follow-button.vue | 2 +- src/client/components/dialog.vue | 8 +-- .../components/drive-file-thumbnail.vue | 2 +- src/client/components/drive-select-dialog.vue | 4 +- src/client/components/drive-window.vue | 2 +- src/client/components/drive.file.vue | 6 +- src/client/components/drive.folder.vue | 2 +- src/client/components/drive.nav-folder.vue | 2 +- src/client/components/drive.vue | 2 +- src/client/components/emoji-picker-dialog.vue | 4 +- src/client/components/emoji-picker-window.vue | 4 +- .../components/emoji-picker.section.vue | 2 +- src/client/components/emoji-picker.vue | 12 ++-- src/client/components/featured-photos.vue | 2 +- src/client/components/file-type-icon.vue | 2 +- src/client/components/follow-button.vue | 2 +- src/client/components/form-dialog.vue | 2 +- src/client/components/form/pagination.vue | 2 +- src/client/components/form/radios.vue | 2 +- src/client/components/formula-core.vue | 2 +- src/client/components/formula.vue | 2 +- src/client/components/global/a.vue | 12 ++-- src/client/components/global/acct.vue | 2 +- src/client/components/global/avatar.vue | 6 +- src/client/components/global/emoji.vue | 4 +- src/client/components/global/error.vue | 2 +- src/client/components/global/loading.vue | 2 +- .../global/misskey-flavored-markdown.vue | 2 +- src/client/components/global/url.vue | 8 +-- src/client/components/google.vue | 2 +- src/client/components/image-viewer.vue | 6 +- src/client/components/instance-stats.vue | 4 +- src/client/components/instance-ticker.vue | 2 +- src/client/components/launch-pad.vue | 6 +- src/client/components/link.vue | 8 +-- src/client/components/media-banner.vue | 4 +- src/client/components/media-image.vue | 6 +- src/client/components/media-list.vue | 2 +- src/client/components/media-video.vue | 2 +- src/client/components/mention.vue | 4 +- src/client/components/mfm.ts | 24 ++++---- src/client/components/mini-chart.vue | 2 +- src/client/components/note-detailed.vue | 24 ++++---- src/client/components/note-header.vue | 2 +- src/client/components/note-preview.vue | 2 +- src/client/components/note.sub.vue | 2 +- src/client/components/note.vue | 24 ++++---- src/client/components/notes.vue | 4 +- .../notification-setting-window.vue | 2 +- src/client/components/notification.vue | 4 +- src/client/components/notifications.vue | 4 +- src/client/components/page-preview.vue | 2 +- src/client/components/page-window.vue | 12 ++-- src/client/components/page/page.block.vue | 4 +- src/client/components/page/page.button.vue | 6 +- src/client/components/page/page.canvas.vue | 6 +- src/client/components/page/page.counter.vue | 6 +- src/client/components/page/page.if.vue | 4 +- src/client/components/page/page.image.vue | 6 +- src/client/components/page/page.note.vue | 8 +-- .../components/page/page.number-input.vue | 6 +- src/client/components/page/page.post.vue | 8 +-- .../components/page/page.radio-button.vue | 6 +- src/client/components/page/page.section.vue | 6 +- src/client/components/page/page.switch.vue | 6 +- .../components/page/page.text-input.vue | 6 +- src/client/components/page/page.text.vue | 6 +- .../components/page/page.textarea-input.vue | 8 +-- src/client/components/page/page.textarea.vue | 4 +- src/client/components/page/page.vue | 8 +-- src/client/components/poll.vue | 2 +- src/client/components/post-form-attaches.vue | 2 +- src/client/components/post-form-dialog.vue | 4 +- src/client/components/post-form.vue | 12 ++-- .../components/reactions-viewer.reaction.vue | 6 +- src/client/components/remote-caution.vue | 2 +- src/client/components/sample.vue | 14 ++--- src/client/components/sidebar.vue | 10 ++-- src/client/components/signin-dialog.vue | 2 +- src/client/components/signin.vue | 8 +-- src/client/components/signup-dialog.vue | 2 +- src/client/components/signup.vue | 6 +- src/client/components/sub-note-content.vue | 2 +- .../components/taskmanager.api-window.vue | 4 +- src/client/components/taskmanager.vue | 10 ++-- src/client/components/timeline.vue | 4 +- .../components/token-generate-window.vue | 2 +- src/client/components/ui/context-menu.vue | 2 +- src/client/components/ui/hr.vue | 2 +- src/client/components/ui/info.vue | 2 +- src/client/components/ui/input.vue | 2 +- src/client/components/ui/menu.vue | 4 +- src/client/components/ui/pagination.vue | 2 +- src/client/components/ui/radios.vue | 2 +- src/client/components/ui/window.vue | 4 +- src/client/components/url-preview-popup.vue | 2 +- src/client/components/url-preview.vue | 4 +- src/client/components/user-list.vue | 2 +- src/client/components/user-preview.vue | 2 +- src/client/components/user-select-dialog.vue | 4 +- src/client/components/users-dialog.vue | 2 +- src/client/components/visibility-picker.vue | 2 +- src/client/components/waiting-dialog.vue | 2 +- src/client/components/widgets.vue | 6 +- src/client/directives/follow-append.ts | 2 +- src/client/directives/particle.ts | 4 +- src/client/directives/tooltip.ts | 6 +- src/client/directives/user-preview.ts | 4 +- src/client/filters/user.ts | 2 +- src/client/i18n.ts | 2 +- src/client/init.ts | 56 +++++++++---------- src/client/os.ts | 38 ++++++------- src/client/pages/_error_.vue | 2 +- src/client/pages/_loading_.vue | 2 +- src/client/pages/about-misskey.vue | 16 +++--- src/client/pages/about.vue | 14 ++--- src/client/pages/advanced-theme-editor.vue | 24 ++++---- src/client/pages/announcements.vue | 6 +- src/client/pages/api-console.vue | 10 ++-- src/client/pages/auth.form.vue | 4 +- src/client/pages/auth.vue | 6 +- src/client/pages/channel-editor.vue | 10 ++-- src/client/pages/channel.vue | 10 ++-- src/client/pages/channels.vue | 8 +-- src/client/pages/clip.vue | 8 +-- src/client/pages/doc.vue | 4 +- src/client/pages/docs.vue | 2 +- src/client/pages/drive.vue | 4 +- src/client/pages/explore.vue | 10 ++-- src/client/pages/favorites.vue | 6 +- src/client/pages/featured.vue | 4 +- src/client/pages/follow-requests.vue | 4 +- src/client/pages/follow.vue | 2 +- src/client/pages/instance/abuses.vue | 10 ++-- src/client/pages/instance/announcements.vue | 8 +-- .../pages/instance/emoji-edit-dialog.vue | 8 +-- src/client/pages/instance/emojis.vue | 12 ++-- src/client/pages/instance/federation.vue | 10 ++-- src/client/pages/instance/file-dialog.vue | 14 ++--- src/client/pages/instance/files.vue | 14 ++--- src/client/pages/instance/index.metrics.vue | 14 ++--- src/client/pages/instance/index.vue | 16 +++--- src/client/pages/instance/instance.vue | 14 ++--- src/client/pages/instance/logs.vue | 10 ++-- src/client/pages/instance/queue.chart.vue | 2 +- src/client/pages/instance/queue.vue | 4 +- src/client/pages/instance/relays.vue | 6 +- src/client/pages/instance/settings.vue | 18 +++--- src/client/pages/instance/user-dialog.vue | 10 ++-- src/client/pages/instance/users.vue | 10 ++-- src/client/pages/mentions.vue | 4 +- src/client/pages/messages.vue | 4 +- src/client/pages/messaging/index.vue | 4 +- .../pages/messaging/messaging-room.form.vue | 6 +- .../messaging/messaging-room.message.vue | 4 +- src/client/pages/messaging/messaging-room.vue | 10 ++-- src/client/pages/mfm-cheat-sheet.vue | 2 +- src/client/pages/miauth.vue | 8 +-- .../pages/my-antennas/index.antenna.vue | 12 ++-- src/client/pages/my-antennas/index.vue | 4 +- src/client/pages/my-clips/index.vue | 6 +- src/client/pages/my-groups/group.vue | 6 +- src/client/pages/my-groups/index.vue | 12 ++-- src/client/pages/my-lists/index.vue | 6 +- src/client/pages/my-lists/list.vue | 6 +- src/client/pages/not-found.vue | 2 +- src/client/pages/note.vue | 12 ++-- src/client/pages/notifications.vue | 6 +- .../page-editor/els/page-editor.el.button.vue | 8 +-- .../page-editor/els/page-editor.el.canvas.vue | 4 +- .../els/page-editor.el.counter.vue | 4 +- .../page-editor/els/page-editor.el.if.vue | 4 +- .../page-editor/els/page-editor.el.image.vue | 4 +- .../page-editor/els/page-editor.el.note.vue | 10 ++-- .../els/page-editor.el.number-input.vue | 4 +- .../page-editor/els/page-editor.el.post.vue | 8 +-- .../els/page-editor.el.radio-button.vue | 6 +- .../els/page-editor.el.section.vue | 2 +- .../page-editor/els/page-editor.el.switch.vue | 6 +- .../els/page-editor.el.text-input.vue | 4 +- .../page-editor/els/page-editor.el.text.vue | 2 +- .../els/page-editor.el.textarea-input.vue | 6 +- .../els/page-editor.el.textarea.vue | 2 +- .../pages/page-editor/page-editor.blocks.vue | 2 +- .../page-editor/page-editor.script-block.vue | 10 ++-- src/client/pages/page-editor/page-editor.vue | 24 ++++---- src/client/pages/page.vue | 4 +- src/client/pages/pages.vue | 8 +-- src/client/pages/preview.vue | 2 +- src/client/pages/reversi/game.board.vue | 10 ++-- src/client/pages/reversi/game.setting.vue | 6 +- src/client/pages/reversi/game.vue | 2 +- src/client/pages/reversi/index.vue | 6 +- src/client/pages/room/preview.vue | 2 +- src/client/pages/room/room.vue | 14 ++--- src/client/pages/scratchpad.vue | 8 +-- src/client/pages/search.vue | 4 +- src/client/pages/settings/2fa.vue | 20 +++---- src/client/pages/settings/account-info.vue | 20 +++---- src/client/pages/settings/api.vue | 16 +++--- src/client/pages/settings/apps.vue | 14 ++--- src/client/pages/settings/deck.vue | 18 +++--- src/client/pages/settings/drive.vue | 12 ++-- src/client/pages/settings/email-address.vue | 10 ++-- .../pages/settings/email-notification.vue | 10 ++-- src/client/pages/settings/email.vue | 12 ++-- .../pages/settings/experimental-features.vue | 16 +++--- src/client/pages/settings/general.vue | 26 ++++----- src/client/pages/settings/import-export.vue | 12 ++-- src/client/pages/settings/index.vue | 16 +++--- src/client/pages/settings/integration.vue | 8 +-- src/client/pages/settings/mute-block.vue | 16 +++--- src/client/pages/settings/notifications.vue | 12 ++-- src/client/pages/settings/other.vue | 24 ++++---- src/client/pages/settings/plugin.install.vue | 24 ++++---- src/client/pages/settings/plugin.manage.vue | 18 +++--- src/client/pages/settings/plugin.vue | 10 ++-- src/client/pages/settings/privacy.vue | 12 ++-- src/client/pages/settings/profile.vue | 20 +++---- src/client/pages/settings/reaction.vue | 14 ++--- src/client/pages/settings/registry.keys.vue | 18 +++--- src/client/pages/settings/registry.value.vue | 18 +++--- src/client/pages/settings/registry.vue | 18 +++--- src/client/pages/settings/security.vue | 12 ++-- src/client/pages/settings/sidebar.vue | 18 +++--- src/client/pages/settings/sounds.vue | 16 +++--- src/client/pages/settings/theme.install.vue | 22 ++++---- src/client/pages/settings/theme.manage.vue | 24 ++++---- src/client/pages/settings/theme.vue | 26 ++++----- src/client/pages/settings/update.vue | 20 +++---- src/client/pages/settings/word-mute.vue | 16 +++--- src/client/pages/share.vue | 6 +- src/client/pages/tag.vue | 4 +- src/client/pages/test.vue | 12 ++-- src/client/pages/theme-editor.vue | 18 +++--- src/client/pages/timeline.tutorial.vue | 2 +- src/client/pages/timeline.vue | 10 ++-- src/client/pages/user/clips.vue | 2 +- src/client/pages/user/follow-list.vue | 4 +- src/client/pages/user/index.activity.vue | 4 +- src/client/pages/user/index.photos.vue | 6 +- src/client/pages/user/index.timeline.vue | 6 +- src/client/pages/user/index.vue | 20 +++---- src/client/pages/user/pages.vue | 4 +- src/client/pages/v.vue | 2 +- src/client/pages/welcome.entrance.a.vue | 16 +++--- src/client/pages/welcome.entrance.b.vue | 16 +++--- src/client/pages/welcome.entrance.c.vue | 16 +++--- src/client/pages/welcome.setup.vue | 10 ++-- src/client/pages/welcome.timeline.vue | 4 +- src/client/pages/welcome.vue | 4 +- src/client/plugin.ts | 6 +- src/client/router.ts | 6 +- src/client/scripts/aiscript/api.ts | 4 +- src/client/scripts/autocomplete.ts | 4 +- src/client/scripts/gen-search-query.ts | 2 +- src/client/scripts/get-static-image-url.ts | 2 +- src/client/scripts/get-user-menu.ts | 16 +++--- src/client/scripts/hpml/evaluator.ts | 4 +- src/client/scripts/initialize-sw.ts | 8 +-- src/client/scripts/paging.ts | 2 +- src/client/scripts/please-login.ts | 6 +- src/client/scripts/popout.ts | 2 +- src/client/scripts/reaction-picker.ts | 4 +- src/client/scripts/search.ts | 6 +- src/client/scripts/select-file.ts | 4 +- src/client/scripts/sound.ts | 2 +- src/client/scripts/stream.ts | 2 +- src/client/sidebar.ts | 8 +-- src/client/sw/sw.ts | 2 +- src/client/theme-store.ts | 4 +- src/client/tsconfig.json | 3 +- src/client/ui/_common_/common.vue | 8 +-- src/client/ui/_common_/stream-indicator.vue | 2 +- src/client/ui/_common_/upload.vue | 2 +- src/client/ui/chat/header-clock.vue | 2 +- src/client/ui/chat/index.vue | 14 ++--- src/client/ui/chat/note-header.vue | 6 +- src/client/ui/chat/note-preview.vue | 4 +- src/client/ui/chat/note.sub.vue | 4 +- src/client/ui/chat/note.vue | 32 +++++------ src/client/ui/chat/notes.vue | 4 +- src/client/ui/chat/post-form.vue | 18 +++--- src/client/ui/chat/side.vue | 8 +-- src/client/ui/chat/sub-note-content.vue | 6 +- src/client/ui/chat/timeline.vue | 10 ++-- src/client/ui/chat/widgets.vue | 2 +- src/client/ui/deck.vue | 12 ++-- src/client/ui/deck/antenna-column.vue | 4 +- src/client/ui/deck/column.vue | 2 +- src/client/ui/deck/deck-store.ts | 4 +- src/client/ui/deck/direct-column.vue | 6 +- src/client/ui/deck/list-column.vue | 4 +- src/client/ui/deck/main-column.vue | 8 +-- src/client/ui/deck/mentions-column.vue | 6 +- src/client/ui/deck/notifications-column.vue | 6 +- src/client/ui/deck/tl-column.vue | 4 +- src/client/ui/deck/widgets-column.vue | 2 +- src/client/ui/default.side.vue | 8 +-- src/client/ui/default.vue | 10 ++-- src/client/ui/default.widgets.vue | 4 +- src/client/ui/desktop.vue | 12 ++-- src/client/ui/visitor/a.vue | 12 ++-- src/client/ui/visitor/b.vue | 16 +++--- src/client/ui/visitor/header.vue | 8 +-- src/client/ui/visitor/kanban.vue | 12 ++-- src/client/ui/zen.vue | 2 +- src/client/widgets/activity.calendar.vue | 2 +- src/client/widgets/activity.chart.vue | 2 +- src/client/widgets/activity.vue | 4 +- src/client/widgets/aiscript.vue | 6 +- src/client/widgets/button.vue | 6 +- src/client/widgets/calendar.vue | 2 +- src/client/widgets/clock.vue | 6 +- src/client/widgets/define.ts | 4 +- src/client/widgets/digital-clock.vue | 2 +- src/client/widgets/federation.vue | 6 +- src/client/widgets/job-queue.vue | 4 +- src/client/widgets/memo.vue | 4 +- src/client/widgets/notifications.vue | 8 +-- src/client/widgets/online-users.vue | 2 +- src/client/widgets/photos.vue | 6 +- src/client/widgets/post-form.vue | 2 +- src/client/widgets/rss.vue | 4 +- src/client/widgets/server-metric/disk.vue | 2 +- src/client/widgets/server-metric/index.vue | 4 +- src/client/widgets/server-metric/mem.vue | 2 +- src/client/widgets/server-metric/net.vue | 2 +- src/client/widgets/slideshow.vue | 2 +- src/client/widgets/timeline.vue | 6 +- src/client/widgets/trends.vue | 6 +- src/tsconfig.json | 3 + webpack.config.ts | 3 +- 338 files changed, 1234 insertions(+), 1229 deletions(-) diff --git a/src/client/account.ts b/src/client/account.ts index e5b451cf1..6f06ee0f3 100644 --- a/src/client/account.ts +++ b/src/client/account.ts @@ -1,7 +1,7 @@ import { reactive } from 'vue'; -import { apiUrl } from '@/config'; -import { waiting } from '@/os'; -import { unisonReload } from '@/scripts/unison-reload'; +import { apiUrl } from '@client/config'; +import { waiting } from '@client/os'; +import { unisonReload } from '@client/scripts/unison-reload'; // TODO: 他のタブと永続化されたstateを同期 diff --git a/src/client/components/abuse-report-window.vue b/src/client/components/abuse-report-window.vue index 98578ee44..7dbb9657b 100644 --- a/src/client/components/abuse-report-window.vue +++ b/src/client/components/abuse-report-window.vue @@ -29,10 +29,10 @@ diff --git a/src/client/components/ui/info.vue b/src/client/components/ui/info.vue index 5c71b14a0..12b3dbcfd 100644 --- a/src/client/components/ui/info.vue +++ b/src/client/components/ui/info.vue @@ -9,7 +9,7 @@ diff --git a/src/client/pages/about-misskey.vue b/src/client/pages/about-misskey.vue index a52678e3c..2d1da88fa 100644 --- a/src/client/pages/about-misskey.vue +++ b/src/client/pages/about-misskey.vue @@ -55,14 +55,14 @@ import { defineComponent } from 'vue'; import { faInfoCircle, faCode, faLanguage, faHandHoldingMedical, } from '@fortawesome/free-solid-svg-icons'; import VanillaTilt from 'vanilla-tilt'; -import { version } from '@/config'; -import FormLink from '@/components/form/link.vue'; -import FormBase from '@/components/form/base.vue'; -import FormGroup from '@/components/form/group.vue'; -import FormKeyValueView from '@/components/form/key-value-view.vue'; -import MkLink from '@/components/link.vue'; -import { physics } from '@/scripts/physics.ts'; -import * as os from '@/os'; +import { version } from '@client/config'; +import FormLink from '@client/components/form/link.vue'; +import FormBase from '@client/components/form/base.vue'; +import FormGroup from '@client/components/form/group.vue'; +import FormKeyValueView from '@client/components/form/key-value-view.vue'; +import MkLink from '@client/components/link.vue'; +import { physics } from '@client/scripts/physics.ts'; +import * as os from '@client/os'; const patrons = [ 'Satsuki Yanagi', diff --git a/src/client/pages/about.vue b/src/client/pages/about.vue index 6ec74bc96..911fc0bc6 100644 --- a/src/client/pages/about.vue +++ b/src/client/pages/about.vue @@ -41,13 +41,13 @@