This commit is contained in:
thePR0M3TH3AN committed 2025-11-12 11:06:10 -05:00
1 parent 000127f88c
commit 071d78dd6c
194 files changed
+28793 -3944

No files matched your search

@@ -100,7 +100,7 @@ Add placeholders for different views in `index.html`:
- Fetch videos (`kind 30078`) filtered by the user's `npub`.
### **Subscriptions**
- Use `kind 30002` to manage the subscription list:
- Use `kind 30000` to manage the subscription follow set:
- Subscribe: Add user to the list.
- Unsubscribe: Remove user.
@@ -47,8 +47,8 @@ This document describes how to implement **Block Lists**, **Subscription Lists**
A **Subscription List** lets users follow video creators independently of their main “following” list on Nostr. It supports categorization and can be made private via encryption.
### Event Kind
- **Kind**: `30002`
- **Description**: “Video Subscription List” (inspired by NIP-51 but for custom lists)
- **Kind**: `30000`
- **Description**: “Video Subscription Follow Set” aligned with [NIP-51 follow sets](../../docs/nips/51.md#sets)
### JSON Structure
**Public Tags**
@@ -64,7 +64,7 @@ A **Subscription List** lets users follow video creators independently of their
### Example
```json
{
"kind": 30002,
"kind": 30000,
"tags": [
["d", "favorite-creators"],
["p", "npub1creator1pubkey"],
@@ -208,7 +208,7 @@ The `p` tag references a pubkey, and the `e` tag references a note. The third el
## Implementation Details
### Replaceable Events
- **Subscription Lists** (`30002`) and **Block Lists** (`10001`) can be implemented as replaceable events by using a deterministic `d` tag.
- **Subscription Lists** (`30000`) and **Block Lists** (`10001`) can be implemented as replaceable events by using a deterministic `d` tag.
- For example, `["d","my-blocklist"]` ensures older events with the same `d` are replaced when new ones arrive.
### Encryption
@@ -220,7 +220,7 @@ The `p` tag references a pubkey, and the `e` tag references a note. The third el
- Query each relay for events matching:
```jsonc
{
"kinds": [10001, 30002],
"kinds": [10001, 30000],
"authors": [<user-pubkey>]
}
```
@@ -275,7 +275,7 @@ The `p` tag references a pubkey, and the `e` tag references a note. The third el
## Future Considerations
1. **Paid Subscriptions**
- Could layer subscription tiers on top of `30002` events.
- Could layer subscription tiers on top of `30000` events.
2. **Global Block Lists**
- Let users publish or subscribe to a curated blocklist (or share one in a group).
3. **Web of Trust**
@@ -284,4 +284,4 @@ The `p` tag references a pubkey, and the `e` tag references a note. The third el
---
### Summary
By leveraging Nostr event kinds (`30002` for subscriptions, `10001` for blocks, and `1984` for reports), bitvid can maintain a decentralized, user-controlled moderation system. Users can sync their lists across devices through relays, while administrators can choose how to handle flagged content on a platform level. This approach keeps moderation flexible and transparent.
By leveraging Nostr event kinds (`30000` for subscriptions, `10001` for blocks, and `1984` for reports), bitvid can maintain a decentralized, user-controlled moderation system. Users can sync their lists across devices through relays, while administrators can choose how to handle flagged content on a platform level. This approach keeps moderation flexible and transparent.
@@ -8,10 +8,10 @@ To implement a decentralized comment system for videos shared on a Nostr-based p
### **Features**
1. **Post Comments**:
- Users can post comments on videos.
- Comments are associated with a specific video event using the `e` tag.
- Comments scope to the video definition or root event with NIP-22 uppercase tags (`A`/`E`/`I`, `K`, `P`) while still emitting lowercase fallbacks for legacy clients.
2. **Structured Threading**:
- Comments support threading by referencing parent comments using NIP-27 conventions.
- Comments support threading by referencing parent comments with the lowercase NIP-22 set (`a`/`e`/`i`, `k`, `p`).
- Threaded replies are visually nested.
3. **Reactions**:
@@ -40,18 +40,21 @@ To implement a decentralized comment system for videos shared on a Nostr-based p
Each component (comments, reactions, live chat) is represented as a Nostr event.
##### **Comment Event**:
bitvid uses standard kind `1` text note replies so they interoperate with the moderation flows documented in [`docs/moderation/nips.md`](../../docs/moderation/nips.md). Each reply keeps both the video event ID and the root video definition tag so downstream services can resolve lineage.
bitvid publishes kind `1111` comments following [NIP-22](https://github.com/nostr-protocol/nips/blob/master/22.md). Each event declares its root scope with uppercase tags and keeps the lowercase fallbacks so legacy clients continue to render threads.
```json
{
"kind": 1,
"kind": 1111,
"pubkey": "abcdef1234567890...",
"created_at": 1675000000,
"tags": [
["e", "video-event-id"], // Reference to the specific video event
["a", "30078:video-author-pubkey:video-root-id"], // Reference to the video definition (kind 30078)
["e", "parent-comment-id"], // Optional: reference to the parent comment for replies
["p", "commenter-pubkey"] // Optional: commenter or video author pubkey for threading UX
["A", "30078:video-author-pubkey:video-root-id", "wss://video.example"],
["K", "30078"],
["P", "video-author-pubkey", "wss://video.example"],
["a", "30078:video-author-pubkey:video-root-id", "wss://video.example"],
["e", "parent-comment-id", "parent-author-pubkey"],
["k", "1111"],
["p", "parent-author-pubkey"]
],
"content": "This is a great video!"
}
@@ -89,7 +92,7 @@ bitvid uses standard kind `1` text note replies so they interoperate with the mo
Metadata tags are added to comments or live chat events as needed:
```json
{
"kind": 1,
"kind": 1111,
"pubkey": "abcdef1234567890...",
"created_at": 1675000000,
"tags": [
@@ -108,8 +111,8 @@ Metadata tags are added to comments or live chat events as needed:
#### **1. Posting a Comment**
To post a comment:
1. The client constructs a kind `1` comment event using NIP-22 for `created_at` validation.
2. The event includes both the `['e', <videoEventId>]` and `['a', <30078:pubkey:videoRootId>]` tags (mandatory) plus parent comment references when replying. This mirrors the implementation in `js/services/discussionCountService.js` so reply counts and moderation filters remain aligned.
1. The client constructs a kind `1111` comment event following NIP-22 threading semantics.
2. The event includes uppercase root scope tags (`['A'\|`E`\|`I`, <pointer>], `['K', <root kind>]`, `['P', <root author>]`) and carries lowercase fallbacks (`['a', ...]`, `['e', ...]`, `['k', ...]`, `['p', ...]`) for older relays and clients. Parent references append `['e', <parent id>, <relay?>?, <author?>]`, `['k', <parent kind>]`, and `['p', <parent author>]` when available.
3. The event is signed and published to relays.
##### API Example:
@@ -120,13 +123,21 @@ async function postComment(
parentCommentId = null
) {
const event = {
kind: 1,
kind: 1111,
pubkey: userPubkey,
created_at: Math.floor(Date.now() / 1000),
tags: [
['e', videoEventId],
['A', `30078:${videoAuthorPubkey}:${videoRootId}`],
['K', '30078'],
['P', videoAuthorPubkey],
['a', `30078:${videoAuthorPubkey}:${videoRootId}`],
...(parentCommentId ? [['e', parentCommentId]] : []),
...(parentCommentId
? [
['e', parentCommentId, videoAuthorPubkey],
['k', '1111'],
['p', videoAuthorPubkey],
]
: [['k', '30078'], ['p', videoAuthorPubkey]]),
],
content: commentText
};
@@ -162,7 +173,7 @@ Comments are retrieved using `REQ` messages filtered by the `e` tag for the vide
```javascript
async function fetchComments({ videoEventId, videoAuthorPubkey, videoRootId }) {
const filter = {
kinds: [1],
kinds: [1111],
'#e': [videoEventId],
'#a': [`30078:${videoAuthorPubkey}:${videoRootId}`],
limit: 100
@@ -87,7 +87,7 @@ Rather than measuring active peers, bitvid now counts views by logging them as N
- Compare the count of new views against a previous period, or calculate the rate of increase.
3. **For You**
- Look at what the user watched or subscribed to (via kind `30002` subscription lists).
- Look at what the user watched or subscribed to (via kind `30000` subscription follow sets).
- Track the user’s or session’s recent view tags, then recommend videos with overlapping tags or from the same channels.
---
@@ -124,7 +124,7 @@ Your `index.html` might include placeholders for each section:
1. **Fetch Data**
- Pull video metadata from kind `30078` events that contain video info or from your existing approach.
- Pull subscription data (kind `30002`).
- Pull subscription data (kind `30000`).
- Pull view events (kind `30078` with `"t", "view"`).
2. **Process Rankings**