How xeravax/pishock-discord-activity works
PiShock Discord Activity is a React-based Discord Activity and Fastify API for consensual, multiplayer control of users’ linked PiShock devices. Users enter the Activity, link PiShock accounts, configure per-device limits and safety settings, then issue shock, vibrate, or beep commands; participants can share devices, with live updates and command logging. The server mediates control through PiShock APIs while persisting account/session and safety state. The map preserves documented sharing, announcements, and emergency-stop capabilities. Some route and client internals were not excerpted, so uncertain connections are omitted.
Main entry points: App.tsx Activity shell · control.ts Control routes · index.ts Fastify app · OfficialController.tsx Device controller
Components 23
Activity experience
- Activity shell
src/client/App.tsx - Device controller
src/client/components/OfficialController.tsx - Device cards
src/client/components/ShockerCard.tsx - Shares panel
src/client/components/SharesPanel.tsx - Announcements
src/client/components/AnnouncementBanner.tsx - Version badge
src/client/components/AppVersionBadge.tsx
Identity and sharing
- Discord auth
src/server/routes/auth.ts - PiShock linking
src/client/components/PiShockLinkingScreen.tsx - Account linking
src/server/routes/pishock-session.ts - PiShock auth API
src/server/pishock/auth-api.ts - Participant routes
src/server/routes/participants.ts
Safety and control
- Control routes
src/server/routes/control.ts - Operate policy
src/server/operate-policy.ts - Activity limits
src/server/limit-bands.ts - Command queue
src/server/pishock/command-queue.ts - PiShock broker
src/server/pishock/broker.ts - PiShock client
src/server/pishock/client.ts
Server platform
- Session and safety state
src/server/session.ts - PostgreSQL
src/server/db.ts - Realtime hub
src/server/realtime.ts - Fastify app
src/server/index.ts
Other components
- Discord user
- PiShock services
Connections 29
- Discord user → Activity shell: opens
README.md - Activity shell → Device controller: renders
src/client/App.tsx - Device controller → Device cards: renders
src/client/components/OfficialController.tsx - Activity shell → Shares panel: renders
src/client/App.tsx - Device controller → Announcements: renders
src/client/components/OfficialController.tsx - Device controller → Version badge: renders
src/client/components/OfficialController.tsx - Activity shell → Discord auth: authenticates via
README.md - Activity shell → PiShock linking: presents linking
README.md - PiShock linking → Account linking: submits login
README.md - Account linking → PiShock auth API: validates account
src/server/routes/pishock-session.ts - Account linking → Session and safety state: saves session
src/server/routes/pishock-session.ts - Activity shell → Participant routes: loads roster
src/client/App.tsx - Device controller → Control routes: sends commands
README.md - Control routes → Operate policy: checks policy
src/server/routes/control.ts - Control routes → Activity limits: checks limits
src/server/routes/control.ts - Control routes → Command queue: dispatches commands
src/server/routes/control.ts - Control routes → PiShock broker: operates devices
src/server/routes/control.ts - PiShock broker → PiShock client: calls API
src/server/pishock/broker.ts - PiShock client → PiShock services: requests device operations
README.md - Participant routes → PiShock broker: uses broker
src/server/routes/participants.ts - Participant routes → Activity limits: checks limits
src/server/routes/participants.ts - Participant routes → Session and safety state: reads state
src/server/routes/participants.ts - Session and safety state → PostgreSQL: persists state
src/server/session.ts - Fastify app → Discord auth: registers
src/server/index.ts - Fastify app → Account linking: registers
src/server/index.ts - Fastify app → Control routes: registers
src/server/index.ts - Fastify app → Participant routes: registers
src/server/index.ts - Fastify app → Realtime hub: attaches
src/server/index.ts - Realtime hub → Discord user: pushes live updates
README.md