summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-04-04 08:46:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-04-04 08:46:54 +0900
commitd4a630902d8d250b67fcd0ce2b49240786b40368 (patch)
treeb87395691e52e3b86ce40196993d492c694c5e79 /src
parentenhance(server): Log error message when internal error occured (diff)
downloadsharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.gz
sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.bz2
sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.zip
refactor: Use ===
Diffstat (limited to 'src')
-rw-r--r--src/boot/master.ts2
-rw-r--r--src/client/app.vue4
-rw-r--r--src/client/mios.ts2
-rw-r--r--src/client/scripts/hotkey.ts6
-rw-r--r--src/client/scripts/keycode.ts2
-rw-r--r--src/client/scripts/paging.ts2
-rw-r--r--src/client/scripts/search.ts4
-rw-r--r--src/client/scripts/stream.ts6
-rw-r--r--src/client/store.ts2
-rw-r--r--src/client/widgets/activity.calendar.vue6
-rw-r--r--src/client/widgets/activity.vue4
-rw-r--r--src/client/widgets/calendar.vue4
-rw-r--r--src/client/widgets/photos.vue4
-rw-r--r--src/config/load.ts2
-rw-r--r--src/games/reversi/core.ts4
-rw-r--r--src/mfm/fromHtml.ts10
-rw-r--r--src/mfm/language.ts4
-rw-r--r--src/mfm/normalize.ts2
-rw-r--r--src/mfm/parse.ts4
-rw-r--r--src/models/repositories/note.ts2
-rw-r--r--src/remote/activitypub/kernel/accept/follow.ts2
-rw-r--r--src/remote/activitypub/kernel/follow.ts2
-rw-r--r--src/remote/activitypub/kernel/reject/follow.ts2
-rw-r--r--src/remote/activitypub/kernel/undo/block.ts2
-rw-r--r--src/remote/activitypub/kernel/undo/follow.ts2
-rw-r--r--src/remote/activitypub/models/note.ts2
-rw-r--r--src/remote/activitypub/models/person.ts4
-rw-r--r--src/remote/activitypub/models/question.ts2
-rw-r--r--src/remote/activitypub/renderer/announce.ts4
-rw-r--r--src/remote/activitypub/renderer/note.ts6
-rw-r--r--src/server/activitypub/outbox.ts2
-rw-r--r--src/server/api/2fa.ts2
-rw-r--r--src/server/api/api-handler.ts2
-rw-r--r--src/server/api/endpoints/admin/drive/files.ts4
-rw-r--r--src/server/api/endpoints/i/update.ts16
-rw-r--r--src/server/api/streaming.ts2
-rw-r--r--src/server/index.ts2
-rw-r--r--src/services/push-notification.ts2
38 files changed, 68 insertions, 68 deletions
diff --git a/src/boot/master.ts b/src/boot/master.ts
index 39d1981956..f1a8b9f6ae 100644
--- a/src/boot/master.ts
+++ b/src/boot/master.ts
@@ -99,7 +99,7 @@ async function isPortAvailable(port: number): Promise<boolean> {
function showEnvironment(): void {
const env = process.env.NODE_ENV;
const logger = bootLogger.createSubLogger('env');
- logger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
+ logger.info(typeof env === 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
if (env !== 'production') {
logger.warn('The environment is not in production mode.');
diff --git a/src/client/app.vue b/src/client/app.vue
index fc40b6973a..5523e1e758 100644
--- a/src/client/app.vue
+++ b/src/client/app.vue
@@ -310,7 +310,7 @@ export default Vue.extend({
title: this.$t('search'),
input: true
}).then(async ({ canceled, result: query }) => {
- if (canceled || query == null || query == '') return;
+ if (canceled || query == null || query === '') return;
this.searching = true;
search(this, query).finally(() => {
@@ -320,7 +320,7 @@ export default Vue.extend({
},
searchKeypress(e) {
- if (e.keyCode == 13) {
+ if (e.keyCode === 13) {
this.searchWait = true;
search(this, this.searchQuery).finally(() => {
this.searchWait = false;
diff --git a/src/client/mios.ts b/src/client/mios.ts
index 63d9f7d3a0..ba42f3a161 100644
--- a/src/client/mios.ts
+++ b/src/client/mios.ts
@@ -197,7 +197,7 @@ export default class MiOS extends EventEmitter {
// When subscribe failed
.catch(async (err: Error) => {
// 通知が許可されていなかったとき
- if (err.name == 'NotAllowedError') {
+ if (err.name === 'NotAllowedError') {
return;
}
diff --git a/src/client/scripts/hotkey.ts b/src/client/scripts/hotkey.ts
index 672dbedde1..7d1bb16e79 100644
--- a/src/client/scripts/hotkey.ts
+++ b/src/client/scripts/hotkey.ts
@@ -57,9 +57,9 @@ const ignoreElemens = ['input', 'textarea'];
function match(e: KeyboardEvent, patterns: action['patterns']): boolean {
const key = e.code.toLowerCase();
return patterns.some(pattern => pattern.which.includes(key) &&
- pattern.ctrl == e.ctrlKey &&
- pattern.shift == e.shiftKey &&
- pattern.alt == e.altKey &&
+ pattern.ctrl === e.ctrlKey &&
+ pattern.shift === e.shiftKey &&
+ pattern.alt === e.altKey &&
!e.metaKey
);
}
diff --git a/src/client/scripts/keycode.ts b/src/client/scripts/keycode.ts
index 5786c1dc0a..c127d54bb2 100644
--- a/src/client/scripts/keycode.ts
+++ b/src/client/scripts/keycode.ts
@@ -1,5 +1,5 @@
export default (input: string): string[] => {
- if (Object.keys(aliases).some(a => a.toLowerCase() == input.toLowerCase())) {
+ if (Object.keys(aliases).some(a => a.toLowerCase() === input.toLowerCase())) {
const codes = aliases[input];
return Array.isArray(codes) ? codes : [codes];
} else {
diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts
index 1656e263fb..048c797753 100644
--- a/src/client/scripts/paging.ts
+++ b/src/client/scripts/paging.ts
@@ -20,7 +20,7 @@ export default (opts) => ({
computed: {
empty(): boolean {
- return this.items.length == 0 && !this.fetching && this.inited;
+ return this.items.length === 0 && !this.fetching && this.inited;
},
error(): boolean {
diff --git a/src/client/scripts/search.ts b/src/client/scripts/search.ts
index 02dd39b035..16057dfd34 100644
--- a/src/client/scripts/search.ts
+++ b/src/client/scripts/search.ts
@@ -47,9 +47,9 @@ export async function search(v: any, q: string) {
uri: q
});
dialog.close();
- if (res.type == 'User') {
+ if (res.type === 'User') {
v.$router.push(`/@${res.object.username}@${res.object.host}`);
- } else if (res.type == 'Note') {
+ } else if (res.type === 'Note') {
v.$router.push(`/notes/${res.object.id}`);
}
} catch (e) {
diff --git a/src/client/scripts/stream.ts b/src/client/scripts/stream.ts
index 18bb7c13df..4dcd3f1b2e 100644
--- a/src/client/scripts/stream.ts
+++ b/src/client/scripts/stream.ts
@@ -68,7 +68,7 @@ export default class Stream extends EventEmitter {
*/
@autobind
private onOpen() {
- const isReconnect = this.state == 'reconnecting';
+ const isReconnect = this.state === 'reconnecting';
this.state = 'connected';
this.emit('_connected_');
@@ -87,7 +87,7 @@ export default class Stream extends EventEmitter {
*/
@autobind
private onClose() {
- if (this.state == 'connected') {
+ if (this.state === 'connected') {
this.state = 'reconnecting';
this.emit('_disconnected_');
}
@@ -100,7 +100,7 @@ export default class Stream extends EventEmitter {
private onMessage(message) {
const { type, body } = JSON.parse(message.data);
- if (type == 'channel') {
+ if (type === 'channel') {
const id = body.id;
let connections: Connection[];
diff --git a/src/client/store.ts b/src/client/store.ts
index 5e98092c23..b2aea38391 100644
--- a/src/client/store.ts
+++ b/src/client/store.ts
@@ -257,7 +257,7 @@ export default () => new Vuex.Store({
},
updateWidget(state, x) {
- const w = state.widgets.find(w => w.id == x.id);
+ const w = state.widgets.find(w => w.id === x.id);
if (w) {
w.data = x.data;
}
diff --git a/src/client/widgets/activity.calendar.vue b/src/client/widgets/activity.calendar.vue
index dfc0d29d3b..334c2ea56e 100644
--- a/src/client/widgets/activity.calendar.vue
+++ b/src/client/widgets/activity.calendar.vue
@@ -51,14 +51,14 @@ export default Vue.extend({
weekday: date.getDay()
};
- d.v = peak == 0 ? 0 : d.total / (peak / 2);
+ d.v = peak === 0 ? 0 : d.total / (peak / 2);
if (d.v > 1) d.v = 1;
- const ch = d.date.weekday == 0 || d.date.weekday == 6 ? 275 : 170;
+ const ch = d.date.weekday === 0 || d.date.weekday === 6 ? 275 : 170;
const cs = d.v * 100;
const cl = 15 + ((1 - d.v) * 80);
d.color = `hsl(${ch}, ${cs}%, ${cl}%)`;
- if (d.date.weekday == 0) x--;
+ if (d.date.weekday === 0) x--;
});
}
});
diff --git a/src/client/widgets/activity.vue b/src/client/widgets/activity.vue
index e08676c9a0..6c32642bb6 100644
--- a/src/client/widgets/activity.vue
+++ b/src/client/widgets/activity.vue
@@ -60,7 +60,7 @@ export default define({
},
methods: {
func() {
- if (this.props.design == 2) {
+ if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;
@@ -68,7 +68,7 @@ export default define({
this.save();
},
toggleView() {
- if (this.props.view == 1) {
+ if (this.props.view === 1) {
this.props.view = 0;
} else {
this.props.view++;
diff --git a/src/client/widgets/calendar.vue b/src/client/widgets/calendar.vue
index b7d577c37d..c041734a4d 100644
--- a/src/client/widgets/calendar.vue
+++ b/src/client/widgets/calendar.vue
@@ -65,7 +65,7 @@ export default define({
},
methods: {
func() {
- if (this.props.design == 2) {
+ if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;
@@ -102,7 +102,7 @@ export default define({
this.monthP = monthNumer / monthDenom * 100;
this.yearP = yearNumer / yearDenom * 100;
- this.isHoliday = now.getDay() == 0 || now.getDay() == 6;
+ this.isHoliday = now.getDay() === 0 || now.getDay() === 6;
}
}
});
diff --git a/src/client/widgets/photos.vue b/src/client/widgets/photos.vue
index fb2e6de0be..1deb6de62d 100644
--- a/src/client/widgets/photos.vue
+++ b/src/client/widgets/photos.vue
@@ -1,6 +1,6 @@
<template>
<div>
- <mk-container :show-header="props.design === 0" :naked="props.design === 2" :class="$style.root" :data-melt="props.design == 2">
+ <mk-container :show-header="props.design === 0" :naked="props.design === 2" :class="$style.root" :data-melt="props.design === 2">
<template #header><fa :icon="faCamera"/>{{ $t('_widgets.photos') }}</template>
<div class="">
@@ -66,7 +66,7 @@ export default define({
},
func() {
- if (this.props.design == 2) {
+ if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;
diff --git a/src/config/load.ts b/src/config/load.ts
index 3c07494e92..035a43ef21 100644
--- a/src/config/load.ts
+++ b/src/config/load.ts
@@ -15,7 +15,7 @@ const dir = `${__dirname}/../../.config`;
/**
* Path of configuration file
*/
-const path = process.env.NODE_ENV == 'test'
+const path = process.env.NODE_ENV === 'test'
? `${dir}/test.yml`
: `${dir}/default.yml`;
diff --git a/src/games/reversi/core.ts b/src/games/reversi/core.ts
index 09d23e2b70..e7ae1af7a2 100644
--- a/src/games/reversi/core.ts
+++ b/src/games/reversi/core.ts
@@ -226,10 +226,10 @@ export default class Reversi {
// 座標が指し示す位置がボード外に出たとき
if (this.opts.loopedBoard && this.transformXyToPos(
(x = ((x % this.mapWidth) + this.mapWidth) % this.mapWidth),
- (y = ((y % this.mapHeight) + this.mapHeight) % this.mapHeight)) == initPos)
+ (y = ((y % this.mapHeight) + this.mapHeight) % this.mapHeight)) === initPos)
// 盤面の境界でループし、自分が石を置く位置に戻ってきたとき、挟めるようにしている (ref: Test4のマップ)
return found;
- else if (x == -1 || y == -1 || x == this.mapWidth || y == this.mapHeight)
+ else if (x === -1 || y === -1 || x === this.mapWidth || y === this.mapHeight)
return []; // 挟めないことが確定 (盤面外に到達)
const pos = this.transformXyToPos(x, y);
diff --git a/src/mfm/fromHtml.ts b/src/mfm/fromHtml.ts
index 8c6ca337ea..1eca3fc6ce 100644
--- a/src/mfm/fromHtml.ts
+++ b/src/mfm/fromHtml.ts
@@ -13,7 +13,7 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
return text.trim();
function getText(node: any): string {
- if (node.nodeName == '#text') return node.value;
+ if (node.nodeName === '#text') return node.value;
if (node.childNodes) {
return node.childNodes.map((n: any) => getText(n)).join('');
@@ -34,8 +34,8 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
case 'a':
const txt = getText(node);
- const rel = node.attrs.find((x: any) => x.name == 'rel');
- const href = node.attrs.find((x: any) => x.name == 'href');
+ const rel = node.attrs.find((x: any) => x.name === 'rel');
+ const href = node.attrs.find((x: any) => x.name === 'href');
// ハッシュタグ
if (hashtagNames && href && hashtagNames.map(x => x.toLowerCase()).includes(txt.toLowerCase())) {
@@ -44,12 +44,12 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
} else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) {
const part = txt.split('@');
- if (part.length == 2) {
+ if (part.length === 2) {
//#region ホスト名部分が省略されているので復元する
const acct = `${txt}@${(new URL(href.value)).hostname}`;
text += acct;
//#endregion
- } else if (part.length == 3) {
+ } else if (part.length === 3) {
text += txt;
}
// その他
diff --git a/src/mfm/language.ts b/src/mfm/language.ts
index c5cdb5e3ee..59b09daf38 100644
--- a/src/mfm/language.ts
+++ b/src/mfm/language.ts
@@ -31,7 +31,7 @@ export const mfmLanguage = P.createLanguage({
r.center,
),
startOfLine: () => P((input, i) => {
- if (i == 0 || input[i] == '\n' || input[i - 1] == '\n') {
+ if (i === 0 || input[i] === '\n' || input[i - 1] === '\n') {
return P.makeSuccess(i, null);
} else {
return P.makeFailure(i, 'not newline');
@@ -50,7 +50,7 @@ export const mfmLanguage = P.createLanguage({
if (!text.match(/^>[\s\S]+?/)) return P.makeFailure(i, 'not a quote');
const quote = takeWhile(line => line.startsWith('>'), text.split('\n'));
const qInner = quote.join('\n').replace(/^>/gm, '').replace(/^ /gm, '');
- if (qInner == '') return P.makeFailure(i, 'not a quote');
+ if (qInner === '') return P.makeFailure(i, 'not a quote');
const contents = r.root.tryParse(qInner);
return P.makeSuccess(i + quote.join('\n').length + 1, createTree('quote', contents, {}));
})),
diff --git a/src/mfm/normalize.ts b/src/mfm/normalize.ts
index 1a2b5bdcd6..a0f0702096 100644
--- a/src/mfm/normalize.ts
+++ b/src/mfm/normalize.ts
@@ -4,7 +4,7 @@ import { MfmForest, MfmTree } from './prelude';
import { createTree, createLeaf } from '../prelude/tree';
function isEmptyTextTree(t: MfmTree): boolean {
- return t.node.type == 'text' && t.node.props.text === '';
+ return t.node.type === 'text' && t.node.props.text === '';
}
function concatTextTrees(ts: MfmForest): MfmTree {
diff --git a/src/mfm/parse.ts b/src/mfm/parse.ts
index f8464121f3..c628042f12 100644
--- a/src/mfm/parse.ts
+++ b/src/mfm/parse.ts
@@ -3,7 +3,7 @@ import { MfmForest } from './prelude';
import { normalize } from './normalize';
export function parse(source: string | null): MfmForest | null {
- if (source == null || source == '') {
+ if (source == null || source === '') {
return null;
}
@@ -11,7 +11,7 @@ export function parse(source: string | null): MfmForest | null {
}
export function parsePlain(source: string | null): MfmForest | null {
- if (source == null || source == '') {
+ if (source == null || source === '') {
return null;
}
diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts
index 2510830489..2aad5c0fa3 100644
--- a/src/models/repositories/note.ts
+++ b/src/models/repositories/note.ts
@@ -39,7 +39,7 @@ export class NoteRepository extends Repository<Note> {
}
// visibility が followers かつ自分が投稿者のフォロワーでなかったら非表示
- if (packedNote.visibility == 'followers') {
+ if (packedNote.visibility === 'followers') {
if (meId == null) {
hide = true;
} else if (meId === packedNote.userId) {
diff --git a/src/remote/activitypub/kernel/accept/follow.ts b/src/remote/activitypub/kernel/accept/follow.ts
index 377b8dac42..cf6763186e 100644
--- a/src/remote/activitypub/kernel/accept/follow.ts
+++ b/src/remote/activitypub/kernel/accept/follow.ts
@@ -5,7 +5,7 @@ import { IFollow } from '../../type';
import { Users } from '../../../../models';
export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
- const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id;
+ const id = typeof activity.actor === 'string' ? activity.actor : activity.actor.id;
if (id == null) throw new Error('missing id');
if (!id.startsWith(config.url + '/')) {
diff --git a/src/remote/activitypub/kernel/follow.ts b/src/remote/activitypub/kernel/follow.ts
index c255067bfd..fca6d26ccc 100644
--- a/src/remote/activitypub/kernel/follow.ts
+++ b/src/remote/activitypub/kernel/follow.ts
@@ -5,7 +5,7 @@ import { IFollow } from '../type';
import { Users } from '../../../models';
export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
- const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ const id = typeof activity.object === 'string' ? activity.object : activity.object.id;
if (id == null) throw new Error('missing id');
if (!id.startsWith(config.url + '/')) {
diff --git a/src/remote/activitypub/kernel/reject/follow.ts b/src/remote/activitypub/kernel/reject/follow.ts
index d8b5a4b9b9..bc7d03f9a9 100644
--- a/src/remote/activitypub/kernel/reject/follow.ts
+++ b/src/remote/activitypub/kernel/reject/follow.ts
@@ -5,7 +5,7 @@ import { IFollow } from '../../type';
import { Users } from '../../../../models';
export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
- const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id;
+ const id = typeof activity.actor === 'string' ? activity.actor : activity.actor.id;
if (id == null) throw new Error('missing id');
if (!id.startsWith(config.url + '/')) {
diff --git a/src/remote/activitypub/kernel/undo/block.ts b/src/remote/activitypub/kernel/undo/block.ts
index 8ef70a9bef..17eab0d2d0 100644
--- a/src/remote/activitypub/kernel/undo/block.ts
+++ b/src/remote/activitypub/kernel/undo/block.ts
@@ -8,7 +8,7 @@ import { Users } from '../../../../models';
const logger = apLogger;
export default async (actor: IRemoteUser, activity: IBlock): Promise<void> => {
- const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ const id = typeof activity.object === 'string' ? activity.object : activity.object.id;
if (id == null) throw new Error('missing id');
const uri = activity.id || activity;
diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts
index d75f055640..2a42f83907 100644
--- a/src/remote/activitypub/kernel/undo/follow.ts
+++ b/src/remote/activitypub/kernel/undo/follow.ts
@@ -6,7 +6,7 @@ import { IRemoteUser } from '../../../../models/entities/user';
import { Users, FollowRequests, Followings } from '../../../../models';
export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => {
- const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
+ const id = typeof activity.object === 'string' ? activity.object : activity.object.id;
if (id == null) throw new Error('missing id');
if (!id.startsWith(config.url + '/')) {
diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts
index 1e633704d4..a149660ccb 100644
--- a/src/remote/activitypub/models/note.ts
+++ b/src/remote/activitypub/models/note.ts
@@ -293,7 +293,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s
* リモートサーバーからフェッチしてMisskeyに登録しそれを返します。
*/
export async function resolveNote(value: string | IObject, resolver?: Resolver): Promise<Note | null> {
- const uri = typeof value == 'string' ? value : value.id;
+ const uri = typeof value === 'string' ? value : value.id;
if (uri == null) throw new Error('missing uri');
// ブロックしてたら中断
diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts
index 5936cee32c..80ba6b514a 100644
--- a/src/remote/activitypub/models/person.ts
+++ b/src/remote/activitypub/models/person.ts
@@ -136,7 +136,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
const tags = extractApHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32);
- const isBot = object.type == 'Service';
+ const isBot = object.type === 'Service';
// Create user
let user: IRemoteUser;
@@ -327,7 +327,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
emojis: emojiNames,
name: person.name,
tags,
- isBot: object.type == 'Service',
+ isBot: object.type === 'Service',
isCat: (person as any).isCat === true,
isLocked: !!person.manuallyApprovesFollowers,
} as Partial<User>;
diff --git a/src/remote/activitypub/models/question.ts b/src/remote/activitypub/models/question.ts
index 5c889db431..6b6749894a 100644
--- a/src/remote/activitypub/models/question.ts
+++ b/src/remote/activitypub/models/question.ts
@@ -41,7 +41,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver
* @returns true if updated
*/
export async function updateQuestion(value: any) {
- const uri = typeof value == 'string' ? value : value.id;
+ const uri = typeof value === 'string' ? value : value.id;
// URIがこのサーバーを指しているならスキップ
if (uri.startsWith(config.url + '/')) throw new Error('uri points local');
diff --git a/src/remote/activitypub/renderer/announce.ts b/src/remote/activitypub/renderer/announce.ts
index 11e7be449b..d82bf6a693 100644
--- a/src/remote/activitypub/renderer/announce.ts
+++ b/src/remote/activitypub/renderer/announce.ts
@@ -7,10 +7,10 @@ export default (object: any, note: Note) => {
let to: string[] = [];
let cc: string[] = [];
- if (note.visibility == 'public') {
+ if (note.visibility === 'public') {
to = ['https://www.w3.org/ns/activitystreams#Public'];
cc = [`${attributedTo}/followers`];
- } else if (note.visibility == 'home') {
+ } else if (note.visibility === 'home') {
to = [`${attributedTo}/followers`];
cc = ['https://www.w3.org/ns/activitystreams#Public'];
} else {
diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts
index f9912b0ddc..5b00f82958 100644
--- a/src/remote/activitypub/renderer/note.ts
+++ b/src/remote/activitypub/renderer/note.ts
@@ -63,13 +63,13 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
let to: string[] = [];
let cc: string[] = [];
- if (note.visibility == 'public') {
+ if (note.visibility === 'public') {
to = ['https://www.w3.org/ns/activitystreams#Public'];
cc = [`${attributedTo}/followers`].concat(mentions);
- } else if (note.visibility == 'home') {
+ } else if (note.visibility === 'home') {
to = [`${attributedTo}/followers`];
cc = ['https://www.w3.org/ns/activitystreams#Public'].concat(mentions);
- } else if (note.visibility == 'followers') {
+ } else if (note.visibility === 'followers') {
to = [`${attributedTo}/followers`];
cc = mentions;
} else {
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));
diff --git a/src/services/push-notification.ts b/src/services/push-notification.ts
index fa7cacfdc4..f0d9c4e22c 100644
--- a/src/services/push-notification.ts
+++ b/src/services/push-notification.ts
@@ -36,7 +36,7 @@ export default async function(userId: string, type: string, body?: any) {
//swLogger.info(err.headers);
//swLogger.info(err.body);
- if (err.statusCode == 410) {
+ if (err.statusCode === 410) {
SwSubscriptions.delete({
userId: userId,
endpoint: subscription.endpoint,