Skip to content

Commit

Permalink
feat: add imeta hash
Browse files Browse the repository at this point in the history
  • Loading branch information
v0l committed Dec 10, 2023
1 parent 735d5fd commit d167579
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/app/src/Element/Event/Create/NoteCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export function NoteCreator() {
if (rx.metadata.width && rx.metadata.height) {
imeta.push(`dim ${rx.metadata.width}x${rx.metadata.height}`);
}
if (rx.metadata.hash) {
imeta.push(`x ${rx.metadata.hash}`);
}
v.extraTags.push(imeta);
}
} else if (rx?.error) {
Expand Down Expand Up @@ -338,18 +341,18 @@ export function NoteCreator() {
onChange={e => {
note.update(
v =>
(v.selectedCustomRelays =
// set false if all relays selected
e.target.checked &&
(v.selectedCustomRelays =
// set false if all relays selected
e.target.checked &&
note.selectedCustomRelays &&
note.selectedCustomRelays.length == a.length - 1
? undefined
: // otherwise return selectedCustomRelays with target relay added / removed
a.filter(el =>
el === r
? e.target.checked
: !note.selectedCustomRelays || note.selectedCustomRelays.includes(el),
)),
? undefined
: // otherwise return selectedCustomRelays with target relay added / removed
a.filter(el =>
el === r
? e.target.checked
: !note.selectedCustomRelays || note.selectedCustomRelays.includes(el),
)),
);
}}
/>
Expand Down Expand Up @@ -418,9 +421,9 @@ export function NoteCreator() {
onChange={e =>
note.update(
v =>
(v.zapSplits = arr.map((vv, ii) =>
ii === i ? { ...vv, weight: Number(e.target.value) } : vv,
)),
(v.zapSplits = arr.map((vv, ii) =>
ii === i ? { ...vv, weight: Number(e.target.value) } : vv,
)),
)
}
/>
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/Upload/VoidCat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export default async function VoidCatUpload(

const ret = {
url: resultUrl,
metadata: {
hash: rsp.file?.metadata?.digest,
},
} as UploadResult;

if (publisher) {
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/Upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface UploadResult {
blurhash?: string;
width?: number;
height?: number;
hash?: string;
};
}

Expand Down

0 comments on commit d167579

Please sign in to comment.