import * as security from './security.mjs' import * as formidable from './formidable.mjs' export default class MediaRoutes { constructor(opts = {}) { Object.assign(this, { security: opts.security || security, formidable: opts.formidable || formidable, }) } async upload(ctx) { let site = await this.security.verifyToken(ctx) let result = await this.formidable.uploadFile(ctx, site) ctx.body = { filename: result.filename, path: `/${site}/${result.filename}` } } }