lint
This commit is contained in:
parent
1d8dc27424
commit
baa7022a7d
|
@ -197,7 +197,7 @@ function convertRedisOptions(options: RedisOptionsSource, host: string): RedisOp
|
||||||
...options,
|
...options,
|
||||||
password: options.pass,
|
password: options.pass,
|
||||||
prefix: options.prefix ?? host,
|
prefix: options.prefix ?? host,
|
||||||
family: options.family == null ? 0 : options.family,
|
family: options.family ?? 0,
|
||||||
keyPrefix: `${options.prefix ?? host}:`,
|
keyPrefix: `${options.prefix ?? host}:`,
|
||||||
db: options.db ?? 0,
|
db: options.db ?? 0,
|
||||||
};
|
};
|
||||||
|
|
|
@ -574,9 +574,7 @@ export class DriveService {
|
||||||
file.maybePorn = info.porn;
|
file.maybePorn = info.porn;
|
||||||
file.isSensitive = user
|
file.isSensitive = user
|
||||||
? this.userEntityService.isLocalUser(user) && profile!.alwaysMarkNsfw ? true :
|
? this.userEntityService.isLocalUser(user) && profile!.alwaysMarkNsfw ? true :
|
||||||
(sensitive !== null && sensitive !== undefined)
|
sensitive ?? false
|
||||||
? sensitive
|
|
||||||
: false
|
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
if (info.sensitive && profile!.autoSensitive) file.isSensitive = true;
|
if (info.sensitive && profile!.autoSensitive) file.isSensitive = true;
|
||||||
|
|
|
@ -108,7 +108,7 @@ export class FetchInstanceMetadataService {
|
||||||
|
|
||||||
if (name) updates.name = name;
|
if (name) updates.name = name;
|
||||||
if (description) updates.description = description;
|
if (description) updates.description = description;
|
||||||
if (icon || favicon) updates.iconUrl = (icon && !icon.includes('data:image/png;base64')) ? icon : favicon;
|
if (icon ?? favicon) updates.iconUrl = (icon && !icon.includes('data:image/png;base64')) ? icon : favicon;
|
||||||
if (favicon) updates.faviconUrl = favicon;
|
if (favicon) updates.faviconUrl = favicon;
|
||||||
if (themeColor) updates.themeColor = themeColor;
|
if (themeColor) updates.themeColor = themeColor;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class HttpRequestService {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public getAgentByUrl(url: URL, bypassProxy = false): http.Agent | https.Agent {
|
public getAgentByUrl(url: URL, bypassProxy = false): http.Agent | https.Agent {
|
||||||
if (bypassProxy || (this.config.proxyBypassHosts || []).includes(url.hostname)) {
|
if (bypassProxy || (this.config.proxyBypassHosts ?? []).includes(url.hostname)) {
|
||||||
return url.protocol === 'http:' ? this.http : this.https;
|
return url.protocol === 'http:' ? this.http : this.https;
|
||||||
} else {
|
} else {
|
||||||
return url.protocol === 'http:' ? this.httpAgent : this.httpsAgent;
|
return url.protocol === 'http:' ? this.httpAgent : this.httpsAgent;
|
||||||
|
|
|
@ -367,7 +367,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
name: data.name,
|
name: data.name,
|
||||||
text: data.text,
|
text: data.text,
|
||||||
hasPoll: data.poll != null,
|
hasPoll: data.poll != null,
|
||||||
cw: data.cw == null ? null : data.cw,
|
cw: data.cw ?? null,
|
||||||
tags: tags.map(tag => normalizeForSearch(tag)),
|
tags: tags.map(tag => normalizeForSearch(tag)),
|
||||||
emojis,
|
emojis,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
@ -402,7 +402,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
const url = profile != null ? profile.url : null;
|
const url = profile != null ? profile.url : null;
|
||||||
return {
|
return {
|
||||||
uri: u.uri,
|
uri: u.uri,
|
||||||
url: url == null ? undefined : url,
|
url: url ?? undefined,
|
||||||
username: u.username,
|
username: u.username,
|
||||||
host: u.host,
|
host: u.host,
|
||||||
} as IMentionedRemoteUsers[0];
|
} as IMentionedRemoteUsers[0];
|
||||||
|
|
|
@ -200,7 +200,7 @@ export class ApNoteService {
|
||||||
// 引用
|
// 引用
|
||||||
let quote: Note | undefined | null = null;
|
let quote: Note | undefined | null = null;
|
||||||
|
|
||||||
if (note._misskey_quote || note.quoteUrl) {
|
if (note._misskey_quote ?? note.quoteUrl) {
|
||||||
const tryResolveNote = async (uri: string): Promise<
|
const tryResolveNote = async (uri: string): Promise<
|
||||||
| { status: 'ok'; res: Note }
|
| { status: 'ok'; res: Note }
|
||||||
| { status: 'permerror' | 'temperror' }
|
| { status: 'permerror' | 'temperror' }
|
||||||
|
|
|
@ -232,7 +232,7 @@ export function createPostgresDataSource(config: Config) {
|
||||||
options: {
|
options: {
|
||||||
host: config.redis.host,
|
host: config.redis.host,
|
||||||
port: config.redis.port,
|
port: config.redis.port,
|
||||||
family: config.redis.family == null ? 0 : config.redis.family,
|
family: config.redis.family ?? 0,
|
||||||
password: config.redis.pass,
|
password: config.redis.pass,
|
||||||
keyPrefix: `${config.redis.prefix}:query:`,
|
keyPrefix: `${config.redis.prefix}:query:`,
|
||||||
db: config.redis.db ?? 0,
|
db: config.redis.db ?? 0,
|
||||||
|
|
|
@ -268,6 +268,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
if (ep.meta.requireCredential || ep.meta.requireModerator || ep.meta.requireAdmin) {
|
if (ep.meta.requireCredential || ep.meta.requireModerator || ep.meta.requireAdmin) {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new ApiError({
|
throw new ApiError({
|
||||||
|
@ -297,6 +298,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) {
|
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) {
|
||||||
const myRoles = await this.roleService.getUserRoles(user!.id);
|
const myRoles = await this.roleService.getUserRoles(user!.id);
|
||||||
if (ep.meta.requireModerator && !myRoles.some(r => r.isModerator || r.isAdministrator)) {
|
if (ep.meta.requireModerator && !myRoles.some(r => r.isModerator || r.isAdministrator)) {
|
||||||
|
@ -339,6 +341,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cast non JSON input
|
// Cast non JSON input
|
||||||
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
if ((ep.meta.requireFile || request.method === 'GET') && ep.params.properties) {
|
if ((ep.meta.requireFile || request.method === 'GET') && ep.params.properties) {
|
||||||
for (const k of Object.keys(ep.params.properties)) {
|
for (const k of Object.keys(ep.params.properties)) {
|
||||||
const param = ep.params.properties![k];
|
const param = ep.params.properties![k];
|
||||||
|
|
|
@ -193,7 +193,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let files: DriveFile[] = [];
|
let files: DriveFile[] = [];
|
||||||
const fileIds = ps.fileIds != null ? ps.fileIds : ps.mediaIds != null ? ps.mediaIds : null;
|
const fileIds = ps.fileIds ?? ps.mediaIds ?? null;
|
||||||
if (fileIds != null) {
|
if (fileIds != null) {
|
||||||
files = await this.driveFilesRepository.createQueryBuilder('file')
|
files = await this.driveFilesRepository.createQueryBuilder('file')
|
||||||
.where('file.userId = :userId AND file.id IN (:...fileIds)', {
|
.where('file.userId = :userId AND file.id IN (:...fileIds)', {
|
||||||
|
|
|
@ -117,14 +117,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
await this.pagesRepository.update(page.id, {
|
await this.pagesRepository.update(page.id, {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
title: ps.title,
|
title: ps.title,
|
||||||
name: ps.name === undefined ? page.name : ps.name,
|
name: ps.name ?? page.name,
|
||||||
summary: ps.summary === undefined ? page.summary : ps.summary,
|
summary: ps.summary === undefined ? page.summary : ps.summary,
|
||||||
content: ps.content,
|
content: ps.content,
|
||||||
variables: ps.variables,
|
variables: ps.variables,
|
||||||
script: ps.script,
|
script: ps.script,
|
||||||
alignCenter: ps.alignCenter === undefined ? page.alignCenter : ps.alignCenter,
|
alignCenter: ps.alignCenter ?? page.alignCenter,
|
||||||
hideTitleWhenPinned: ps.hideTitleWhenPinned === undefined ? page.hideTitleWhenPinned : ps.hideTitleWhenPinned,
|
hideTitleWhenPinned: ps.hideTitleWhenPinned ?? page.hideTitleWhenPinned,
|
||||||
font: ps.font === undefined ? page.font : ps.font,
|
font: ps.font ?? page.font,
|
||||||
eyeCatchingImageId: ps.eyeCatchingImageId === null
|
eyeCatchingImageId: ps.eyeCatchingImageId === null
|
||||||
? null
|
? null
|
||||||
: ps.eyeCatchingImageId === undefined
|
: ps.eyeCatchingImageId === undefined
|
||||||
|
|
Loading…
Reference in New Issue