diff --git a/packages/shell/src/index.ts b/packages/shell/src/index.ts index ec85ce6..9871876 100644 --- a/packages/shell/src/index.ts +++ b/packages/shell/src/index.ts @@ -8,6 +8,7 @@ import { getConfig } from './services/config' import type { ChronocatLogCurrentConfig } from './services/config/configEntity' import { emitter } from './services/emitter' import { l } from './services/logger' +import { mime } from './services/mime' import { getSelfProfile, setSelfProfile } from './services/selfProfile' import { uix } from './services/uix' import { validate } from './services/validate' @@ -50,6 +51,7 @@ export const chronocat = () => { getSelfProfile, h, l, + mime, platform: PLATFORM, sleep, timeout, diff --git a/packages/shell/src/services/mime.ts b/packages/shell/src/services/mime.ts new file mode 100644 index 0000000..4fcd625 --- /dev/null +++ b/packages/shell/src/services/mime.ts @@ -0,0 +1,7 @@ +// Should be 'mime/lite' but there's hoist pollution +import { Mime } from 'mime/dist/src/index_lite' +import mimeStandard from 'mime/types/standard.js' + +export const mime = new Mime().define(mimeStandard).define({ + 'audio/silk': ['slk', 'silk', 'ntsilk'], +}) diff --git a/packages/shell/src/types.ts b/packages/shell/src/types.ts index 117279e..ef8c76d 100644 --- a/packages/shell/src/types.ts +++ b/packages/shell/src/types.ts @@ -47,6 +47,7 @@ import type { ChronocatSatoriServerConfig, } from './services/config/configEntity' import type { l } from './services/logger' +import type { mime } from './services/mime' import type { getSelfProfile } from './services/selfProfile' import type { uix } from './services/uix' import type { validate } from './services/validate' @@ -65,6 +66,7 @@ export interface ChronocatContext { getSelfProfile: typeof getSelfProfile h: typeof h l: typeof l + mime: typeof mime platform: typeof PLATFORM sleep: typeof sleep timeout: typeof timeout