This commit is contained in:
syuilo
2022-09-20 05:32:18 +09:00
parent 1ed06e490c
commit 567c550120
13 changed files with 28 additions and 31 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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));

View File

@@ -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');