chore: lint
This commit is contained in:
parent
3d78594d43
commit
437f7ac336
10 changed files with 17 additions and 17 deletions
|
@ -2,11 +2,11 @@ import type { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
export class convertHardMutes1644010796173 implements MigrationInterface {
|
export class convertHardMutes1644010796173 implements MigrationInterface {
|
||||||
async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
let entries = await queryRunner.query(
|
const entries = await queryRunner.query(
|
||||||
`SELECT "userId", "mutedWords" FROM "user_profile" WHERE "userHost" IS NULL`,
|
`SELECT "userId", "mutedWords" FROM "user_profile" WHERE "userHost" IS NULL`,
|
||||||
);
|
);
|
||||||
for (let i = 0; i < entries.length; i++) {
|
for (let i = 0; i < entries.length; i++) {
|
||||||
let words = entries[i].mutedWords
|
const words = entries[i].mutedWords
|
||||||
.map((line) => {
|
.map((line) => {
|
||||||
if (typeof line === "string") return [];
|
if (typeof line === "string") return [];
|
||||||
const regexp = line.join(" ").match(/^\/(.+)\/(.*)$/);
|
const regexp = line.join(" ").match(/^\/(.+)\/(.*)$/);
|
||||||
|
@ -39,11 +39,11 @@ export class convertHardMutes1644010796173 implements MigrationInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
async down(queryRunner: QueryRunner): Promise<void> {
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
let entries = await queryRunner.query(
|
const entries = await queryRunner.query(
|
||||||
`SELECT "userId", "mutedWords" FROM "user_profile"`,
|
`SELECT "userId", "mutedWords" FROM "user_profile"`,
|
||||||
);
|
);
|
||||||
for (let i = 0; i < entries.length; i++) {
|
for (let i = 0; i < entries.length; i++) {
|
||||||
let words = entries[i].mutedWords
|
const words = entries[i].mutedWords
|
||||||
.map((line) => {
|
.map((line) => {
|
||||||
if (Array.isArray(line)) {
|
if (Array.isArray(line)) {
|
||||||
return line;
|
return line;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import tinycolor from "tinycolor2";
|
||||||
export class uniformThemecolor1652859567549 implements MigrationInterface {
|
export class uniformThemecolor1652859567549 implements MigrationInterface {
|
||||||
async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
const formatColor = (color) => {
|
const formatColor = (color) => {
|
||||||
let tc = new tinycolor(color);
|
const tc = new tinycolor(color);
|
||||||
if (tc.isValid()) {
|
if (tc.isValid()) {
|
||||||
return tc.toHexString();
|
return tc.toHexString();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
import { Packed } from "@/misc/schema.js";
|
import type { Packed } from "@/misc/schema.js";
|
||||||
import { RenoteMuting } from "@/models/entities/renote-muting.js";
|
import { RenoteMuting } from "@/models/entities/renote-muting.js";
|
||||||
import { User } from "@/models/entities/user.js";
|
import type { User } from "@/models/entities/user.js";
|
||||||
import { awaitAll } from "@/prelude/await-all.js";
|
import { awaitAll } from "@/prelude/await-all.js";
|
||||||
import { Users } from "../index.js";
|
import { Users } from "../index.js";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
import { Packed } from "@/misc/schema.js";
|
import type { Packed } from "@/misc/schema.js";
|
||||||
import { ReplyMuting } from "@/models/entities/reply-muting.js";
|
import { ReplyMuting } from "@/models/entities/reply-muting.js";
|
||||||
import { User } from "@/models/entities/user.js";
|
import type { User } from "@/models/entities/user.js";
|
||||||
import { awaitAll } from "@/prelude/await-all.js";
|
import { awaitAll } from "@/prelude/await-all.js";
|
||||||
import { Users } from "../index.js";
|
import { Users } from "../index.js";
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ export async function importCkPost(
|
||||||
*/
|
*/
|
||||||
const urls = (post.files || [])
|
const urls = (post.files || [])
|
||||||
.map((x: any) => x.url)
|
.map((x: any) => x.url)
|
||||||
.filter((x: String) => x.startsWith("http"));
|
.filter((x: string) => x.startsWith("http"));
|
||||||
const files: DriveFile[] = [];
|
const files: DriveFile[] = [];
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -68,7 +68,7 @@ export async function importMastoPost(
|
||||||
if (!isRenote && files.length == 0) {
|
if (!isRenote && files.length == 0) {
|
||||||
const urls = post.object.attachment
|
const urls = post.object.attachment
|
||||||
.map((x: any) => x.url)
|
.map((x: any) => x.url)
|
||||||
.filter((x: String) => x.startsWith("http"));
|
.filter((x: string) => x.startsWith("http"));
|
||||||
files = [];
|
files = [];
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default async (user: { id: User["id"] }, url: string, object: any) => {
|
||||||
export async function apGet(
|
export async function apGet(
|
||||||
url: string,
|
url: string,
|
||||||
user?: ILocalUser,
|
user?: ILocalUser,
|
||||||
redirects: boolean = true,
|
redirects = true,
|
||||||
): Promise<{ finalUrl: string; content: IObject }> {
|
): Promise<{ finalUrl: string; content: IObject }> {
|
||||||
if (!isSafeUrl(url)) {
|
if (!isSafeUrl(url)) {
|
||||||
throw new StatusError("Invalid URL", 400);
|
throw new StatusError("Invalid URL", 400);
|
||||||
|
|
|
@ -82,7 +82,7 @@ function extractRanges(
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBoundary(len: number): string {
|
function createBoundary(len: number): string {
|
||||||
let chars = [];
|
const chars = [];
|
||||||
for (let i = 0; i < len; i = i + 1) {
|
for (let i = 0; i < len; i = i + 1) {
|
||||||
chars[i] = BOUNDARY_CHARS.charAt(
|
chars[i] = BOUNDARY_CHARS.charAt(
|
||||||
Math.floor(Math.random() * BOUNDARY_CHARS.length),
|
Math.floor(Math.random() * BOUNDARY_CHARS.length),
|
||||||
|
|
|
@ -132,7 +132,7 @@ export default class Logger {
|
||||||
? message
|
? message
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
let log = `${l} ${worker}\t[${domains.join(" ")}]\t${m}`;
|
const log = `${l} ${worker}\t[${domains.join(" ")}]\t${m}`;
|
||||||
|
|
||||||
console.log(important ? chalk.bold(log) : log);
|
console.log(important ? chalk.bold(log) : log);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
declare let self: ServiceWorkerGlobalScope;
|
declare let self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
import { get } from "idb-keyval";
|
import { get } from "idb-keyval";
|
||||||
import { pushNotificationDataMap } from "@/types";
|
import type { PushNotificationDataMap } from "@/types";
|
||||||
import { api } from "@/scripts/operations";
|
import { api } from "@/scripts/operations";
|
||||||
|
|
||||||
type Accounts = {
|
type Accounts = {
|
||||||
|
@ -30,8 +30,8 @@ class SwNotificationReadManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// プッシュ通知の既読をサーバーに送信
|
// プッシュ通知の既読をサーバーに送信
|
||||||
public async read<K extends keyof pushNotificationDataMap>(
|
public async read<K extends keyof PushNotificationDataMap>(
|
||||||
data: pushNotificationDataMap[K],
|
data: PushNotificationDataMap[K],
|
||||||
) {
|
) {
|
||||||
if (data.type !== "notification" || !(data.userId in this.accounts)) return;
|
if (data.type !== "notification" || !(data.userId in this.accounts)) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue