Skip to content

Commit d2743fa

Browse files
committed
Add landing page to docs, add application test to room joining
1 parent 918aebb commit d2743fa

File tree

12 files changed

+318
-230
lines changed

12 files changed

+318
-230
lines changed

api/lib/models.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum KickReason {
8383
roomClosed,
8484
kicked,
8585
banned,
86+
hostLeft,
8687
unknown;
8788

8889
int get value => this == unknown ? 0xFF : index;
@@ -95,6 +96,7 @@ enum JoinFailedReason {
9596
roomNotFound,
9697
roomFull,
9798
banned,
99+
applicationMismatch,
98100
unknown;
99101

100102
int get value => this == unknown ? 0xFF : index;

api/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ packages:
318318
dependency: "direct main"
319319
description:
320320
path: "packages/networker/networker_crypto"
321-
ref: "459deccbfacedc115f28ae0095c5b531c70d7cc7"
322-
resolved-ref: "459deccbfacedc115f28ae0095c5b531c70d7cc7"
321+
ref: e901983295b103f2fe27738e8f2cbf35941d99ea
322+
resolved-ref: e901983295b103f2fe27738e8f2cbf35941d99ea
323323
url: "https://github.com/LinwoodDev/dart_pkgs.git"
324324
source: git
325325
version: "1.0.0"

api/pubspec.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ environment:
99

1010
# Add regular dependencies here.
1111
dependencies:
12-
networker: any
12+
networker:
13+
git:
14+
url: https://github.com/LinwoodDev/dart_pkgs.git
15+
path: packages/networker/networker
16+
ref: 213c6382f196ee93c4c43ca911cdb26a38317e39
1317
networker_crypto:
1418
git:
1519
url: https://github.com/LinwoodDev/dart_pkgs.git
1620
path: packages/networker/networker_crypto
17-
ref: 459deccbfacedc115f28ae0095c5b531c70d7cc7
21+
ref: e901983295b103f2fe27738e8f2cbf35941d99ea
1822
rxdart: ^0.28.0
1923
web_socket_channel: ^3.0.2
2024
# path: ^1.8.0
@@ -23,9 +27,3 @@ dev_dependencies:
2327
build_runner: ^2.4.15
2428
lints: ^5.0.0
2529
test: ^1.24.0
26-
dependency_overrides:
27-
networker:
28-
git:
29-
url: https://github.com/LinwoodDev/dart_pkgs.git
30-
path: packages/networker/networker
31-
ref: 213c6382f196ee93c4c43ca911cdb26a38317e39

docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"dependencies": {
1313
"@astrojs/check": "^0.9.4",
1414
"@astrojs/react": "^4.2.1",
15-
"@astrojs/starlight": "^0.32.2",
15+
"@astrojs/starlight": "^0.32.3",
1616
"@phosphor-icons/react": "^2.1.7",
17-
"@types/react": "^19.0.10",
17+
"@types/react": "^19.0.11",
1818
"@types/react-dom": "^19.0.4",
19-
"astro": "^5.5.2",
19+
"astro": "^5.5.3",
2020
"react": "^19.0.0",
2121
"react-dom": "^19.0.0",
2222
"remark-gemoji": "^8.0.0",
@@ -26,7 +26,7 @@
2626
"packageManager": "pnpm@10.6.3",
2727
"devDependencies": {
2828
"@vite-pwa/astro": "^0.5.0",
29-
"sass": "^1.85.1",
29+
"sass": "^1.86.0",
3030
"sharp": "^0.33.5",
3131
"vite-plugin-pwa": "^0.21.1",
3232
"workbox-window": "^7.3.0"

docs/pnpm-lock.yaml

Lines changed: 256 additions & 164 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/content/docs/index.mdx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
2-
title: Welcome to Starlight
3-
description: Get started building your docs site with Starlight.
2+
title: Linwood Swamp
3+
description: Universal Secure Web-Socket Application Messaging Proxy for Linwood Apps
44
template: splash
55
hero:
6-
tagline: Congrats on setting up a new Starlight project!
6+
tagline: Universal Secure Web-Socket Application Messaging Proxy for Linwood Apps
77
image:
8-
file: ../../assets/houston.webp
8+
file: /public/img/logo.svg
99
actions:
10-
- text: Example Guide
11-
link: /guides/example/
12-
icon: right-arrow
13-
- text: Read the Starlight docs
14-
link: https://starlight.astro.build
15-
icon: external
16-
variant: minimal
10+
- text: Download
11+
link: /downloads/
12+
icon: download
13+
variant: primary
14+
- text: Getting started
15+
link: /docs/v1/intro/
16+
icon: document
1717
---
1818

19-
import { Card, CardGrid } from '@astrojs/starlight/components';
19+
import { LinkCard, Card, CardGrid } from '@astrojs/starlight/components';
2020

21-
## Next steps
21+
## Principles
2222

2323
<CardGrid stagger>
24-
<Card title="Update content" icon="pencil">
25-
Edit `src/content/docs/index.mdx` to see this page change.
24+
<Card title="Cross platform" icon="laptop">
25+
You can start the server on windows, linux or mac.
2626
</Card>
27-
<Card title="Add new content" icon="add-document">
28-
Add Markdown or MDX files to `src/content/docs` to create new pages.
27+
<Card title="Universal" icon="puzzle">
28+
The server can be used for any app that implements the swamp protocol. The protocol is simple and easy to implement.
2929
</Card>
30-
<Card title="Configure your site" icon="setting">
31-
Edit your `sidebar` and other config in `astro.config.mjs`.
30+
<Card title="Customizable" icon="pencil">
31+
The server has a settings file that can be used to customize the server to your needs. Additionally you can use the server as a library in your own project.
3232
</Card>
33-
<Card title="Read the docs" icon="open-book">
34-
Learn more in [the Starlight Docs](https://starlight.astro.build/).
33+
<Card title="Open API" icon="open-book">
34+
All api endpoints are documented and can be used to create your own client or server.
3535
</Card>
3636
</CardGrid>

docs/src/content/docs/reference/example.md

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ If you are kicked from a room.
6565
| 0x00 | Room closed |
6666
| 0x01 | Kicked from room |
6767
| 0x02 | Banned from room |
68+
| 0x03 | Host left |
6869
| 0xFF | Unknown error |
6970

7071
#### Room join failed
@@ -77,12 +78,13 @@ If you want to join a room but it fails.
7778

7879
##### Reasons
7980

80-
| Reason | Description |
81-
| ------ | ------------------- |
82-
| 0x00 | Room does not exist |
83-
| 0x01 | Room is full |
84-
| 0x02 | Banned from room |
85-
| 0xFF | Unknown error |
81+
| Reason | Description |
82+
| ------ | -------------------- |
83+
| 0x00 | Room does not exist |
84+
| 0x01 | Room is full |
85+
| 0x02 | Banned from room |
86+
| 0x03 | Application mismatch |
87+
| 0xFF | Unknown error |
8688

8789
#### Room creation failed
8890

server/lib/room.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ final class SwampRoomManager extends SimpleNetworkerPipe<RpcNetworkerPacket> {
8181
_sendJoinFailed(player, JoinFailedReason.roomNotFound);
8282
return null;
8383
}
84+
final application = _application[player];
85+
if (application != null &&
86+
room.application != null &&
87+
encodeRoomCode(room.application!) != encodeRoomCode(application)) {
88+
_sendJoinFailed(player, JoinFailedReason.roomFull);
89+
return null;
90+
}
8491
final id = room._findAvailableChannel();
8592
if (id == kAnyChannel) {
8693
_sendJoinFailed(player, JoinFailedReason.roomFull);
@@ -183,7 +190,7 @@ final class SwampRoomManager extends SimpleNetworkerPipe<RpcNetworkerPacket> {
183190
}
184191
if (player == kAuthorityChannel) {
185192
for (final player in room.players) {
186-
_sendKickMessage(player, KickReason.roomClosed);
193+
_sendKickMessage(player, KickReason.hostLeft);
187194
}
188195
room.players.clear();
189196
}

0 commit comments

Comments
 (0)