feat(shell): mime: implement extend mime svc

This commit is contained in:
Il Harper 2024-09-07 14:08:39 +08:00
parent c56844a5b4
commit 784966e4cc
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
3 changed files with 11 additions and 0 deletions

View File

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

View File

@ -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'],
})

View File

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