diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-04-04 08:46:54 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-04-04 08:46:54 +0900 |
| commit | d4a630902d8d250b67fcd0ce2b49240786b40368 (patch) | |
| tree | b87395691e52e3b86ce40196993d492c694c5e79 /src/server | |
| parent | enhance(server): Log error message when internal error occured (diff) | |
| download | sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.gz sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.bz2 sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.zip | |
refactor: Use ===
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/activitypub/outbox.ts | 2 | ||||
| -rw-r--r-- | src/server/api/2fa.ts | 2 | ||||
| -rw-r--r-- | src/server/api/api-handler.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/admin/drive/files.ts | 4 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update.ts | 16 | ||||
| -rw-r--r-- | src/server/api/streaming.ts | 2 | ||||
| -rw-r--r-- | src/server/index.ts | 2 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/server/activitypub/outbox.ts b/src/server/activitypub/outbox.ts index aa6053d479..fc2a19da4a 100644 --- a/src/server/activitypub/outbox.ts +++ b/src/server/activitypub/outbox.ts @@ -101,7 +101,7 @@ export default async (ctx: Router.RouterContext) => { * @param note Note */ export async function packActivity(note: Note): Promise<any> { - if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length == 0)) { + if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) { const renote = await Notes.findOne(note.renoteId).then(ensure); return renderAnnounce(renote.uri ? renote.uri : `${config.url}/notes/${renote.id}`, note); } diff --git a/src/server/api/2fa.ts b/src/server/api/2fa.ts index 3bc4627a62..8e6e635bb0 100644 --- a/src/server/api/2fa.ts +++ b/src/server/api/2fa.ts @@ -78,7 +78,7 @@ function verifyCertificateChain(certificates: string[]) { } function PEMString(pemBuffer: Buffer, type = 'CERTIFICATE') { - if (pemBuffer.length == 65 && pemBuffer[0] == 0x04) { + if (pemBuffer.length === 65 && pemBuffer[0] === 0x04) { pemBuffer = Buffer.concat([PEM_PRELUDE, pemBuffer], 91); type = 'PUBLIC KEY'; } diff --git a/src/server/api/api-handler.ts b/src/server/api/api-handler.ts index b147bca143..7fbc200fc0 100644 --- a/src/server/api/api-handler.ts +++ b/src/server/api/api-handler.ts @@ -34,7 +34,7 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { call(endpoint.name, user, app, body, (ctx as any).file).then((res: any) => { reply(res); }).catch((e: ApiError) => { - reply(e.httpStatusCode ? e.httpStatusCode : e.kind == 'client' ? 400 : 500, e); + reply(e.httpStatusCode ? e.httpStatusCode : e.kind === 'client' ? 400 : 500, e); }); }).catch(() => { reply(403, new ApiError({ diff --git a/src/server/api/endpoints/admin/drive/files.ts b/src/server/api/endpoints/admin/drive/files.ts index 776aec9ec6..c5a91db854 100644 --- a/src/server/api/endpoints/admin/drive/files.ts +++ b/src/server/api/endpoints/admin/drive/files.ts @@ -51,8 +51,8 @@ const sort: any = { // < https://github.com/Microsoft/TypeScript/issues/1863 export default define(meta, async (ps, me) => { const q = {} as any; - if (ps.origin == 'local') q['userHost'] = null; - if (ps.origin == 'remote') q['userHost'] = { $ne: null }; + if (ps.origin === 'local') q['userHost'] = null; + if (ps.origin === 'remote') q['userHost'] = { $ne: null }; const files = await DriveFiles.find({ where: q, diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index c90f050251..b33948ee0e 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -193,14 +193,14 @@ export default define(meta, async (ps, user, token) => { if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday; if (ps.avatarId !== undefined) updates.avatarId = ps.avatarId; if (ps.bannerId !== undefined) updates.bannerId = ps.bannerId; - if (typeof ps.isLocked == 'boolean') updates.isLocked = ps.isLocked; - if (typeof ps.isBot == 'boolean') updates.isBot = ps.isBot; - if (typeof ps.carefulBot == 'boolean') profileUpdates.carefulBot = ps.carefulBot; - if (typeof ps.autoAcceptFollowed == 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed; - if (typeof ps.isCat == 'boolean') updates.isCat = ps.isCat; - if (typeof ps.autoWatch == 'boolean') profileUpdates.autoWatch = ps.autoWatch; - if (typeof ps.injectFeaturedNote == 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote; - if (typeof ps.alwaysMarkNsfw == 'boolean') profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw; + if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked; + if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot; + if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot; + if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed; + if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat; + if (typeof ps.autoWatch === 'boolean') profileUpdates.autoWatch = ps.autoWatch; + if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote; + if (typeof ps.alwaysMarkNsfw === 'boolean') profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw; if (ps.avatarId) { const avatar = await DriveFiles.findOne(ps.avatarId); diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index 6c6037db25..07869f9cbc 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -54,7 +54,7 @@ module.exports = (server: http.Server) => { }); connection.on('message', async (data) => { - if (data.utf8Data == 'ping') { + if (data.utf8Data === 'ping') { connection.send('pong'); } }); diff --git a/src/server/index.ts b/src/server/index.ts index b4652d01b7..81c70ea518 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -150,7 +150,7 @@ export default () => new Promise(resolve => { // Bulk write setInterval(() => { - if (queue.length == 0) return; + if (queue.length === 0) return; const requests = queue.length; const time = sum(queue.map(x => x.time)); |