mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-20 22:04:23 +01:00
Add a configUploader module to select the uploader based on config
This commit is contained in:
@@ -2,6 +2,7 @@ import { AppController } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
import { z } from '@/deps.ts';
|
||||
import { fileSchema } from '@/schema.ts';
|
||||
import { configUploader as uploader } from '@/uploaders/config.ts';
|
||||
import { parseBody } from '@/utils/web.ts';
|
||||
|
||||
const mediaBodySchema = z.object({
|
||||
@@ -20,7 +21,7 @@ const mediaController: AppController = async (c) => {
|
||||
|
||||
try {
|
||||
const { file, description } = result.data;
|
||||
const { cid } = await Conf.uploader.upload(file);
|
||||
const { cid } = await uploader.upload(file);
|
||||
|
||||
const url = new URL(`/ipfs/${cid}`, Conf.mediaDomain).toString();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user