Revert "refactor? (backend): move consts to backend-rs"

This commit partially reverts b9c3dfbd3d.
This commit is contained in:
naskya 2024-07-24 19:25:07 +09:00
parent 09721be9fe
commit 0595dccbfd
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
52 changed files with 156 additions and 149 deletions

View file

@ -270,8 +270,6 @@ export declare function cpuInfo(): Cpu
export declare function cpuUsage(): number
export const DAY: number
export interface DbConfig {
host: string
port: number
@ -380,17 +378,6 @@ export declare function fetchMeta(): Promise<Meta>
/** Fetches and returns the NodeInfo (version 2.0) of a remote server. */
export declare function fetchNodeinfo(host: string): Promise<Nodeinfo>
/**
* List of file types allowed to be viewed directly in the browser
*
* Anything not included here will be responded as application/octet-stream
* SVG is not allowed because it generates XSS (TODO: fix this and later allow it to be viewed directly)
* * <https://github.com/sindresorhus/file-type/blob/main/supported.js>
* * <https://github.com/sindresorhus/file-type/blob/main/core.js>
* * <https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers>
*/
export const FILE_TYPE_BROWSERSAFE: string[]
export interface Following {
id: string
createdAt: DateTimeWithTimeZone
@ -492,8 +479,6 @@ export interface Hashtag {
attachedRemoteUsersCount: number
}
export const HOUR: number
export interface IdConfig {
length?: number
fingerprint?: string
@ -754,8 +739,6 @@ export interface Migrations {
name: string
}
export const MINUTE: number
export interface ModerationLog {
id: string
createdAt: DateTimeWithTimeZone
@ -1225,8 +1208,6 @@ export interface ReplyMuting {
/** Returns `true` if `src` does not contain suspicious characters like `%`. */
export declare function safeForSql(src: string): boolean
export const SECOND: number
export declare function sendPushNotification(receiverUserId: string, kind: PushNotificationKind, content: any): Promise<void>
export interface ServerConfig {
@ -1422,10 +1403,6 @@ export interface User {
readCatLanguage: boolean
}
export const USER_ACTIVE_THRESHOLD: number
export const USER_ONLINE_THRESHOLD: number
export type UserEmojiModPerm = 'add'|
'full'|
'mod'|

View file

@ -370,7 +370,6 @@ module.exports.countLocalUsers = nativeBinding.countLocalUsers
module.exports.countReactions = nativeBinding.countReactions
module.exports.cpuInfo = nativeBinding.cpuInfo
module.exports.cpuUsage = nativeBinding.cpuUsage
module.exports.DAY = nativeBinding.DAY
module.exports.decodeReaction = nativeBinding.decodeReaction
module.exports.DriveFileEvent = nativeBinding.DriveFileEvent
module.exports.DriveFileUsageHint = nativeBinding.DriveFileUsageHint
@ -379,7 +378,6 @@ module.exports.extractHashtags = nativeBinding.extractHashtags
module.exports.extractHost = nativeBinding.extractHost
module.exports.fetchMeta = nativeBinding.fetchMeta
module.exports.fetchNodeinfo = nativeBinding.fetchNodeinfo
module.exports.FILE_TYPE_BROWSERSAFE = nativeBinding.FILE_TYPE_BROWSERSAFE
module.exports.formatMilliseconds = nativeBinding.formatMilliseconds
module.exports.generateSecureRandomString = nativeBinding.generateSecureRandomString
module.exports.generateUserToken = nativeBinding.generateUserToken
@ -392,7 +390,6 @@ module.exports.getNoteSummary = nativeBinding.getNoteSummary
module.exports.getTimestamp = nativeBinding.getTimestamp
module.exports.greet = nativeBinding.greet
module.exports.hashPassword = nativeBinding.hashPassword
module.exports.HOUR = nativeBinding.HOUR
module.exports.Inbound = nativeBinding.Inbound
module.exports.initializeRustLogger = nativeBinding.initializeRustLogger
module.exports.InternalActor = nativeBinding.InternalActor
@ -409,7 +406,6 @@ module.exports.latestVersion = nativeBinding.latestVersion
module.exports.loadConfig = nativeBinding.loadConfig
module.exports.memoryUsage = nativeBinding.memoryUsage
module.exports.metaToPugArgs = nativeBinding.metaToPugArgs
module.exports.MINUTE = nativeBinding.MINUTE
module.exports.MutedNoteReason = nativeBinding.MutedNoteReason
module.exports.nodeinfo_2_0 = nativeBinding.nodeinfo_2_0
module.exports.nodeinfo_2_1 = nativeBinding.nodeinfo_2_1
@ -434,7 +430,6 @@ module.exports.PushSubscriptionType = nativeBinding.PushSubscriptionType
module.exports.RelayStatus = nativeBinding.RelayStatus
module.exports.removeOldAttestationChallenges = nativeBinding.removeOldAttestationChallenges
module.exports.safeForSql = nativeBinding.safeForSql
module.exports.SECOND = nativeBinding.SECOND
module.exports.sendPushNotification = nativeBinding.sendPushNotification
module.exports.shouldNyaify = nativeBinding.shouldNyaify
module.exports.showServerInfo = nativeBinding.showServerInfo
@ -450,8 +445,6 @@ module.exports.updateAntennaCache = nativeBinding.updateAntennaCache
module.exports.updateAntennasOnNewNote = nativeBinding.updateAntennasOnNewNote
module.exports.updateMetaCache = nativeBinding.updateMetaCache
module.exports.updateNodeinfoCache = nativeBinding.updateNodeinfoCache
module.exports.USER_ACTIVE_THRESHOLD = nativeBinding.USER_ACTIVE_THRESHOLD
module.exports.USER_ONLINE_THRESHOLD = nativeBinding.USER_ONLINE_THRESHOLD
module.exports.UserEmojiModPerm = nativeBinding.UserEmojiModPerm
module.exports.UserProfileFfvisibility = nativeBinding.UserProfileFfvisibility
module.exports.UserProfileMutingNotificationTypes = nativeBinding.UserProfileMutingNotificationTypes

View file

@ -1,70 +0,0 @@
//! This module is used in the TypeScript backend only.
#[macros::ts_export]
pub const SECOND: i32 = 1000;
#[macros::ts_export]
pub const MINUTE: i32 = 60 * SECOND;
#[macros::ts_export]
pub const HOUR: i32 = 60 * MINUTE;
#[macros::ts_export]
pub const DAY: i32 = 24 * HOUR;
#[macros::ts_export]
pub const USER_ONLINE_THRESHOLD: i32 = 10 * MINUTE;
#[macros::ts_export]
pub const USER_ACTIVE_THRESHOLD: i32 = 3 * DAY;
/// List of file types allowed to be viewed directly in the browser
///
/// Anything not included here will be responded as application/octet-stream
/// SVG is not allowed because it generates XSS (TODO: fix this and later allow it to be viewed directly)
/// * <https://github.com/sindresorhus/file-type/blob/main/supported.js>
/// * <https://github.com/sindresorhus/file-type/blob/main/core.js>
/// * <https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers>
#[macros::ts_export]
pub const FILE_TYPE_BROWSERSAFE: [&str; 41] = [
// Images
"image/png",
"image/gif", // TODO: deprecated, but still used by old posts, new gifs should be converted to webp in the future
"image/jpeg",
"image/webp", // TODO: make this the default image format
"image/apng",
"image/bmp",
"image/tiff",
"image/x-icon",
"image/avif", // not as good supported now, but its good to introduce initial support for the future
// OggS
"audio/opus",
"video/ogg",
"audio/ogg",
"application/ogg",
// ISO/IEC base media file format
"video/quicktime",
"video/mp4", // TODO: we need to check for av1 later
"video/vnd.avi", // also av1
"audio/mp4",
"video/x-m4v",
"audio/x-m4a",
"video/3gpp",
"video/3gpp2",
"video/3gp2",
"audio/3gpp",
"audio/3gpp2",
"audio/3gp2",
"video/mpeg",
"audio/mpeg",
"video/webm",
"audio/webm",
"audio/aac",
"audio/x-flac",
"audio/flac",
"audio/vnd.wave",
"audio/mod",
"audio/x-mod",
"audio/s3m",
"audio/x-s3m",
"audio/xm",
"audio/x-xm",
"audio/it",
"audio/x-it",
];

View file

@ -3,6 +3,5 @@
pub use meta::local_server_info;
pub use server::CONFIG;
pub mod constant;
pub mod meta;
pub mod server;

View file

@ -0,0 +1,98 @@
import { config } from "@/config.js";
// If you change DB_* values, you must also change the DB schema.
/**
* Maximum note text length that can be stored in DB.
* Surrogate pairs count as one
*
* NOTE: this can hypothetically be pushed further
* (up to 250000000), but will likely cause truncations
* and incompatibilities with other servers,
* as well as potential performance issues.
*/
export const DB_MAX_NOTE_TEXT_LENGTH = 100000;
/**
* Maximum image description length that can be stored in DB.
* Surrogate pairs count as one
*/
export const DB_MAX_IMAGE_COMMENT_LENGTH = 8192;
export const MAX_NOTE_TEXT_LENGTH = Math.min(
config.maxNoteLength ?? 3000,
DB_MAX_NOTE_TEXT_LENGTH,
);
export const MAX_CAPTION_TEXT_LENGTH = Math.min(
config.maxCaptionLength ?? 1500,
DB_MAX_IMAGE_COMMENT_LENGTH,
);
export const SECOND = 1000;
export const MINUTE = 60 * SECOND;
export const HOUR = 60 * MINUTE;
export const DAY = 24 * HOUR;
export const USER_ONLINE_THRESHOLD = 10 * MINUTE;
export const USER_ACTIVE_THRESHOLD = 3 * DAY;
// List of file types allowed to be viewed directly in the browser
// Anything not included here will be responded as application/octet-stream
// SVG is not allowed because it generates XSS <- we need to fix this and later allow it to be viewed directly
export const FILE_TYPE_BROWSERSAFE = [
// Images
"image/png",
"image/gif", // TODO: deprecated, but still used by old notes, new gifs should be converted to webp in the future
"image/jpeg",
"image/webp", // TODO: make this the default image format
"image/apng",
"image/bmp",
"image/tiff",
"image/x-icon",
"image/avif", // not as good supported now, but its good to introduce initial support for the future
// OggS
"audio/opus",
"video/ogg",
"audio/ogg",
"application/ogg",
// ISO/IEC base media file format
"video/quicktime",
"video/mp4", // TODO: we need to check for av1 later
"video/vnd.avi", // also av1
"audio/mp4",
"video/x-m4v",
"audio/x-m4a",
"video/3gpp",
"video/3gpp2",
"video/3gp2",
"audio/3gpp",
"audio/3gpp2",
"audio/3gp2",
"video/mpeg",
"audio/mpeg",
"video/webm",
"audio/webm",
"audio/aac",
"audio/x-flac",
"audio/flac",
"audio/vnd.wave",
"audio/mod",
"audio/x-mod",
"audio/s3m",
"audio/x-s3m",
"audio/xm",
"audio/x-xm",
"audio/it",
"audio/x-it",
];
/*
https://github.com/sindresorhus/file-type/blob/main/supported.js
https://github.com/sindresorhus/file-type/blob/main/core.js
https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers
*/

View file

@ -1,4 +1,4 @@
import { FILE_TYPE_BROWSERSAFE } from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
const dictionary = {
"safe-file": FILE_TYPE_BROWSERSAFE,

View file

@ -1,5 +1,6 @@
import { Brackets } from "typeorm";
import { isBlockedServer, DAY } from "backend-rs";
import { isBlockedServer } from "backend-rs";
import { DAY } from "@/const.js";
import { Instances } from "@/models/index.js";
import type { Instance } from "@/models/entities/instance.js";

View file

@ -7,7 +7,7 @@ import type { Packed } from "@/misc/schema.js";
import type { Promiseable } from "@/prelude/await-all.js";
import { awaitAll } from "@/prelude/await-all.js";
import { populateEmojis } from "@/misc/populate-emojis.js";
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "backend-rs";
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "@/const.js";
import { Cache } from "@/misc/cache.js";
import { db } from "@/db/postgre.js";
import { isActor, getApId } from "@/remote/activitypub/type.js";

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import Resolver from "@/remote/activitypub/resolver.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["federation"],

View file

@ -4,7 +4,8 @@ import { createNote } from "@/remote/activitypub/models/note.js";
import DbResolver from "@/remote/activitypub/db-resolver.js";
import Resolver from "@/remote/activitypub/resolver.js";
import { ApiError } from "@/server/api/error.js";
import { MINUTE, extractHost, isBlockedServer } from "backend-rs";
import { MINUTE } from "@/const.js";
import { extractHost, isBlockedServer } from "backend-rs";
import { Users, Notes } from "@/models/index.js";
import type { Note } from "@/models/entities/note.js";
import type { CacheableLocalUser, User } from "@/models/entities/user.js";

View file

@ -3,7 +3,7 @@ import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { getUser } from "@/server/api/common/getters.js";
import { Blockings, NoteWatchings, Users } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["account"],

View file

@ -3,7 +3,7 @@ import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { getUser } from "@/server/api/common/getters.js";
import { Blockings, Users } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["account"],

View file

@ -1,7 +1,7 @@
import { Emojis } from "@/models/index.js";
import type { Emoji } from "@/models/entities/emoji.js";
import { IsNull, In } from "typeorm";
import { FILE_TYPE_BROWSERSAFE } from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
import define from "@/server/api/define.js";
export const meta = {

View file

@ -2,7 +2,8 @@ import { addFile } from "@/services/drive/add-file.js";
import { DriveFiles } from "@/models/index.js";
import { config } from "@/config.js";
import { IdentifiableError } from "@/misc/identifiable-error.js";
import { MINUTE, fetchMeta } from "backend-rs";
import { fetchMeta } from "backend-rs";
import { MINUTE } from "@/const.js";
import define from "@/server/api/define.js";
import { apiLogger } from "@/server/api/logger.js";
import { ApiError } from "@/server/api/error.js";

View file

@ -2,7 +2,7 @@ import { uploadFromUrl } from "@/services/drive/upload-from-url.js";
import define from "@/server/api/define.js";
import { DriveFiles } from "@/models/index.js";
import { publishMainStream } from "@/services/stream.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["drive"],

View file

@ -1,6 +1,6 @@
import { createExportCustomEmojisJob } from "@/queue/index.js";
import define from "@/server/api/define.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -4,7 +4,7 @@ import { ApiError } from "@/server/api/error.js";
import { getUser } from "@/server/api/common/getters.js";
import { Followings, Users } from "@/models/index.js";
import { IdentifiableError } from "@/misc/identifiable-error.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["following", "users"],

View file

@ -3,7 +3,7 @@ import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { getUser } from "@/server/api/common/getters.js";
import { Followings, Users } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["following", "users"],

View file

@ -3,7 +3,7 @@ import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { getUser } from "@/server/api/common/getters.js";
import { Followings, Users } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["following", "users"],

View file

@ -1,6 +1,7 @@
import define from "@/server/api/define.js";
import { DriveFiles, GalleryPosts } from "@/models/index.js";
import { HOUR, genIdAt } from "backend-rs";
import { genIdAt } from "backend-rs";
import { HOUR } from "@/const.js";
import { GalleryPost } from "@/models/entities/gallery-post.js";
import type { DriveFile } from "@/models/entities/drive-file.js";

View file

@ -1,7 +1,7 @@
import define from "@/server/api/define.js";
import { DriveFiles, GalleryPosts } from "@/models/index.js";
import type { DriveFile } from "@/models/entities/drive-file.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["gallery"],

View file

@ -1,5 +1,5 @@
import { MoreThan } from "typeorm";
import { USER_ONLINE_THRESHOLD } from "backend-rs";
import { USER_ONLINE_THRESHOLD } from "@/const.js";
import { Users } from "@/models/index.js";
import define from "@/server/api/define.js";

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportBlockingJob } from "@/queue/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportFollowersJob } from "@/queue/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportFollowingJob } from "@/queue/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportMuteJob } from "@/queue/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportNotesJob } from "@/queue/index.js";
import { DAY } from "backend-rs";
import { DAY } from "@/const.js";
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import define from "@/server/api/define.js";
import { createExportUserListsJob } from "@/queue/index.js";
import { MINUTE } from "backend-rs";
import { MINUTE } from "@/const.js";
export const meta = {
secure: true,

View file

@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
import { createImportBlockingJob } from "@/queue/index.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
import { createImportFollowingJob } from "@/queue/index.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
import { createImportMutingJob } from "@/queue/index.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -2,7 +2,8 @@ import define from "@/server/api/define.js";
import { createImportPostsJob } from "@/queue/index.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
import { fetchMeta, DAY } from "backend-rs";
import { fetchMeta } from "backend-rs";
import { DAY } from "@/const.js";
export const meta = {
secure: true,

View file

@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
import { createImportUserListsJob } from "@/queue/index.js";
import { ApiError } from "@/server/api/error.js";
import { DriveFiles } from "@/models/index.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
secure: true,

View file

@ -4,7 +4,8 @@ import { resolveUser } from "@/remote/resolve-user.js";
import acceptAllFollowRequests from "@/services/following/requests/accept-all.js";
import { publishToFollowers } from "@/services/i/update.js";
import { publishMainStream } from "@/services/stream.js";
import { stringToAcct, DAY } from "backend-rs";
import { stringToAcct } from "backend-rs";
import { DAY } from "@/const.js";
import { apiLogger } from "@/server/api/logger.js";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";

View file

@ -1,6 +1,7 @@
import type { User } from "@/models/entities/user.js";
import { resolveUser } from "@/remote/resolve-user.js";
import { stringToAcct, DAY } from "backend-rs";
import { stringToAcct } from "backend-rs";
import { DAY } from "@/const.js";
import DeliverManager from "@/remote/activitypub/deliver-manager.js";
import { renderActivity } from "@/remote/activitypub/renderer/index.js";
import define from "@/server/api/define.js";

View file

@ -6,7 +6,8 @@ import { Users, UserProfiles } from "@/models/index.js";
import { sendEmail } from "@/services/send-email.js";
import { ApiError } from "@/server/api/error.js";
import { validateEmailForAccount } from "@/services/validate-email-for-account.js";
import { HOUR, verifyPassword } from "backend-rs";
import { verifyPassword } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
requireCredential: true,

View file

@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { MessagingMessages } from "@/models/index.js";
import { deleteMessage } from "@/services/messages/delete.js";
import { SECOND, HOUR } from "backend-rs";
import { SECOND, HOUR } from "@/const.js";
export const meta = {
tags: ["messaging"],

View file

@ -15,7 +15,7 @@ import { config } from "@/config.js";
import { noteVisibilities } from "@/types.js";
import { ApiError } from "@/server/api/error.js";
import define from "@/server/api/define.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
import { getNote } from "@/server/api/common/getters.js";
import { langmap } from "firefish-js";
import { createScheduledNoteJob } from "@/queue/index.js";

View file

@ -3,7 +3,7 @@ import { Users } from "@/models/index.js";
import define from "@/server/api/define.js";
import { getNote } from "@/server/api/common/getters.js";
import { ApiError } from "@/server/api/error.js";
import { SECOND, HOUR } from "backend-rs";
import { SECOND, HOUR } from "@/const.js";
export const meta = {
tags: ["notes"],

View file

@ -18,7 +18,8 @@ import { config } from "@/config.js";
import { noteVisibilities } from "@/types.js";
import { ApiError } from "@/server/api/error.js";
import define from "@/server/api/define.js";
import { genId, HOUR } from "backend-rs";
import { genId } from "backend-rs";
import { HOUR } from "@/const.js";
import { getNote } from "@/server/api/common/getters.js";
import { Poll } from "@/models/entities/poll.js";
import * as mfm from "mfm-js";

View file

@ -3,7 +3,7 @@ import { Notes } from "@/models/index.js";
import define from "@/server/api/define.js";
import { getNote } from "@/server/api/common/getters.js";
import { ApiError } from "@/server/api/error.js";
import { SECOND, HOUR } from "backend-rs";
import { SECOND, HOUR } from "@/const.js";
import { publishNoteStream } from "@/services/stream.js";
export const meta = {

View file

@ -2,7 +2,7 @@ import deleteReaction from "@/services/note/reaction/delete.js";
import define from "@/server/api/define.js";
import { getNote } from "@/server/api/common/getters.js";
import { ApiError } from "@/server/api/error.js";
import { SECOND, HOUR } from "backend-rs";
import { SECOND, HOUR } from "@/const.js";
export const meta = {
tags: ["reactions", "notes"],

View file

@ -3,7 +3,7 @@ import { Notes, Users } from "@/models/index.js";
import define from "@/server/api/define.js";
import { getNote } from "@/server/api/common/getters.js";
import { ApiError } from "@/server/api/error.js";
import { SECOND, HOUR } from "backend-rs";
import { SECOND, HOUR } from "@/const.js";
export const meta = {
tags: ["notes"],

View file

@ -1,5 +1,6 @@
import { Pages, DriveFiles } from "@/models/index.js";
import { genIdAt, HOUR } from "backend-rs";
import { genIdAt } from "backend-rs";
import { HOUR } from "@/const.js";
import { Page } from "@/models/entities/page.js";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";

View file

@ -2,7 +2,7 @@ import { Not } from "typeorm";
import { Pages, DriveFiles } from "@/models/index.js";
import define from "@/server/api/define.js";
import { ApiError } from "@/server/api/error.js";
import { HOUR } from "backend-rs";
import { HOUR } from "@/const.js";
export const meta = {
tags: ["pages"],

View file

@ -3,7 +3,8 @@ import { IsNull } from "typeorm";
import { config } from "@/config.js";
import { Users, UserProfiles, PasswordResetRequests } from "@/models/index.js";
import { sendEmail } from "@/services/send-email.js";
import { HOUR, genIdAt } from "backend-rs";
import { genIdAt } from "backend-rs";
import { HOUR } from "@/const.js";
import define from "@/server/api/define.js";
export const meta = {

View file

@ -5,7 +5,7 @@ import {
generateBlockedUserQuery,
generateBlockQueryForUsers,
} from "@/server/api/common/generate-block-query.js";
import { DAY } from "backend-rs";
import { DAY } from "@/const.js";
export const meta = {
tags: ["users"],

View file

@ -1,5 +1,5 @@
import { config } from "@/config.js";
import { FILE_TYPE_BROWSERSAFE } from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
import { countLocalUsers, fetchMeta } from "backend-rs";
import {
AnnouncementReads,

View file

@ -15,7 +15,7 @@ import { convertToWebp } from "@/services/drive/image-processor.js";
import { GenerateVideoThumbnail } from "@/services/drive/generate-video-thumbnail.js";
import { StatusError } from "@/misc/fetch.js";
import { ByteRangeReadable } from "./byte-range-readable.js";
import { FILE_TYPE_BROWSERSAFE } from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
import { inspect } from "node:util";
const _filename = fileURLToPath(import.meta.url);

View file

@ -9,7 +9,7 @@ import { createTemp } from "@/misc/create-temp.js";
import { downloadUrl } from "@/misc/download-url.js";
import { detectType } from "@/misc/get-file-info.js";
import { StatusError } from "@/misc/fetch.js";
import { FILE_TYPE_BROWSERSAFE } from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
import { serverLogger } from "../index.js";
import { isMimeImage } from "@/misc/is-mime-image.js";
import { inspect } from "node:util";

View file

@ -16,13 +16,12 @@ import { KoaAdapter } from "@bull-board/koa";
import { In, IsNull } from "typeorm";
import {
MINUTE,
DAY,
getNoteSummary,
stringToAcct,
fetchMeta,
metaToPugArgs,
} from "backend-rs";
import { MINUTE, DAY } from "@/const.js";
import { config } from "@/config.js";
import {
Users,

View file

@ -7,11 +7,11 @@ import sharp from "sharp";
import { IsNull } from "typeorm";
import { publishMainStream } from "@/services/stream.js";
import {
FILE_TYPE_BROWSERSAFE,
fetchMeta,
genId,
publishToDriveFileStream,
} from "backend-rs";
import { FILE_TYPE_BROWSERSAFE } from "@/const.js";
import { contentDisposition } from "@/misc/content-disposition.js";
import { getFileInfo } from "@/misc/get-file-info.js";
import {