mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-04-09 23:16:47 +02:00
enhance image verification by adding fallback for event image hash in KIND20Card and QuickViewKind20NoteCard
This commit is contained in:
@@ -49,7 +49,11 @@ const KIND20Card: React.FC<KIND20CardProps> = ({
|
||||
const verifyImage = async () => {
|
||||
try {
|
||||
// get hash of the image from event tags
|
||||
const eventImageHash = tags.find((tag) => tag[0] === "x")?.[1];
|
||||
let eventImageHash = tags.find((tag) => tag[0] === "x")?.[1];
|
||||
|
||||
if(!eventImageHash) {
|
||||
eventImageHash = tags.find((tag) => tag[0] === "imeta")?.find(tag => tag.startsWith("x"))?.split(" ")[1];
|
||||
}
|
||||
|
||||
if (eventImageHash) {
|
||||
// get blob from the image url
|
||||
|
||||
@@ -42,8 +42,12 @@ const QuickViewKind20NoteCard: React.FC<QuickViewKind20NoteCardProps> = ({ pubke
|
||||
const verifyImage = async () => {
|
||||
try {
|
||||
// get hash of the image from event tags
|
||||
const eventImageHash = tags.find((tag) => tag[0] === "x")?.[1];
|
||||
let eventImageHash = tags.find((tag) => tag[0] === "x")?.[1];
|
||||
|
||||
if(!eventImageHash) {
|
||||
eventImageHash = tags.find((tag) => tag[0] === "imeta")?.find(tag => tag.startsWith("x"))?.split(" ")[1];
|
||||
}
|
||||
|
||||
if (eventImageHash) {
|
||||
// get blob from the image url
|
||||
const response = await fetch(image);
|
||||
|
||||
Reference in New Issue
Block a user