Enhance deployment script and update package dependencies
- Added detailed labels to the deployment script for IndeedHub, including title, version, description, license, icon, and repository URL. - Updated package dependencies in package.json and package-lock.json, including upgrading 'nostr-tools' to version 2.23.0 and adding 'axios' and '@tanstack/vue-query'. - Improved README with a modern description of the platform and updated project structure details. This commit enhances the clarity of the deployment process and ensures the project is using the latest dependencies for better performance and features.
This commit is contained in:
218
src/data/mockSocialData.ts
Normal file
218
src/data/mockSocialData.ts
Normal file
@@ -0,0 +1,218 @@
|
||||
/**
|
||||
* Mock Social Data for Development Mode
|
||||
* Provides realistic comments, reactions, and profiles without Nostr relays
|
||||
*/
|
||||
|
||||
export interface MockProfile {
|
||||
name: string
|
||||
picture: string
|
||||
about: string
|
||||
npub: string
|
||||
pubkey: string
|
||||
}
|
||||
|
||||
export interface MockComment {
|
||||
id: string
|
||||
pubkey: string
|
||||
content: string
|
||||
created_at: number
|
||||
kind: 1
|
||||
tags: string[][]
|
||||
sig: string
|
||||
}
|
||||
|
||||
export interface MockReaction {
|
||||
id: string
|
||||
pubkey: string
|
||||
content: '+' | '-'
|
||||
created_at: number
|
||||
kind: 17
|
||||
tags: string[][]
|
||||
sig: string
|
||||
}
|
||||
|
||||
// Mock Nostr profiles
|
||||
export const mockProfiles: MockProfile[] = [
|
||||
{
|
||||
name: 'BitcoinFilmFan',
|
||||
picture: 'https://api.dicebear.com/7.x/avataaars/svg?seed=BitcoinFilmFan',
|
||||
about: 'Independent film lover and Bitcoin enthusiast.',
|
||||
npub: 'npub1mockuser1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
pubkey: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f60001',
|
||||
},
|
||||
{
|
||||
name: 'CinephileMax',
|
||||
picture: 'https://api.dicebear.com/7.x/avataaars/svg?seed=CinephileMax',
|
||||
about: 'Watching everything, one film at a time.',
|
||||
npub: 'npub1mockuser2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
pubkey: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f60002',
|
||||
},
|
||||
{
|
||||
name: 'DocuLover',
|
||||
picture: 'https://api.dicebear.com/7.x/avataaars/svg?seed=DocuLover',
|
||||
about: 'Documentaries are the highest form of cinema.',
|
||||
npub: 'npub1mockuser3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
pubkey: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f60003',
|
||||
},
|
||||
{
|
||||
name: 'SatoshiScreens',
|
||||
picture: 'https://api.dicebear.com/7.x/avataaars/svg?seed=SatoshiScreens',
|
||||
about: 'Film meets freedom tech. V4V.',
|
||||
npub: 'npub1mockuser4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
pubkey: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f60004',
|
||||
},
|
||||
{
|
||||
name: 'IndieFilmNerd',
|
||||
picture: 'https://api.dicebear.com/7.x/avataaars/svg?seed=IndieFilmNerd',
|
||||
about: 'Supporting independent filmmakers everywhere.',
|
||||
npub: 'npub1mockuser5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
pubkey: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f60005',
|
||||
},
|
||||
]
|
||||
|
||||
// Comment templates per content ID
|
||||
const commentTemplates: Record<string, string[]> = {
|
||||
'god-bless-bitcoin': [
|
||||
'This documentary completely changed how I think about Bitcoin and faith. Must watch.',
|
||||
'Incredible storytelling. The parallels between monetary sovereignty and spiritual freedom are powerful.',
|
||||
'Shared this with my entire church group. Everyone was blown away.',
|
||||
'Finally a Bitcoin documentary that goes beyond the price charts. Beautiful work.',
|
||||
],
|
||||
'thethingswecarry': [
|
||||
'Such a deeply emotional film. Brought me to tears.',
|
||||
'The cinematography is stunning. Every frame tells a story.',
|
||||
'This is what independent cinema should be. Raw and real.',
|
||||
],
|
||||
'duel': [
|
||||
'Edge-of-your-seat tension from start to finish. Brilliant directing.',
|
||||
'The performances are incredible. You can feel the weight of every decision.',
|
||||
'Rewatched this three times already. Catches something new each time.',
|
||||
],
|
||||
}
|
||||
|
||||
// Generic comments for content without specific templates
|
||||
const genericComments = [
|
||||
'Really enjoyed this one. Great production quality.',
|
||||
'IndeeHub keeps finding amazing content. This platform is the future.',
|
||||
'Watching this made my evening. Highly recommend.',
|
||||
'The filmmakers clearly put their heart into this. It shows.',
|
||||
'More people need to see this. Sharing with everyone I know.',
|
||||
'Just finished watching. Need a moment to process how good that was.',
|
||||
'This is why I subscribe. Quality content that you can not find elsewhere.',
|
||||
'Beautiful film. The score and visuals work perfectly together.',
|
||||
]
|
||||
|
||||
/**
|
||||
* Generate a mock event ID (hex string)
|
||||
*/
|
||||
function mockEventId(seed: number): string {
|
||||
return seed.toString(16).padStart(64, '0')
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a mock signature (hex string)
|
||||
*/
|
||||
function mockSig(seed: number): string {
|
||||
return seed.toString(16).padStart(128, 'f')
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mock comments for a given content ID
|
||||
*/
|
||||
export function getMockComments(contentId: string): MockComment[] {
|
||||
const templates = commentTemplates[contentId] || genericComments
|
||||
const now = Math.floor(Date.now() / 1000)
|
||||
|
||||
// Pick 3-5 comments
|
||||
const count = 3 + Math.floor(Math.abs(hashCode(contentId)) % 3)
|
||||
const comments: MockComment[] = []
|
||||
|
||||
for (let i = 0; i < count && i < templates.length; i++) {
|
||||
const profile = mockProfiles[i % mockProfiles.length]
|
||||
const hoursAgo = (i + 1) * 3 + Math.floor(Math.abs(hashCode(contentId + i)) % 12)
|
||||
|
||||
comments.push({
|
||||
id: mockEventId(hashCode(contentId + 'comment' + i)),
|
||||
pubkey: profile.pubkey,
|
||||
content: templates[i % templates.length],
|
||||
created_at: now - hoursAgo * 3600,
|
||||
kind: 1,
|
||||
tags: [['i', `https://indeedhub.com/content/${contentId}`, 'text']],
|
||||
sig: mockSig(hashCode(contentId + 'sig' + i)),
|
||||
})
|
||||
}
|
||||
|
||||
return comments.sort((a, b) => b.created_at - a.created_at)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mock reactions for a given content ID
|
||||
*/
|
||||
export function getMockReactions(contentId: string): MockReaction[] {
|
||||
const reactions: MockReaction[] = []
|
||||
const now = Math.floor(Date.now() / 1000)
|
||||
|
||||
// Generate between 5-15 reactions
|
||||
const count = 5 + Math.floor(Math.abs(hashCode(contentId)) % 11)
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const profile = mockProfiles[i % mockProfiles.length]
|
||||
// ~80% positive reactions
|
||||
const isPositive = (hashCode(contentId + 'react' + i) % 10) < 8
|
||||
|
||||
reactions.push({
|
||||
id: mockEventId(hashCode(contentId + 'reaction' + i)),
|
||||
pubkey: profile.pubkey + i.toString(16).padStart(4, '0'),
|
||||
content: isPositive ? '+' : '-',
|
||||
created_at: now - i * 1800,
|
||||
kind: 17,
|
||||
tags: [['i', `https://indeedhub.com/content/${contentId}`, 'text']],
|
||||
sig: mockSig(hashCode(contentId + 'reactsig' + i)),
|
||||
})
|
||||
}
|
||||
|
||||
return reactions
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mock reaction counts for a content ID (quick lookup without generating all events)
|
||||
*/
|
||||
export function getMockReactionCounts(contentId: string): { positive: number; negative: number; total: number } {
|
||||
const seed = Math.abs(hashCode(contentId))
|
||||
const total = 5 + (seed % 11)
|
||||
const positive = Math.floor(total * 0.8)
|
||||
const negative = total - positive
|
||||
return { positive, negative, total: positive - negative }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mock comment count for a content ID (quick lookup)
|
||||
*/
|
||||
export function getMockCommentCount(contentId: string): number {
|
||||
const templates = commentTemplates[contentId]
|
||||
if (templates) {
|
||||
return 3 + Math.floor(Math.abs(hashCode(contentId)) % Math.min(3, templates.length))
|
||||
}
|
||||
return 3 + Math.floor(Math.abs(hashCode(contentId)) % 3)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mock profile by pubkey
|
||||
*/
|
||||
export function getMockProfile(pubkey: string): MockProfile | undefined {
|
||||
return mockProfiles.find((p) => pubkey.startsWith(p.pubkey.slice(0, 20)))
|
||||
|| mockProfiles[Math.abs(hashCode(pubkey)) % mockProfiles.length]
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple hash function for deterministic results from strings
|
||||
*/
|
||||
function hashCode(str: string): number {
|
||||
let hash = 0
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str.charCodeAt(i)
|
||||
hash = ((hash << 5) - hash) + char
|
||||
hash |= 0 // Convert to 32bit integer
|
||||
}
|
||||
return hash
|
||||
}
|
||||
Reference in New Issue
Block a user