- Added several new dependencies related to the Applesauce library, including 'applesauce-accounts', 'applesauce-common', 'applesauce-core', 'applesauce-loaders', 'applesauce-relay', and 'applesauce-signers', all at version 5.1.0. - Updated the development script in package.json to specify a port for Vite and added new seed scripts for profiles and activity. - Removed outdated image files from the public directory to clean up unused assets. - Enhanced the App.vue structure by integrating shared components like AppHeader and AuthModal for improved user experience. - Refactored ContentDetailModal and MobileNav components to support new features and improve usability. These changes improve the overall functionality and maintainability of the application while ensuring it utilizes the latest libraries for better performance.
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { Relay } from 'applesauce-relay'
|
|
import { PrivateKeySigner } from 'applesauce-signers/signers/private-key-signer'
|
|
import {
|
|
TEST_PERSONAS,
|
|
TASTEMAKER_PERSONAS,
|
|
} from '../src/data/testPersonas.js'
|
|
|
|
const RELAY_URL = 'ws://localhost:7777'
|
|
|
|
type Persona = { name: string; nsec: string; pubkey: string }
|
|
|
|
function buildProfile(persona: Persona, role: 'test' | 'tastemaker') {
|
|
const about =
|
|
role === 'tastemaker'
|
|
? `${persona.name} — tastemaker for IndeeHub`
|
|
: `${persona.name} — test persona for IndeeHub`
|
|
|
|
return {
|
|
name: persona.name,
|
|
display_name: persona.name,
|
|
about,
|
|
picture: `https://robohash.org/${persona.pubkey}.png`,
|
|
bot: true,
|
|
}
|
|
}
|
|
|
|
async function seedProfiles() {
|
|
const relay = new Relay(RELAY_URL)
|
|
|
|
const allPersonas: { persona: Persona; role: 'test' | 'tastemaker' }[] = [
|
|
...TEST_PERSONAS.map((p) => ({ persona: p as Persona, role: 'test' as const })),
|
|
...TASTEMAKER_PERSONAS.map((p) => ({ persona: p as Persona, role: 'tastemaker' as const })),
|
|
]
|
|
|
|
const now = Math.floor(Date.now() / 1000)
|
|
|
|
for (const { persona, role } of allPersonas) {
|
|
const signer = PrivateKeySigner.fromKey(persona.nsec)
|
|
const profile = buildProfile(persona, role)
|
|
|
|
const signed = await signer.signEvent({
|
|
kind: 0,
|
|
created_at: now,
|
|
tags: [],
|
|
content: JSON.stringify(profile),
|
|
})
|
|
|
|
try {
|
|
const res = await relay.publish(signed, { timeout: 5000 })
|
|
console.log(`✓ ${persona.name} (${role}): ${res.ok ? 'OK' : res.message}`)
|
|
} catch (err) {
|
|
console.error(`✗ ${persona.name} (${role}):`, err)
|
|
}
|
|
}
|
|
|
|
// Give relay time to flush, then exit
|
|
setTimeout(() => process.exit(0), 1000)
|
|
}
|
|
|
|
seedProfiles().catch((err) => {
|
|
console.error('Fatal:', err)
|
|
process.exit(1)
|
|
})
|