mirror of
https://github.com/dergigi/boris.git
synced 2026-01-20 23:34:52 +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.
84 lines
3.4 KiB
JavaScript
84 lines
3.4 KiB
JavaScript
import { ensureMarkedProfilePointerTag } from "../helpers/common-tags.js";
|
|
import { addNameValueTag, removeNameValueTag } from "./tag/common.js";
|
|
import * as Tags from "./tag/index.js";
|
|
import { includeSingletonTag, modifyPublicTags } from "./tags.js";
|
|
// Live Event (kind:30311) Operations
|
|
/** Sets the title of a live event */
|
|
export function setTitle(title) {
|
|
return includeSingletonTag(["title", title], true);
|
|
}
|
|
/** Sets the summary/description of a live event */
|
|
export function setSummary(summary) {
|
|
return includeSingletonTag(["summary", summary], true);
|
|
}
|
|
/** Sets the preview image for a live event */
|
|
export function setImage(image) {
|
|
return includeSingletonTag(["image", image], true);
|
|
}
|
|
/** Sets the streaming URL for a live event */
|
|
export function setStreamingUrl(url) {
|
|
return includeSingletonTag(["streaming", new URL(url).toString()], true);
|
|
}
|
|
/** Sets the recording URL for a live event (typically after the event ends) */
|
|
export function setRecordingUrl(url) {
|
|
return includeSingletonTag(["recording", new URL(url).toString()], true);
|
|
}
|
|
/** Sets the start timestamp for a live event */
|
|
export function setStartTime(start) {
|
|
const timestamp = typeof start === "number" ? start : Math.round(new Date(start).valueOf() / 1000);
|
|
return includeSingletonTag(["starts", String(timestamp)], true);
|
|
}
|
|
/** Sets the end timestamp for a live event */
|
|
export function setEndTime(end) {
|
|
const timestamp = typeof end === "number" ? end : Math.round(new Date(end).valueOf() / 1000);
|
|
return includeSingletonTag(["ends", String(timestamp)], true);
|
|
}
|
|
/** Sets the status of a live event */
|
|
export function setStatus(status) {
|
|
return includeSingletonTag(["status", status], true);
|
|
}
|
|
/** Sets the current number of participants */
|
|
export function setCurrentViewers(count) {
|
|
return includeSingletonTag(["current_participants", String(count)], true);
|
|
}
|
|
/** Sets the total number of participants */
|
|
export function setMaxViewers(count) {
|
|
return includeSingletonTag(["total_participants", String(count)], true);
|
|
}
|
|
/** Sets the host of the stream */
|
|
export function setHost(user) {
|
|
return modifyPublicTags((tags) => ensureMarkedProfilePointerTag(tags, user, "host"));
|
|
}
|
|
/** Adds a participant to a live event with role and optional relay */
|
|
export function addParticipant(user, role) {
|
|
return modifyPublicTags((tags) => ensureMarkedProfilePointerTag(tags, user, role));
|
|
}
|
|
/** Removes a participant from a live event */
|
|
export function removeParticipant(pubkey) {
|
|
return modifyPublicTags(removeNameValueTag(["p", pubkey]));
|
|
}
|
|
/** Adds a relay to the live event's relay list */
|
|
export function addRelay(relay) {
|
|
return modifyPublicTags(addNameValueTag(["relays", new URL(relay).toString()], true));
|
|
}
|
|
/** Removes a relay from the live event's relay list */
|
|
export function removeRelay(relay) {
|
|
return modifyPublicTags(removeNameValueTag(["relays", new URL(relay).toString()]));
|
|
}
|
|
/** Sets a pinned live chat message */
|
|
export function setPinnedMessage(eventId) {
|
|
return includeSingletonTag(["pinned", eventId], true);
|
|
}
|
|
/** Removes the pinned live chat message */
|
|
export function removePinnedMessage() {
|
|
return modifyPublicTags((tags) => tags.filter((tag) => tag[0] !== "pinned"));
|
|
}
|
|
/** Adds a hashtag to the live event */
|
|
export function addHashtag(hashtag) {
|
|
return modifyPublicTags(Tags.addHashtag(hashtag));
|
|
}
|
|
/** Removes a hashtag from the live event */
|
|
export function removeHashtag(hashtag) {
|
|
return modifyPublicTags(Tags.removeHashtag(hashtag));
|
|
}
|