OverviewFilesCommitsIssuesDocsReleasesPeers

hypercore-kb / hyper-social / hyper-social-web / index.js

33 lines · javascript ref:
#!/usr/bin/env bare

/**
 * hyper-social-web — POSSE Social Network Client
 *
 * Unified timeline and cross-posting for Mastodon, Bluesky, and Instagram.
 * Publish once, syndicate everywhere.
 */

await import('bare-node-runtime/global')

import { createServer } from './lib/server.js'

const args = process.argv.slice(2)

const cmd = args[0] || 'serve'

if (cmd === 'serve') {
  const portIdx = args.indexOf('--port')
  const port = portIdx !== -1 ? Number(args[portIdx + 1]) : 5050

  const prefixIdx = args.indexOf('--prefix')
  const prefix = prefixIdx !== -1 ? args[prefixIdx + 1] : ''

  const storageIdx = args.indexOf('--storage')
  const storage = storageIdx !== -1 ? args[storageIdx + 1] : null

  const server = await createServer({ port, prefix, storage })
  console.log(`[hyper-social-web] v0.1.0 listening on http://localhost:${port}${prefix}/`)
} else {
  console.log('Usage: bare index.js serve [--port 5050] [--prefix /social] [--storage ./data]')
}