mirror of
https://github.com/dergigi/boris.git
synced 2026-01-24 01:04:29 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
23 lines
1014 B
JavaScript
23 lines
1014 B
JavaScript
import { ensureNamedValueTag } from "../helpers/tag.js";
|
|
import { createGroupHTagFromGroupPointer } from "../helpers/groups.js";
|
|
import { includeSingletonTag } from "./tags.js";
|
|
/** Sets the "h" tag for NIP-29 group messages or other events */
|
|
export function setGroupPointer(group) {
|
|
return includeSingletonTag(createGroupHTagFromGroupPointer(group), true);
|
|
}
|
|
/** Adds "previous" tags for group messages */
|
|
export function addPreviousRefs(previous, count = 6) {
|
|
return (draft) => {
|
|
let tags = Array.from(draft.tags);
|
|
// sort previous events by date and limit to 50
|
|
const sorted = previous.sort((a, b) => b.created_at - a.created_at).slice(0, 50);
|
|
for (let i = 0; i < count; i++) {
|
|
const index = Math.round(Math.random() * (sorted.length - 1));
|
|
const event = sorted.splice(index, 1)[0];
|
|
if (event)
|
|
tags = ensureNamedValueTag(tags, ["previous", event.id.slice(0, 8)]);
|
|
}
|
|
return { ...draft, tags };
|
|
};
|
|
}
|