lint
This commit is contained in:
parent
1ed06e490c
commit
567c550120
|
@ -147,7 +147,7 @@ export class DriveService {
|
|||
}
|
||||
|
||||
const baseUrl = meta.objectStorageBaseUrl
|
||||
|| `${ meta.objectStorageUseSSL ? 'https' : 'http' }://${ meta.objectStorageEndpoint }${ meta.objectStoragePort ? `:${meta.objectStoragePort}` : '' }/${ meta.objectStorageBucket }`;
|
||||
?? `${ meta.objectStorageUseSSL ? 'https' : 'http' }://${ meta.objectStorageEndpoint }${ meta.objectStoragePort ? `:${meta.objectStoragePort}` : '' }/${ meta.objectStorageBucket }`;
|
||||
|
||||
// for original
|
||||
const key = `${meta.objectStoragePrefix}/${uuid()}${ext}`;
|
||||
|
@ -285,7 +285,7 @@ export class DriveService {
|
|||
|
||||
satisfyWebpublic = !!(
|
||||
type !== 'image/svg+xml' && type !== 'image/webp' &&
|
||||
!(metadata.exif || metadata.iptc || metadata.xmp || metadata.tifftagPhotoshop) &&
|
||||
!(metadata.exif ?? metadata.iptc ?? metadata.xmp ?? metadata.tifftagPhotoshop) &&
|
||||
metadata.width && metadata.width <= 2048 &&
|
||||
metadata.height && metadata.height <= 2048
|
||||
);
|
||||
|
@ -438,7 +438,7 @@ export class DriveService {
|
|||
//}
|
||||
|
||||
// detect name
|
||||
const detectedName = name || (info.type.ext ? `untitled.${info.type.ext}` : 'untitled');
|
||||
const detectedName = name ?? (info.type.ext ? `untitled.${info.type.ext}` : 'untitled');
|
||||
|
||||
if (user && !force) {
|
||||
// Check if there is a file with the same hash
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* https://en.wikipedia.org/wiki/Identicon
|
||||
*/
|
||||
|
||||
import { WriteStream } from 'node:fs';
|
||||
import * as p from 'pureimage';
|
||||
import gen from 'random-seed';
|
||||
import type { WriteStream } from 'node:fs';
|
||||
|
||||
const size = 128; // px
|
||||
const n = 5; // resolution
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { Packed } from './schema.js';
|
||||
import type { Packed } from './schema.js';
|
||||
|
||||
export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
|
||||
if (mutedInstances.has(note?.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(note?.reply?.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(note?.renote?.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.user.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.reply?.user.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.renote?.user.host ?? '')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isUserFromMutedInstance(notif: Packed<'Notification'>, mutedInstances: Set<string>): boolean {
|
||||
if (mutedInstances.has(notif?.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(notif.user?.host ?? '')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Note } from '@/models/entities/Note.js';
|
||||
import type { Note } from '@/models/entities/Note.js';
|
||||
|
||||
export default function(note: Note): boolean {
|
||||
return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as os from 'node:os';
|
||||
import sysUtils from 'systeminformation';
|
||||
import Logger from '@/core/logger.js';
|
||||
import type Logger from '@/logger.js';
|
||||
|
||||
export async function showMachineInfo(parentLogger: Logger) {
|
||||
const logger = parentLogger.createSubLogger('machine');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { NotesRepository, UsersRepository } from '@/models/index.js';
|
||||
import { NotesRepository, UsersRepository } from '@/models/index.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import type { Note } from '@/models/entities/Note.js';
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import rndstr from 'rndstr';
|
||||
import { Note } from '@/models/entities/Note.js';
|
||||
import { User } from '@/models/entities/User.js';
|
||||
import { Notes, UserProfiles, NoteReactions } from '@/models/index.js';
|
||||
import { generateMutedUserQuery } from './generate-muted-user-query.js';
|
||||
import { generateBlockedUserQuery } from './generate-block-query.js';
|
||||
import type { Note } from '@/models/entities/Note.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
|
||||
// TODO: リアクション、Renote、返信などをしたノートは除外する
|
||||
|
||||
|
@ -21,9 +18,9 @@ export async function injectFeatured(timeline: Note[], user?: User | null) {
|
|||
const query = Notes.createQueryBuilder('note')
|
||||
.addSelect('note.score')
|
||||
.where('note.userHost IS NULL')
|
||||
.andWhere(`note.score > 0`)
|
||||
.andWhere(`note.createdAt > :date`, { date: new Date(Date.now() - day) })
|
||||
.andWhere(`note.visibility = 'public'`)
|
||||
.andWhere('note.score > 0')
|
||||
.andWhere('note.createdAt > :date', { date: new Date(Date.now() - day) })
|
||||
.andWhere('note.visibility = \'public\'')
|
||||
.innerJoinAndSelect('note.user', 'user');
|
||||
|
||||
if (user) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import rndstr from 'rndstr';
|
||||
import { Note } from '@/models/entities/Note.js';
|
||||
import { User } from '@/models/entities/User.js';
|
||||
import { PromoReads, PromoNotes, Notes, Users } from '@/models/index.js';
|
||||
import type { Note } from '@/models/entities/Note.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
|
||||
export async function injectPromo(timeline: Note[], user?: User | null) {
|
||||
if (timeline.length < 5) return;
|
||||
|
|
|
@ -25,7 +25,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
const ep = endpoints.find(x => x.name === ps.endpoint);
|
||||
if (ep == null) return null;
|
||||
return {
|
||||
params: Object.entries(ep.params.properties || {}).map(([k, v]) => ({
|
||||
params: Object.entries(ep.params.properties ?? {}).map(([k, v]) => ({
|
||||
name: k,
|
||||
type: v.type.charAt(0).toUpperCase() + v.type.slice(1),
|
||||
})),
|
||||
|
|
|
@ -53,9 +53,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
|
||||
const mutedNotes = await this.notesRepository.find({
|
||||
where: [{
|
||||
id: note.threadId || note.id,
|
||||
id: note.threadId ?? note.id,
|
||||
}, {
|
||||
threadId: note.threadId || note.id,
|
||||
threadId: note.threadId ?? note.id,
|
||||
}],
|
||||
});
|
||||
|
||||
|
@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
await this.noteThreadMutingsRepository.insert({
|
||||
id: this.idService.genId(),
|
||||
createdAt: new Date(),
|
||||
threadId: note.threadId || note.id,
|
||||
threadId: note.threadId ?? note.id,
|
||||
userId: me.id,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
});
|
||||
|
||||
await this.noteThreadMutingsRepository.delete({
|
||||
threadId: note.threadId || note.id,
|
||||
threadId: note.threadId ?? note.id,
|
||||
userId: me.id,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { refs, Schema } from '@/misc/schema.js';
|
||||
import type { Schema } from '@/misc/schema.js';
|
||||
import { refs } from '@/misc/schema.js';
|
||||
|
||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
||||
const res: any = schema;
|
||||
|
@ -55,6 +56,6 @@ export const schemas = {
|
|||
},
|
||||
|
||||
...Object.fromEntries(
|
||||
Object.entries(refs).map(([key, schema]) => [key, convertSchemaToOpenApiSchema(schema)])
|
||||
Object.entries(refs).map(([key, schema]) => [key, convertSchemaToOpenApiSchema(schema)]),
|
||||
),
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
'vue/no-multi-spaces': ['error', {
|
||||
'ignoreProperties': false,
|
||||
}],
|
||||
'vue/no-v-html': 'error',
|
||||
'vue/no-v-html': 'warn',
|
||||
'vue/order-in-components': 'error',
|
||||
'vue/html-indent': ['warn', 'tab', {
|
||||
'attribute': 1,
|
||||
|
|
Loading…
Reference in New Issue