feat: add imeta hash

This commit is contained in:
Kieran 2023-12-10 17:19:09 +00:00
parent 735d5fd5a5
commit d167579348
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
3 changed files with 20 additions and 13 deletions

View File

@ -215,6 +215,9 @@ export function NoteCreator() {
if (rx.metadata.width && rx.metadata.height) { if (rx.metadata.width && rx.metadata.height) {
imeta.push(`dim ${rx.metadata.width}x${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); v.extraTags.push(imeta);
} }
} else if (rx?.error) { } else if (rx?.error) {
@ -338,18 +341,18 @@ export function NoteCreator() {
onChange={e => { onChange={e => {
note.update( note.update(
v => v =>
(v.selectedCustomRelays = (v.selectedCustomRelays =
// set false if all relays selected // set false if all relays selected
e.target.checked && e.target.checked &&
note.selectedCustomRelays && note.selectedCustomRelays &&
note.selectedCustomRelays.length == a.length - 1 note.selectedCustomRelays.length == a.length - 1
? undefined ? undefined
: // otherwise return selectedCustomRelays with target relay added / removed : // otherwise return selectedCustomRelays with target relay added / removed
a.filter(el => a.filter(el =>
el === r el === r
? e.target.checked ? e.target.checked
: !note.selectedCustomRelays || note.selectedCustomRelays.includes(el), : !note.selectedCustomRelays || note.selectedCustomRelays.includes(el),
)), )),
); );
}} }}
/> />
@ -418,9 +421,9 @@ export function NoteCreator() {
onChange={e => onChange={e =>
note.update( note.update(
v => v =>
(v.zapSplits = arr.map((vv, ii) => (v.zapSplits = arr.map((vv, ii) =>
ii === i ? { ...vv, weight: Number(e.target.value) } : vv, ii === i ? { ...vv, weight: Number(e.target.value) } : vv,
)), )),
) )
} }
/> />

View File

@ -62,6 +62,9 @@ export default async function VoidCatUpload(
const ret = { const ret = {
url: resultUrl, url: resultUrl,
metadata: {
hash: rsp.file?.metadata?.digest,
},
} as UploadResult; } as UploadResult;
if (publisher) { if (publisher) {

View File

@ -27,6 +27,7 @@ export interface UploadResult {
blurhash?: string; blurhash?: string;
width?: number; width?: number;
height?: number; height?: number;
hash?: string;
}; };
} }