mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-10-30 14:51:48 +09:00
refactor: Use ===
This commit is contained in:
parent
fef5ec874b
commit
d4a630902d
@ -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.');
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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[];
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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--;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -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++;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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++;
|
||||
|
@ -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`;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
// その他
|
||||
|
@ -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, {}));
|
||||
})),
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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 + '/')) {
|
||||
|
@ -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 + '/')) {
|
||||
|
@ -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 + '/')) {
|
||||
|
@ -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;
|
||||
|
@ -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 + '/')) {
|
||||
|
@ -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');
|
||||
|
||||
// ブロックしてたら中断
|
||||
|
@ -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>;
|
||||
|
@ -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');
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
@ -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));
|
||||
|
@ -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,
|
||||
|
@ -18,7 +18,7 @@ class WebpackOnBuildPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
const isProduction = process.env.NODE_ENV == 'production';
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
const locales = require('./locales');
|
||||
const meta = require('./package.json');
|
||||
|
Loading…
Reference in New Issue
Block a user