Merge branch 'ditto-uploaders' into 'main'

Move uploaders into @ditto/uploaders

See merge request soapbox-pub/ditto!671
This commit is contained in:
Alex Gleason 2025-02-18 18:45:34 +00:00
commit 7ef4fcecd3
7 changed files with 19 additions and 7 deletions

View file

@ -5,7 +5,8 @@
"./packages/conf", "./packages/conf",
"./packages/db", "./packages/db",
"./packages/ditto", "./packages/ditto",
"./packages/metrics" "./packages/metrics",
"./packages/uploaders"
], ],
"tasks": { "tasks": {
"start": "deno run -A --env-file --deny-read=.env packages/ditto/server.ts", "start": "deno run -A --env-file --deny-read=.env packages/ditto/server.ts",

View file

@ -1,10 +1,8 @@
import { DenoUploader, IPFSUploader, S3Uploader } from '@ditto/uploaders';
import { BlossomUploader, NostrBuildUploader } from '@nostrify/nostrify/uploaders'; import { BlossomUploader, NostrBuildUploader } from '@nostrify/nostrify/uploaders';
import { safeFetch } from '@soapbox/safe-fetch'; import { safeFetch } from '@soapbox/safe-fetch';
import { AppMiddleware } from '@/app.ts'; import { AppMiddleware } from '@/app.ts';
import { DenoUploader } from '@/uploaders/DenoUploader.ts';
import { IPFSUploader } from '@/uploaders/IPFSUploader.ts';
import { S3Uploader } from '@/uploaders/S3Uploader.ts';
/** Set an uploader for the user. */ /** Set an uploader for the user. */
export const uploaderMiddleware: AppMiddleware = async (c, next) => { export const uploaderMiddleware: AppMiddleware = async (c, next) => {

View file

@ -1,10 +1,11 @@
import { join } from 'node:path'; import { join } from 'node:path';
import { NUploader } from '@nostrify/nostrify';
import { crypto } from '@std/crypto'; import { crypto } from '@std/crypto';
import { encodeHex } from '@std/encoding/hex'; import { encodeHex } from '@std/encoding/hex';
import { extensionsByType } from '@std/media-types'; import { extensionsByType } from '@std/media-types';
import type { NUploader } from '@nostrify/nostrify';
export interface DenoUploaderOpts { export interface DenoUploaderOpts {
baseUrl: string; baseUrl: string;
dir: string; dir: string;

View file

@ -1,6 +1,7 @@
import { NUploader } from '@nostrify/nostrify';
import { z } from 'zod'; import { z } from 'zod';
import type { NUploader } from '@nostrify/nostrify';
export interface IPFSUploaderOpts { export interface IPFSUploaderOpts {
baseUrl: string; baseUrl: string;
apiUrl?: string; apiUrl?: string;

View file

@ -1,11 +1,12 @@
import { join } from 'node:path'; import { join } from 'node:path';
import { S3Client } from '@bradenmacdonald/s3-lite-client'; import { S3Client } from '@bradenmacdonald/s3-lite-client';
import { NUploader } from '@nostrify/nostrify';
import { crypto } from '@std/crypto'; import { crypto } from '@std/crypto';
import { encodeHex } from '@std/encoding/hex'; import { encodeHex } from '@std/encoding/hex';
import { extensionsByType } from '@std/media-types'; import { extensionsByType } from '@std/media-types';
import type { NUploader } from '@nostrify/nostrify';
export interface S3UploaderOpts { export interface S3UploaderOpts {
endPoint: string; endPoint: string;
region: string; region: string;

View file

@ -0,0 +1,7 @@
{
"name": "@ditto/uploaders",
"version": "1.1.0",
"exports": {
".": "./mod.ts"
}
}

View file

@ -0,0 +1,3 @@
export { DenoUploader } from './DenoUploader.ts';
export { IPFSUploader } from './IPFSUploader.ts';
export { S3Uploader } from './S3Uploader.ts';