forked from sai-educ/TeachBound
-
Notifications
You must be signed in to change notification settings - Fork 0
Add libp2p #1
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
Open
Yuliia05
wants to merge
27
commits into
main
Choose a base branch
from
add-libp2p
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add libp2p #1
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a2b2f0a
[LibP2P] First steps
b62f375
Submodule git fix
431edaa
fixed .gitignore and removed node_modules
8f6f2aa
libp2p baseline alignment
Yuliia05 1010939
browser2browser WebRTC + signaling server
Yuliia05 9e0ee34
React lifecycle + status UI
62e3ca9
Message envelope + dedupe + event types
85a600a
whiteboard event sync (upsert/delete/clear) & unique IDs & no rebroad…
c3e5ef6
late-join snapshot sync (request/response)
ee23652
debug UX + manual resync
415c769
Add shared formatting configs (EditorConfig/Prettier) + ESLint rc files
437689a
style: apply `npx prettier --write .`
MAKMED1337 322b269
Fix webrtc-star runtime compat (multiaddr polyfills, publish error ha…
1acc60b
Fix Jest tests for P2P/Canvas environment
f914027
Use @libp2p/webrtc, circuit-relay-v2, websockets
df0d608
switched libp2p-gossipsub -> libp2p/floodsub, several other fixes
8af36d6
feat: make host reuse the same peer id across restarts
MAKMED1337 fe5dc6c
feat: add PKGBUILD
MAKMED1337 07784bf
fix: host PKGBUILD binary and add maintainers
MAKMED1337 123ebfd
feat: replace env vars with localStorage config + settings button for…
94d8d33
fix(p2p): handle prompt() errors and remove auto-prompt on load
ecbff05
fix(p2p): prevent message feedback loop with content-based comparison
f7d841d
fix(p2p): prevent local strokes from being discarded by P2P updates
4dd0a9f
fix(p2p): validate historyStep bounds and add debug logging
3a1c5ea
fix: preserve localStorage data on refresh and fix save condition
fc73e86
chore: remove debug logging
0df7915
feat: add systemctl service file
MAKMED1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| indent_style = space | ||
| indent_size = 2 | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| **/node_modules/** | ||
| **/build/** | ||
| **/coverage/** | ||
| **/.cache/** | ||
| **/dist/** | ||
| **/.next/** | ||
| **/.turbo/** | ||
|
|
||
| # Lockfiles (avoid noisy diffs) | ||
| **/package-lock.json | ||
| **/yarn.lock | ||
| **/pnpm-lock.yaml | ||
|
|
||
| # Assets | ||
| **/public/** | ||
| **/*.svg | ||
| **/*.png | ||
| **/*.jpg | ||
| **/*.jpeg | ||
| **/*.gif | ||
| **/*.ico | ||
| **/*.webp | ||
|
|
||
| # Local/CI tooling | ||
| .cursor/** | ||
| changes.txt | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "printWidth": 100, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "semi": true, | ||
| "singleQuote": true, | ||
| "trailingComma": "es5", | ||
| "bracketSpacing": true, | ||
| "arrowParens": "always", | ||
| "endOfLine": "lf" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| REACT_APP_P2P_HOST=/dns/jamboard.shitpost.monster/tcp/500/wss/p2p/12D3KooWBhg2PnQpvVxANn8Nq2f4YDjBdfsrUXZDfdXMJtxBQ9cP | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "root": true, | ||
| "extends": ["react-app", "react-app/jest"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.js | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # production | ||
| /build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Maintainers: Andrii Stolitnii <andrii.stolitnii@student.uj.edu.pl>, Eduard Tykhoniuk <eduard.tykhoniuk@student.uj.edu.pl>, Yuliia Tatarinova <yuliia.tatarinova@student.uj.edu.pl> | ||
| pkgname=('TeachBound-client') | ||
| pkgver=0.2.0 | ||
| pkgrel=1 | ||
| pkgdesc="Digital Whiteboard for Education and Collaboration" | ||
| arch=(any) | ||
| url="https://github.com/welleyth/TeachBound" | ||
| license=('CC BY-NC 4.0') | ||
| depends=('nodejs' 'python') | ||
| makedepends=('npm') | ||
| source=("TeachBound::git+https://github.com/welleyth/TeachBound.git#branch=add-libp2p" | ||
| "binary.sh" "teachbound-client.service") | ||
| sha256sums=('SKIP' 'SKIP' 'SKIP') | ||
| options=('!strip') | ||
|
|
||
| build() { | ||
| cd "$srcdir/TeachBound/TeachBound-client" | ||
| npm ci | ||
| npm run build | ||
| } | ||
|
|
||
| package() { | ||
| install -Dm755 "binary.sh" "$pkgdir/usr/bin/teachbound-client" | ||
| install -Dm644 "teachbound-client.service" \ | ||
| "$pkgdir/usr/lib/systemd/user/teachbound-client.service" | ||
|
|
||
| cd "$srcdir/TeachBound/TeachBound-client" | ||
| install -d "$pkgdir/usr/share/teachbound-client" | ||
| cp -r build "$pkgdir/usr/share/teachbound-client/" | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| cd /usr/share/teachbound-client || exit 1 | ||
| exec python3 -m http.server 8080 --directory build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [Unit] | ||
| Description=Teachbound Client | ||
| After=network.target | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/bin/teachbound-client | ||
| Restart=on-failure | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ Teach Bound aims to provide a simple, yet powerful, digital canvas for educators | |
| Experience Teach Bound directly in your browser: | ||
| **[https://teachbound.com](https://teachbound.com)** | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## Overview | ||
|
|
@@ -19,71 +20,105 @@ Teach Bound is an open-source digital whiteboard application built with JavaScri | |
|
|
||
| ## Key Features | ||
|
|
||
| * **Versatile Drawing Tools:** | ||
| * **Pen:** Smooth freehand drawing with selectable colors and line widths | ||
| * **Eraser:** Easily clear pen strokes | ||
| * **Selection Tool:** Select, move, and manage multiple elements | ||
|
|
||
| * **Rich Content Creation:** | ||
| * **Sticky Notes:** Add, edit, and move digital sticky notes | ||
| * **Text Tool:** Insert formatted text directly onto the canvas | ||
| * **Shapes:** Draw rectangles, circles, lines, and arrows to structure information | ||
|
|
||
| * **Element Management:** | ||
| * **Selection Tool:** Select, move, and manage elements on the board | ||
| * **Delete Selected:** Remove selected elements from the canvas | ||
| * **Undo/Redo:** Navigate through your action history | ||
|
|
||
| * **Export & Share:** | ||
| * **Download as PNG:** Save your work as high-quality images (1x, 2x, 3x resolution) | ||
| * **Download as PDF:** Export your whiteboard for printing or sharing | ||
|
|
||
| * **Professional Interface:** | ||
| * **Responsive Design:** Adapts to various screen sizes for a seamless experience | ||
| * **Customizable Toolbar:** Choose between icons only, icons with text, or text only display | ||
| * **Clear Frame:** Instantly reset the canvas | ||
| - **Versatile Drawing Tools:** | ||
| - **Pen:** Smooth freehand drawing with selectable colors and line widths | ||
| - **Eraser:** Easily clear pen strokes | ||
| - **Selection Tool:** Select, move, and manage multiple elements | ||
| - **Rich Content Creation:** | ||
| - **Sticky Notes:** Add, edit, and move digital sticky notes | ||
| - **Text Tool:** Insert formatted text directly onto the canvas | ||
| - **Shapes:** Draw rectangles, circles, lines, and arrows to structure information | ||
| - **Element Management:** | ||
| - **Selection Tool:** Select, move, and manage elements on the board | ||
| - **Delete Selected:** Remove selected elements from the canvas | ||
| - **Undo/Redo:** Navigate through your action history | ||
| - **Export & Share:** | ||
| - **Download as PNG:** Save your work as high-quality images (1x, 2x, 3x resolution) | ||
| - **Download as PDF:** Export your whiteboard for printing or sharing | ||
| - **Professional Interface:** | ||
| - **Responsive Design:** Adapts to various screen sizes for a seamless experience | ||
| - **Customizable Toolbar:** Choose between icons only, icons with text, or text only display | ||
| - **Clear Frame:** Instantly reset the canvas | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| * **Frontend Framework:** React.js | ||
| * **Styling:** Custom CSS with responsive design | ||
| * **Icons:** Lucide React | ||
| * **Font:** Open Sans | ||
| * **Hosting:** Vercel | ||
| * **Development:** Built using vibe coding techniques with Claude and Gemini AI assistants | ||
| - **Frontend Framework:** React.js | ||
| - **Styling:** Custom CSS with responsive design | ||
| - **Icons:** Lucide React | ||
| - **Font:** Open Sans | ||
| - **Hosting:** Vercel | ||
| - **Development:** Built using vibe coding techniques with Claude and Gemini AI assistants | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Use Online | ||
|
|
||
| 1. Visit [https://teachbound.com](https://teachbound.com) | ||
| 2. Select your desired tool from the toolbar | ||
| 3. Click and drag on the canvas to create! | ||
| 4. Use options for colors, line width, and font size to customize | ||
|
|
||
| ### Run Locally | ||
|
|
||
| 1. Clone the repository: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/sai-educ/TeachBound.git | ||
| cd TeachBound | ||
| ``` | ||
|
|
||
| 2. Install dependencies: | ||
| 2. Install dependencies (client): | ||
|
|
||
| ```bash | ||
| cd TeachBound-client | ||
| npm install | ||
| ``` | ||
|
|
||
| 3. Start the development server: | ||
| 3. (Optional) Start the P2P relay/bootstrap node (default port 9090): | ||
|
|
||
| ```bash | ||
| cd ../TeachBound-host | ||
| npm install | ||
| npm start | ||
| ``` | ||
|
|
||
| The host will print its peer ID and multiaddr, e.g.: | ||
| ``` | ||
| [TeachBound-host] Peer ID: 12D3KooW... | ||
| [TeachBound-host] For client .env: | ||
| REACT_APP_P2P_RELAY_ADDR=/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooW... | ||
| ``` | ||
|
|
||
| 4. (Optional) Enable P2P collaboration in the client: | ||
| - Create `TeachBound-client/.env` (this file is intentionally ignored by git) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is not ignored? |
||
| - Add: | ||
|
|
||
| ```bash | ||
| # Copy the multiaddr from the host output (includes the peer ID) | ||
| REACT_APP_P2P_SIGNALING_ADDR=/ip4/127.0.0.1/tcp/9090/ws/p2p/<HOST_PEER_ID> | ||
|
|
||
| # Optional: room id (maps to pubsub topic `teachbound/<room>`) | ||
| REACT_APP_P2P_ROOM=demo | ||
| ``` | ||
|
|
||
| - Restart the client after changing `.env` | ||
| - Open the app in multiple browser tabs to test P2P sync | ||
|
|
||
| 5. Start the client development server: | ||
|
|
||
| ```bash | ||
| cd ../TeachBound-client | ||
| npm start | ||
| ``` | ||
|
|
||
| 4. Open [http://localhost:3000](http://localhost:3000) in your browser | ||
| 6. Open [http://localhost:3000](http://localhost:3000) in your browser | ||
|
|
||
| ## Contribution | ||
|
|
||
| We believe in the power of open-source and warmly welcome contributions! Whether it's a bug report, feature suggestion, or a pull request, your input is valuable. | ||
|
|
||
| ### How to Contribute | ||
|
|
||
| 1. Fork the repository | ||
| 2. Create your feature branch (`git checkout -b feature/AmazingFeature`) | ||
| 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) | ||
|
|
@@ -101,6 +136,7 @@ Created for educators, by an educator who understands the needs of modern teachi | |
| Teach Bound is licensed under the **Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0)**. | ||
|
|
||
| This means: | ||
|
|
||
| - ✅ You can use, share, and adapt the software for non-commercial purposes | ||
| - ✅ You must give appropriate credit | ||
| - ❌ Commercial use is not permitted without permission | ||
|
|
@@ -110,6 +146,7 @@ This means: | |
| ## Support | ||
|
|
||
| For questions, suggestions, or support: | ||
|
|
||
| - Open an issue on [GitHub](https://github.com/sai-educ/TeachBound/issues) | ||
| - Visit our website: [https://teachbound.com](https://teachbound.com) | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This env has a different name