remove ms dependency
This commit is contained in:
parent
20763a84ee
commit
d6a95797d8
@ -74,7 +74,6 @@
|
||||
"mime-types": "2.1.35",
|
||||
"misskey-js": "0.0.14",
|
||||
"mocha": "10.0.0",
|
||||
"ms": "3.0.0-canary.1",
|
||||
"multer": "1.4.4",
|
||||
"nested-property": "4.0.0",
|
||||
"node-fetch": "3.2.9",
|
||||
|
@ -1,5 +1,10 @@
|
||||
export const MAX_NOTE_TEXT_LENGTH = 3000;
|
||||
|
||||
export const SECOND = 1000;
|
||||
export const MINUTE = 60 * SEC;
|
||||
export const HOUR = 60 * MIN;
|
||||
export const DAY = 24 * HOUR;
|
||||
|
||||
export const USER_ONLINE_THRESHOLD = 1000 * 60 * 10; // 10min
|
||||
export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import define from '../../define.js';
|
||||
import Resolver from '@/remote/activitypub/resolver.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import ms from 'ms';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['federation'],
|
||||
@ -9,7 +8,7 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 30,
|
||||
},
|
||||
|
||||
|
@ -11,8 +11,8 @@ import { Note } from '@/models/entities/note.js';
|
||||
import { CacheableLocalUser, User } from '@/models/entities/user.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import { isActor, isPost, getApId } from '@/remote/activitypub/type.js';
|
||||
import ms from 'ms';
|
||||
import { SchemaType } from '@/misc/schema.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['federation'],
|
||||
@ -20,7 +20,7 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 30,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import ms from 'ms';
|
||||
import create from '@/services/blocking/create.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getUser } from '../../common/getters.js';
|
||||
import { Blockings, NoteWatchings, Users } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['account'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 100,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import ms from 'ms';
|
||||
import deleteBlocking from '@/services/blocking/delete.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getUser } from '../../common/getters.js';
|
||||
import { Blockings, Users } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['account'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 100,
|
||||
},
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import ms from 'ms';
|
||||
import { addFile } from '@/services/drive/add-file.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js';
|
||||
@ -7,6 +6,9 @@ import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import define from '../../../define.js';
|
||||
import { apiLogger } from '../../../logger.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['drive'],
|
||||
@ -14,7 +16,7 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 120,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
import ms from 'ms';
|
||||
import { uploadFromUrl } from '@/services/drive/upload-from-url.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js';
|
||||
import define from '../../../define.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['drive'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 60,
|
||||
},
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import ms from 'ms';
|
||||
import { createExportCustomEmojisJob } from '@/queue/index.js';
|
||||
import define from '../define.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,16 +1,16 @@
|
||||
import ms from 'ms';
|
||||
import create from '@/services/following/create.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getUser } from '../../common/getters.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['following', 'users'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 100,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import ms from 'ms';
|
||||
import deleteFollowing from '@/services/following/delete.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getUser } from '../../common/getters.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['following', 'users'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 100,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import ms from 'ms';
|
||||
import deleteFollowing from '@/services/following/delete.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getUser } from '../../common/getters.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['following', 'users'],
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 100,
|
||||
},
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import ms from 'ms';
|
||||
import define from '../../../define.js';
|
||||
import { DriveFiles, GalleryPosts } from '@/models/index.js';
|
||||
import { genId } from '../../../../../misc/gen-id.js';
|
||||
import { GalleryPost } from '@/models/entities/gallery-post.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['gallery'],
|
||||
@ -14,7 +14,7 @@ export const meta = {
|
||||
kind: 'write:gallery',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import ms from 'ms';
|
||||
import define from '../../../define.js';
|
||||
import { DriveFiles, GalleryPosts } from '@/models/index.js';
|
||||
import { GalleryPost } from '@/models/entities/gallery-post.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['gallery'],
|
||||
@ -13,7 +13,7 @@ export const meta = {
|
||||
kind: 'write:gallery',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import define from '../../define.js';
|
||||
import { createExportBlockingJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import define from '../../define.js';
|
||||
import { createExportFollowingJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import define from '../../define.js';
|
||||
import { createExportMuteJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import define from '../../define.js';
|
||||
import { createExportNotesJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { DAY } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1day'),
|
||||
duration: DAY,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import define from '../../define.js';
|
||||
import { createExportUserListsJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { MINUTE } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1min'),
|
||||
duration: MINUTE,
|
||||
max: 1,
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,15 +1,15 @@
|
||||
import define from '../../define.js';
|
||||
import { createImportBlockingJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import define from '../../define.js';
|
||||
import { createImportFollowingJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duratition: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
import define from '../../define.js';
|
||||
import { createImportMutingJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import define from '../../define.js';
|
||||
import { createImportUserListsJob } from '@/queue/index.js';
|
||||
import ms from 'ms';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 1,
|
||||
},
|
||||
|
||||
|
@ -2,12 +2,12 @@ import { publishMainStream } from '@/services/stream.js';
|
||||
import define from '../../define.js';
|
||||
import rndstr from 'rndstr';
|
||||
import config from '@/config/index.js';
|
||||
import ms from 'ms';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Users, UserProfiles } from '@/models/index.js';
|
||||
import { sendEmail } from '@/services/send-email.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { validateEmailForAccount } from '@/services/validate-email-for-account.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@ -15,7 +15,7 @@ export const meta = {
|
||||
secure: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 3,
|
||||
},
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import define from '../../../define.js';
|
||||
import ms from 'ms';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { MessagingMessages } from '@/models/index.js';
|
||||
import { deleteMessage } from '@/services/messages/delete.js';
|
||||
import { SECOND, HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['messaging'],
|
||||
@ -12,9 +12,9 @@ export const meta = {
|
||||
kind: 'write:messaging',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
minInterval: ms('1sec'),
|
||||
minInterval: SECOND,
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import ms from 'ms';
|
||||
import { In } from 'typeorm';
|
||||
import create from '@/services/note/create.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
@ -11,7 +10,7 @@ import { HOUR } from '@/const.js';
|
||||
import { noteVisibilities } from '../../../../types.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import define from '../../define.js';
|
||||
import { getNote } from '../../common/getters.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
@ -19,7 +18,7 @@ export const meta = {
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import ms from 'ms';
|
||||
import deleteNote from '@/services/note/delete.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { getNote } from '../../common/getters.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { SECOND, HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
@ -13,9 +13,9 @@ export const meta = {
|
||||
kind: 'write:notes',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
minInterval: ms('1sec'),
|
||||
minInterval: SECOND,
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import ms from 'ms';
|
||||
import deleteReaction from '@/services/note/reaction/delete.js';
|
||||
import define from '../../../define.js';
|
||||
import { getNote } from '../../../common/getters.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { SECOND, HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['reactions', 'notes'],
|
||||
@ -12,9 +12,9 @@ export const meta = {
|
||||
kind: 'write:reactions',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 60,
|
||||
minInterval: ms('3sec'),
|
||||
minInterval: 3 * SECOND,
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import ms from 'ms';
|
||||
import deleteNote from '@/services/note/delete.js';
|
||||
import { Notes, Users } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { getNote } from '../../common/getters.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { SECOND, HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
@ -13,9 +13,9 @@ export const meta = {
|
||||
kind: 'write:notes',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
minInterval: ms('1sec'),
|
||||
minInterval: SECOND,
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import ms from 'ms';
|
||||
import { Pages, DriveFiles } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { Page } from '@/models/entities/page.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['pages'],
|
||||
@ -13,7 +13,7 @@ export const meta = {
|
||||
kind: 'write:pages',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import ms from 'ms';
|
||||
import { Not } from 'typeorm';
|
||||
import { Pages, DriveFiles } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['pages'],
|
||||
@ -12,7 +12,7 @@ export const meta = {
|
||||
kind: 'write:pages',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import rndstr from 'rndstr';
|
||||
import ms from 'ms';
|
||||
import { IsNull } from 'typeorm';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import config from '@/config/index.js';
|
||||
@ -8,6 +7,7 @@ import { sendEmail } from '@/services/send-email.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { ApiError } from '../error.js';
|
||||
import define from '../define.js';
|
||||
import { HOUR } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['reset password'],
|
||||
@ -17,7 +17,7 @@ export const meta = {
|
||||
description: 'Request a users password to be reset.',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
duration: HOUR,
|
||||
max: 3,
|
||||
},
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import ms from 'ms';
|
||||
import { Users, Followings } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query.js';
|
||||
import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query.js';
|
||||
import { DAY } from '@/const.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['users'],
|
||||
@ -39,7 +39,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
.where('user.isLocked = FALSE')
|
||||
.andWhere('user.isExplorable = TRUE')
|
||||
.andWhere('user.host IS NULL')
|
||||
.andWhere('user.updatedAt >= :date', { date: new Date(Date.now() - ms('7days')) })
|
||||
.andWhere('user.updatedAt >= :date', { date: new Date(Date.now() - (7 * DAY)) })
|
||||
.andWhere('user.id != :meId', { meId: me.id })
|
||||
.orderBy('user.followersCount', 'DESC');
|
||||
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
import { dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { PathOrFileDescriptor, readFileSync } from 'node:fs';
|
||||
import ms from 'ms';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import Koa from 'koa';
|
||||
import Router from '@koa/router';
|
||||
import send from 'koa-send';
|
||||
@ -27,6 +26,7 @@ import { genOpenapiSpec } from '../api/openapi/gen-spec.js';
|
||||
import { urlPreviewHandler } from './url-preview.js';
|
||||
import { manifestHandler } from './manifest.js';
|
||||
import packFeed from './feed.js';
|
||||
import { MINUTE, DAY } from '@/const.js';
|
||||
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
@ -100,21 +100,21 @@ const router = new Router();
|
||||
router.get('/static-assets/(.*)', async ctx => {
|
||||
await send(ctx as any, ctx.path.replace('/static-assets/', ''), {
|
||||
root: staticAssets,
|
||||
maxage: ms('7 days'),
|
||||
maxage: 7 * DAY,
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/client-assets/(.*)', async ctx => {
|
||||
await send(ctx as any, ctx.path.replace('/client-assets/', ''), {
|
||||
root: clientAssets,
|
||||
maxage: ms('7 days'),
|
||||
maxage: 7 * DAY,
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/assets/(.*)', async ctx => {
|
||||
await send(ctx as any, ctx.path.replace('/assets/', ''), {
|
||||
root: assets,
|
||||
maxage: ms('7 days'),
|
||||
maxage: 7 * DAY,
|
||||
});
|
||||
});
|
||||
|
||||
@ -137,7 +137,7 @@ router.get('/twemoji/(.*)', async ctx => {
|
||||
|
||||
await send(ctx as any, path, {
|
||||
root: `${_dirname}/../../../node_modules/@discordapp/twemoji/dist/svg/`,
|
||||
maxage: ms('30 days'),
|
||||
maxage: 30 * DAY,
|
||||
});
|
||||
});
|
||||
|
||||
@ -188,7 +188,7 @@ router.get('/twemoji-badge/(.*)', async ctx => {
|
||||
router.get(`/sw.js`, async ctx => {
|
||||
await send(ctx as any, `/sw.js`, {
|
||||
root: swAssets,
|
||||
maxage: ms('10 minutes'),
|
||||
maxage: 10 * MINUTE,
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user