refactor: remove size tag
This commit is contained in:
parent
f5784534d6
commit
b4cc59d25f
@ -4,7 +4,6 @@
|
|||||||
"content": "<long-description-pre-formatted>",
|
"content": "<long-description-pre-formatted>",
|
||||||
"tags": [
|
"tags": [
|
||||||
["title", "<torrent-title>"],
|
["title", "<torrent-title>"],
|
||||||
["size", "<size-in-bytes>"],
|
|
||||||
["btih", "<bittorrent-info-hash>"],
|
["btih", "<bittorrent-info-hash>"],
|
||||||
["t", "<top-level-tag>"],
|
["t", "<top-level-tag>"],
|
||||||
["t", "(optional)<second-level-tag>"],
|
["t", "(optional)<second-level-tag>"],
|
||||||
|
@ -31,7 +31,7 @@ export function TorrentList({ items }: { items: Array<TaggedNostrEvent> }) {
|
|||||||
function TorrentTableEntry({ item }: { item: TaggedNostrEvent }) {
|
function TorrentTableEntry({ item }: { item: TaggedNostrEvent }) {
|
||||||
const profile = useUserProfile(item.pubkey);
|
const profile = useUserProfile(item.pubkey);
|
||||||
const name = item.tags.find((a) => a[0] === "title")?.at(1);
|
const name = item.tags.find((a) => a[0] === "title")?.at(1);
|
||||||
const size = Number(item.tags.find((a) => a[0] === "size")?.at(1));
|
const size = item.tags.filter(a => a[0] === "file").map(a => Number(a[2])).reduce((acc, v) => acc += v, 0);
|
||||||
const npub = hexToBech32("npub", item.pubkey);
|
const npub = hexToBech32("npub", item.pubkey);
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -90,7 +90,6 @@ export function NewPage() {
|
|||||||
.kind(TorrentKind)
|
.kind(TorrentKind)
|
||||||
.content(obj.desc)
|
.content(obj.desc)
|
||||||
.tag(["title", obj.name])
|
.tag(["title", obj.name])
|
||||||
.tag(["size", String(obj.files.reduce((acc, v) => (acc += v.size), 0))])
|
|
||||||
.tag(["btih", obj.btih]);
|
.tag(["btih", obj.btih]);
|
||||||
|
|
||||||
obj.tags.forEach((t) => v.tag(["t", t]));
|
obj.tags.forEach((t) => v.tag(["t", t]));
|
||||||
|
@ -29,7 +29,7 @@ export function TorrentDetail({ item }: { item: TaggedNostrEvent }) {
|
|||||||
const login = useLogin();
|
const login = useLogin();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const name = item.tags.find((a) => a[0] === "title")?.at(1);
|
const name = item.tags.find((a) => a[0] === "title")?.at(1);
|
||||||
const size = Number(item.tags.find((a) => a[0] === "size")?.at(1));
|
const size = item.tags.filter(a => a[0] === "file").map(a => Number(a[2])).reduce((acc, v) => acc += v, 0);
|
||||||
const files = item.tags.filter((a) => a[0] === "file");
|
const files = item.tags.filter((a) => a[0] === "file");
|
||||||
const tags = item.tags.filter((a) => a[0] === "t").map((a) => a[1]);
|
const tags = item.tags.filter((a) => a[0] === "t").map((a) => a[1]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user