Skip to content

Multiplayer v1 #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 154 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
f05c190
chore: update @atyrode/excalidraw dependency to version 0.18.0-12
atyrode May 12, 2025
ebc9dcd
chore: remove unused files and refactor authentication handling
atyrode May 12, 2025
82423bd
refactor: simplify Excalidraw integration and remove unused components
atyrode May 12, 2025
ca04896
refactor: clean up Vite configuration and comment out analytics captures
atyrode May 12, 2025
53a4a30
feat: enhance authentication handling and add status endpoint
atyrode May 12, 2025
7763166
simplified login flow
atyrode May 12, 2025
b7b0d98
refactor: streamline authentication popup handling and enhance UI com…
atyrode May 12, 2025
0e48412
feat: enhance session management and authentication flow
atyrode May 12, 2025
4b5bdba
refactor: clean up authentication router and improve logout error han…
atyrode May 12, 2025
fe4dd29
refactor: clean up imports and improve authentication state handling
atyrode May 12, 2025
c613993
feat: add padding configuration and improve iframe load timeout
atyrode May 12, 2025
9229c38
feat: integrate app configuration and PostHog initialization
atyrode May 12, 2025
75a7a36
refactor backend
atyrode May 13, 2025
5fe16bb
removed unused imports
atyrode May 13, 2025
8d1cf53
add domain classes
atyrode May 14, 2025
297ee32
moved session to domain object
atyrode May 14, 2025
1264a5b
pad_data now stores appstates separately
atyrode May 14, 2025
047372a
adapted pad_data to dict
atyrode May 14, 2025
3c304a9
remove coms
atyrode May 14, 2025
d4e997e
basic tabs implem
atyrode May 15, 2025
e9e1271
add hook for tab loading
atyrode May 15, 2025
ee5007b
add new pad button
atyrode May 15, 2025
342c4b1
load pad from api
atyrode May 15, 2025
94e8de4
removed double fetch on tab select
atyrode May 16, 2025
563844a
cache pads in redis
atyrode May 16, 2025
957b4fe
websocket basic implem
atyrode May 16, 2025
8a2e642
redis async
atyrode May 16, 2025
d25d195
stream only last messages
atyrode May 16, 2025
61108d2
debounce
atyrode May 16, 2025
2fb82ba
remove handle redis msg
atyrode May 16, 2025
5a8ce18
refactor: update @atyrode/excalidraw dependency to version 0.18.0-15 …
atyrode May 16, 2025
dd624bb
refactor: reorganize project structure by moving utility functions to…
atyrode May 16, 2025
6365d2c
add update and remove pad routes
atyrode May 16, 2025
f208051
feat: re-implement tab context menu and enhance tab management with n…
atyrode May 17, 2025
62f4213
feat: add DevTools component for collaboration event management and A…
atyrode May 17, 2025
74900ef
feat: integrate user authentication status in MainMenu component
atyrode May 17, 2025
32d31f5
fix delete
atyrode May 17, 2025
6642c05
feat: enhance pad management with optimistic temporary pad creation a…
atyrode May 17, 2025
906edf4
feat: update page title and add DevTools option in MainMenu for enhan…
atyrode May 17, 2025
26be48c
feat: add border offsets to customData in default.json and update pac…
atyrode May 17, 2025
7e214d9
refactor: update type imports and clean up unused hooks in App component
atyrode May 17, 2025
524e27c
fix tabs rename
atyrode May 17, 2025
02f0370
feat: enhance WebSocket connection management with connection state t…
atyrode May 17, 2025
8b9ce99
ignore /dev folder
cyclotruc May 17, 2025
a407db7
feat: notify clients of user join events in WebSocket connections
atyrode May 17, 2025
02130b2
Merge branch 'multiplayer' of https://github.com/pad-ws/pad.ws into m…
cyclotruc May 17, 2025
6c44124
feat: integrate React Query Devtools for improved debugging and updat…
atyrode May 17, 2025
91f8663
refactor: remove unused expires_in from WebSocket hook to streamline …
atyrode May 17, 2025
5f3694f
fix echoing authStatus
cyclotruc May 17, 2025
fb8cf79
keep websocket qlive betzeen refresh
cyclotruc May 17, 2025
2b09a6b
add reconect logic to websocket hook
cyclotruc May 17, 2025
1b9e7ac
simplify sendmessage
cyclotruc May 17, 2025
537c5ea
improved refresh and anthStatus
cyclotruc May 17, 2025
e5a0045
feat: enhance authentication handling and improve WebSocket connectio…
atyrode May 17, 2025
3c7a3eb
dev: update default pad configuration to use dev.json for development…
atyrode May 17, 2025
c50c0d1
refactor: break down ws_router into separate method
atyrode May 17, 2025
c187cb0
feat: include user ID in token data and update UserInfo interface to …
atyrode May 17, 2025
1eb5640
feat: add logging for received WebSocket messages in usePadWebSocket …
atyrode May 17, 2025
93dc9af
refactor: simplify DevTools component by removing unused state and UI…
atyrode May 17, 2025
370f33c
simplify websocket handling
cyclotruc May 17, 2025
1bed55a
fix: reference the correct state of connectWebsocket using useRef to …
atyrode May 17, 2025
6f41c4e
refactor: change console.log to console.debug for WebSocket message l…
atyrode May 17, 2025
b811b18
refactor: enhance message handling in WebSocket router by ensuring me…
atyrode May 17, 2025
0ea061c
feat: integrate react-use-websocket and zod for improved WebSocket me…
atyrode May 17, 2025
0f22b44
refactor: enhance logging format for received WebSocket messages in w…
atyrode May 17, 2025
ab9ee8a
refactor: replace debouncedSendMessage with useMemo for improved perf…
atyrode May 17, 2025
6425627
use connection_id rather than user_id for multiple tabs
cyclotruc May 17, 2025
e5b0abb
cleanup
cyclotruc May 17, 2025
ad79eeb
refactor: update timestamp handling in WebSocket router and validatio…
atyrode May 18, 2025
afd8ef7
refactor: remove precision requirement in websocket message schema
atyrode May 18, 2025
1a1b054
refactor: replace debounced function for pad updates with improved lo…
atyrode May 18, 2025
c51e8fc
basic pad monitoring script
cyclotruc May 18, 2025
65e0a5c
imrpoved script a bit
cyclotruc May 18, 2025
c3aa7f8
refactor: include user ID in auth status response
atyrode May 19, 2025
8027d89
refactor: replace console.log with console.debug for improved logging…
atyrode May 19, 2025
dfae77f
refactor: separate collaboration logic into Collab.tsx and add user_j…
atyrode May 19, 2025
a86c2e7
refactor: export UserInfo interface in useAuthStatus hook
atyrode May 19, 2025
ceba047
refactor: simplify debug logging in usePadWebSocket by removing pad I…
atyrode May 19, 2025
009552f
killed dead code
cyclotruc May 19, 2025
b3ce3cb
simplify cache error handling
cyclotruc May 19, 2025
ff8cfb0
use Redis singleton in pad
cyclotruc May 19, 2025
99aa19c
moved redis to dedicated cache submodule
cyclotruc May 19, 2025
1f623d8
improved cleanup after ws connection closed
cyclotruc May 19, 2025
3efd12f
add expiry to redis stream
cyclotruc May 19, 2025
c194f40
remove dead code
cyclotruc May 19, 2025
d51cf2b
add sharing policy and whitelist
cyclotruc May 20, 2025
bc977f5
sharing/whitelist API
cyclotruc May 20, 2025
f0fc1d3
basic sharing_policy selection in context menu
cyclotruc May 20, 2025
f2925cc
remove console.log
cyclotruc May 20, 2025
f47605c
ensure user exists
cyclotruc May 20, 2025
1f60fe0
dynamic join route
cyclotruc May 20, 2025
1a9dedb
improve context menu for url copying
cyclotruc May 20, 2025
a9280a4
remove unecessary cleanup
cyclotruc May 20, 2025
054a13a
cache sharing_policy and whitelist
cyclotruc May 20, 2025
e6387ae
join public rooms via url 😎
cyclotruc May 20, 2025
6b01344
fix dev env by enabling /pad to serve index from a proxy
cyclotruc May 21, 2025
9a68e48
Multiplayer collab frontend fixes (#96)
cyclotruc May 22, 2025
a0e1d25
style: enhance tab styles and functionality for public sharing policy
atyrode May 22, 2025
3978151
style: update tab dimensions and layout for improved UI
atyrode May 22, 2025
db69470
style: enhance tab component with overflow handling and layout adjust…
atyrode May 22, 2025
e056051
style: update tab icon dimensions and opacity
atyrode May 22, 2025
b950ae2
feat: implement granular scene synchronization in Collab
atyrode May 22, 2025
fdb8b28
Keep track of selected pad
cyclotruc May 22, 2025
fb1ce3b
feat: add comprehensive documentation for frontend collaboration mech…
atyrode May 23, 2025
9343125
dimmed down multiplayer button animations
cyclotruc May 23, 2025
7d8d12e
refactor: enhance backend fractional indexing management for collabor…
atyrode May 23, 2025
46866d3
Merge branch 'multiplayer-split-scene-updates' into multiplayer
atyrode May 23, 2025
747a9bb
style: update body background color
atyrode May 23, 2025
c503ec2
refactor: streamline app initialization and constants usage
atyrode May 23, 2025
ee0c9f1
refactor: reorganize SCSS structure and introduce new color and font …
atyrode May 23, 2025
b0b4178
style: update color variable organization in _colors.scss
atyrode May 23, 2025
94c463d
style: update SCSS for Excalidraw and color variables
atyrode May 23, 2025
48656bd
style: refine SCSS for modal backgrounds and accent colors
atyrode May 23, 2025
61483bf
style: enhance Excalidraw SCSS for context menu highlight colors
atyrode May 23, 2025
1c9ccc1
add pad worker to handle backend canvas sync
cyclotruc May 24, 2025
87c3b2b
saving updated canvas to cache
cyclotruc May 24, 2025
8372265
save to db periodically and on leave
cyclotruc May 24, 2025
d530bed
Update last selected pad when joining
cyclotruc May 24, 2025
946224f
Merge branch 'stylesheet-rework' into multiplayer
atyrode May 25, 2025
db97d60
refactor: re-integrate hooks into AccountDialog
atyrode May 25, 2025
2455bbe
remove noisy print
cyclotruc May 25, 2025
5b3ef68
Merge branch 'multiplayer' of https://github.com/pad-ws/pad.ws into m…
cyclotruc May 25, 2025
9cd5d4b
refactor: remove restore canvas functionality from SettingsDialog
atyrode May 25, 2025
3c42cd1
refactor: switch back to default.json for default canvas
atyrode May 25, 2025
7f8f834
removed unused script
cyclotruc May 25, 2025
ddf54d6
feat: re-implement workspace management hooks and state indicator
atyrode May 25, 2025
1b22a19
refactor: re-integrate ActionButton hooks and improve API props drill…
atyrode May 25, 2025
2cc6632
add periodic access check for ws tasks
cyclotruc May 25, 2025
e9740f6
improve appstate update
cyclotruc May 25, 2025
87fd05d
feat: add useCallbackRefState hook and update App component
atyrode May 25, 2025
07740b6
Merge branch 'multiplayer' of github.com:pad-ws/pad.ws into multiplayer
atyrode May 25, 2025
2867e20
refactor: update element retrieval to include deleted elements
atyrode May 25, 2025
9f32be6
refactor: re-integrate useWorkspace hook for dynamic workspace status…
atyrode May 25, 2025
8938dcb
refactor: re-integrate useAuthStatus hook for authentication management
atyrode May 25, 2025
23de504
debug: add console log for Coder OIDC session priming in AuthGate com…
atyrode May 25, 2025
c07c740
unmount tabs when not authenticated
cyclotruc May 25, 2025
ce0e941
feat: implement debounced app state broadcasting in Collab component
atyrode May 26, 2025
2e7f22b
refactor: remove unused viewport and follow functionality in Collab a…
atyrode May 26, 2025
91c5702
chore: remove outdated documentation files
atyrode May 26, 2025
ba96a00
feat: initialize elements and files in INITIAL_APP_DATA and normalize…
atyrode May 26, 2025
556193c
refactor: move collaboration constants for pointer throttling and per…
atyrode May 26, 2025
1f15e64
refactor: use INITIAL_APP_DATA for handleLogout in MainMenu.tsx
atyrode May 26, 2025
5167bac
Ignore appstate changes in websocket from back to front
cyclotruc May 26, 2025
20570d5
Ignore collaborators updates for appstate changes
cyclotruc May 27, 2025
f1e02b7
Ignore collaborators updates for appstate changes
cyclotruc May 27, 2025
138fcec
moved get_connected_users to domain class
cyclotruc May 27, 2025
d717e66
stop sending update on reload/temporary pad
cyclotruc May 27, 2025
dc8d008
refactor: remove button hover background variables from SCSS overrides
atyrode May 27, 2025
ecb1938
refactor: re-integrate telemetry hee-hee
atyrode May 27, 2025
8fe8d74
handle join mechanism with cookie
cyclotruc May 27, 2025
7b87437
condition loading PadData to being auth
cyclotruc May 27, 2025
5a80b86
only ensure user exists on login
cyclotruc May 27, 2025
cb606a4
fix prod serving not adding cookies on join
cyclotruc May 27, 2025
5d4d986
refactor: change console log to debug for scene updates in Collab com…
atyrode May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ src/excalidraw
.env
src/frontend/.env.local
.vscode/settings.json
dev/
172 changes: 0 additions & 172 deletions docs/context.md

This file was deleted.

137 changes: 0 additions & 137 deletions docs/frontend-backend-communication.md

This file was deleted.

3 changes: 3 additions & 0 deletions src/backend/cache/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .redis_client import RedisClient

__all__ = ["RedisClient"]
44 changes: 44 additions & 0 deletions src/backend/cache/redis_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
from redis import asyncio as aioredis
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

# Redis Configuration
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
REDIS_PASSWORD = os.getenv('REDIS_PASSWORD', None)
REDIS_PORT = int(os.getenv('REDIS_PORT', 6379))
REDIS_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}"

class RedisClient:
"""Service for managing Redis connections with proper lifecycle management."""

_instance = None

@classmethod
async def get_instance(cls) -> aioredis.Redis:
"""Get or create a Redis client instance."""
if cls._instance is None:
cls._instance = cls()
await cls._instance.initialize()
return cls._instance.client

def __init__(self):
self.client = None

async def initialize(self) -> None:
"""Initialize the Redis client."""
self.client = aioredis.from_url(
REDIS_URL,
password=REDIS_PASSWORD,
decode_responses=True,
health_check_interval=30
)

async def close(self) -> None:
"""Close the Redis client connection."""
if self.client:
await self.client.close()
self.client = None
print("Redis client closed.")
Loading