mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
fix: type error
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { utapi } from "../services/uploadthing/server";
|
||||
import sharp from "sharp";
|
||||
import sharp from 'sharp';
|
||||
import { utapi } from '../services/uploadthing/server';
|
||||
|
||||
export async function genIdenticonUpload(str: string, type?: string) {
|
||||
const identicon = await fetch(`https://api.dicebear.com/9.x/identicon/svg?seed=${str}&size=256`);
|
||||
@@ -7,13 +7,13 @@ export async function genIdenticonUpload(str: string, type?: string) {
|
||||
.webp({ quality: 80 })
|
||||
.toBuffer();
|
||||
|
||||
const file = new File([webpBuffer], `${str}${type ? `-${type}` : ""}.webp`, {
|
||||
type: "image/webp",
|
||||
const file = new File([new Uint8Array(webpBuffer)], `${str}${type ? `-${type}` : ''}.webp`, {
|
||||
type: 'image/webp',
|
||||
});
|
||||
const ul = await utapi.uploadFiles(file);
|
||||
if (ul.error) {
|
||||
throw new Error("Failed to upload identicon: " + ul.error);
|
||||
throw new Error('Failed to upload identicon: ' + ul.error);
|
||||
}
|
||||
|
||||
return ul.data?.ufsUrl
|
||||
}
|
||||
return ul.data?.ufsUrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user