mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-31 11:04:20 +01:00
revert changes to IPFSUploader and S3Uploader
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { NUploader } from '@nostrify/nostrify';
|
||||
import { z } from 'zod';
|
||||
import { getOptionalNip94Metadata } from '@/utils/image-metadata.ts';
|
||||
|
||||
export interface IPFSUploaderOpts {
|
||||
baseUrl: string;
|
||||
@@ -38,13 +37,12 @@ export class IPFSUploader implements NUploader {
|
||||
|
||||
const { Hash: cid } = IPFSUploader.schema().parse(await response.json());
|
||||
|
||||
return Object.entries({
|
||||
url: new URL(`/ipfs/${cid}`, this.baseUrl).toString(),
|
||||
m: file.type,
|
||||
cid,
|
||||
size: file.size.toString(),
|
||||
...await getOptionalNip94Metadata(file),
|
||||
}) as [['url', string], ...string[][]];
|
||||
return [
|
||||
['url', new URL(`/ipfs/${cid}`, this.baseUrl).toString()],
|
||||
['m', file.type],
|
||||
['cid', cid],
|
||||
['size', file.size.toString()],
|
||||
];
|
||||
}
|
||||
|
||||
async delete(cid: string, opts?: { signal?: AbortSignal }): Promise<void> {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { encodeHex } from '@std/encoding/hex';
|
||||
import { extensionsByType } from '@std/media-types';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { getOptionalNip94Metadata } from '@/utils/image-metadata.ts';
|
||||
|
||||
export interface S3UploaderOpts {
|
||||
endPoint: string;
|
||||
@@ -45,12 +44,14 @@ export class S3Uploader implements NUploader {
|
||||
|
||||
const path = (pathStyle && bucket) ? join(bucket, filename) : filename;
|
||||
|
||||
return Object.entries({
|
||||
url: new URL(path, Conf.mediaDomain).toString(),
|
||||
m: file.type,
|
||||
size: file.size.toString(),
|
||||
...await getOptionalNip94Metadata(file),
|
||||
}) as [['url', string], ...string[][]];
|
||||
const url = new URL(path, Conf.mediaDomain).toString();
|
||||
|
||||
return [
|
||||
['url', url],
|
||||
['m', file.type],
|
||||
['x', sha256],
|
||||
['size', file.size.toString()],
|
||||
];
|
||||
}
|
||||
|
||||
async delete(objectName: string) {
|
||||
|
||||
Reference in New Issue
Block a user