This commit is contained in:
2025-08-22 20:19:15 -04:00
parent f19552929e
commit 391bf3d1f8
58 changed files with 535 additions and 24 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
/.env
/persist/
/worklist.txt
/node_modules
/build

1
WatchStorefront.json Normal file

File diff suppressed because one or more lines are too long

21
asdf copy.json Normal file
View File

@@ -0,0 +1,21 @@
{
"CustomizationAllowed": false,
"EmptyOnSandboxClone": false,
"GameTeamColorSettings": {
"TeamOutfitColorEmissionEnabled": false,
"TeamOutfitColorEmissionAmount": 0.0,
"CustomTeamColors": []
},
"GiftContext": 1002,
"LevelRoomSubSceneNames": [],
"LocationEnum": 24,
"MaxPlayers": 1,
"Name": "splootyneam",
"ReleaseStatus": 2,
"ReplicationId": "aafb38f1-beb9-4af3-94e3-2985d502302a",
"RequiredSubSceneNames": [],
"SceneName": "SampleScene",
"SupportedGameMode": 0,
"SupportsMobile": true,
"SupportsVRLow": true
}

21
asdf.json Normal file
View File

@@ -0,0 +1,21 @@
{
"CustomizationAllowed": false,
"EmptyOnSandboxClone": false,
"GameTeamColorSettings": {
"TeamOutfitColorEmissionEnabled": false,
"TeamOutfitColorEmissionAmount": 0.0,
"CustomTeamColors": []
},
"GiftContext": 1002,
"LevelRoomSubSceneNames": [],
"LocationEnum": 24,
"MaxPlayers": 1,
"Name": "splootyneam",
"ReleaseStatus": 2,
"ReplicationId": "aafb38f1-beb9-4af3-94e3-2985d502302a",
"RequiredSubSceneNames": [],
"SceneName": "SampleScene",
"SupportedGameMode": 0,
"SupportsMobile": true,
"SupportsVRLow": true
}

View File

@@ -3,10 +3,13 @@
"dev": "deno run -A --env-file --unstable-kv src/main.ts"
},
"imports": {
"@felix/bcrypt": "jsr:@felix/bcrypt@^1.0.5",
"@hono/hono": "jsr:@hono/hono@^4.8.5",
"@hono/zod-validator": "jsr:@hono/zod-validator@^0.7.2",
"@proxnet/undead-logging": "jsr:@proxnet/undead-logging@^1.5.0",
"@std/assert": "jsr:@std/assert@1",
"sharp": "npm:sharp@^0.34.3",
"zod": "npm:zod@^4.0.5"
}
},
"nodeModulesDir": "auto"
}

267
deno.lock generated
View File

@@ -1,17 +1,41 @@
{
"version": "5",
"specifiers": {
"jsr:@denosaurs/plug@^1.0.6": "1.1.0",
"jsr:@felix/bcrypt@^1.0.5": "1.0.5",
"jsr:@hono/hono@^4.8.3": "4.8.5",
"jsr:@hono/hono@^4.8.5": "4.8.5",
"jsr:@hono/zod-validator@~0.7.2": "0.7.2",
"jsr:@proxnet/undead-logging@^1.5.0": "1.5.0",
"jsr:@std/assert@1": "1.0.13",
"jsr:@std/encoding@1": "1.0.10",
"jsr:@std/fmt@1": "1.0.8",
"jsr:@std/fs@1": "1.0.19",
"jsr:@std/internal@^1.0.6": "1.0.9",
"jsr:@std/internal@^1.0.9": "1.0.9",
"jsr:@std/path@1": "1.1.1",
"jsr:@std/path@^1.1.1": "1.1.1",
"npm:@types/node@*": "22.15.15",
"npm:chalk@^5.3.0": "5.4.1",
"npm:sharp@~0.34.3": "0.34.3",
"npm:zod@^4.0.5": "4.0.5"
},
"jsr": {
"@denosaurs/plug@1.1.0": {
"integrity": "eb2f0b7546c7bca2000d8b0282c54d50d91cf6d75cb26a80df25a6de8c4bc044",
"dependencies": [
"jsr:@std/encoding",
"jsr:@std/fmt",
"jsr:@std/fs",
"jsr:@std/path@1"
]
},
"@felix/bcrypt@1.0.5": {
"integrity": "c8312e10cfda0e34c06c0d906667a0c602b472b7c64c75cfdcb44b934b885836",
"dependencies": [
"jsr:@denosaurs/plug"
]
},
"@hono/hono@4.8.5": {
"integrity": "78f72e532f378e379915a7e1ae7bd8a171b02324bd37b70877fd35375e8c2d6b"
},
@@ -31,14 +55,178 @@
"@std/assert@1.0.13": {
"integrity": "ae0d31e41919b12c656c742b22522c32fb26ed0cba32975cb0de2a273cb68b29",
"dependencies": [
"jsr:@std/internal"
"jsr:@std/internal@^1.0.6"
]
},
"@std/encoding@1.0.10": {
"integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1"
},
"@std/fmt@1.0.8": {
"integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7"
},
"@std/fs@1.0.19": {
"integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06",
"dependencies": [
"jsr:@std/internal@^1.0.9",
"jsr:@std/path@^1.1.1"
]
},
"@std/internal@1.0.9": {
"integrity": "bdfb97f83e4db7a13e8faab26fb1958d1b80cc64366501af78a0aee151696eb8"
},
"@std/path@1.1.1": {
"integrity": "fe00026bd3a7e6a27f73709b83c607798be40e20c81dde655ce34052fd82ec76",
"dependencies": [
"jsr:@std/internal@^1.0.9"
]
}
},
"npm": {
"@emnapi/runtime@1.4.5": {
"integrity": "sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==",
"dependencies": [
"tslib"
]
},
"@img/sharp-darwin-arm64@0.34.3": {
"integrity": "sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==",
"optionalDependencies": [
"@img/sharp-libvips-darwin-arm64"
],
"os": ["darwin"],
"cpu": ["arm64"]
},
"@img/sharp-darwin-x64@0.34.3": {
"integrity": "sha512-yHpJYynROAj12TA6qil58hmPmAwxKKC7reUqtGLzsOHfP7/rniNGTL8tjWX6L3CTV4+5P4ypcS7Pp+7OB+8ihA==",
"optionalDependencies": [
"@img/sharp-libvips-darwin-x64"
],
"os": ["darwin"],
"cpu": ["x64"]
},
"@img/sharp-libvips-darwin-arm64@1.2.0": {
"integrity": "sha512-sBZmpwmxqwlqG9ueWFXtockhsxefaV6O84BMOrhtg/YqbTaRdqDE7hxraVE3y6gVM4eExmfzW4a8el9ArLeEiQ==",
"os": ["darwin"],
"cpu": ["arm64"]
},
"@img/sharp-libvips-darwin-x64@1.2.0": {
"integrity": "sha512-M64XVuL94OgiNHa5/m2YvEQI5q2cl9d/wk0qFTDVXcYzi43lxuiFTftMR1tOnFQovVXNZJ5TURSDK2pNe9Yzqg==",
"os": ["darwin"],
"cpu": ["x64"]
},
"@img/sharp-libvips-linux-arm64@1.2.0": {
"integrity": "sha512-RXwd0CgG+uPRX5YYrkzKyalt2OJYRiJQ8ED/fi1tq9WQW2jsQIn0tqrlR5l5dr/rjqq6AHAxURhj2DVjyQWSOA==",
"os": ["linux"],
"cpu": ["arm64"]
},
"@img/sharp-libvips-linux-arm@1.2.0": {
"integrity": "sha512-mWd2uWvDtL/nvIzThLq3fr2nnGfyr/XMXlq8ZJ9WMR6PXijHlC3ksp0IpuhK6bougvQrchUAfzRLnbsen0Cqvw==",
"os": ["linux"],
"cpu": ["arm"]
},
"@img/sharp-libvips-linux-ppc64@1.2.0": {
"integrity": "sha512-Xod/7KaDDHkYu2phxxfeEPXfVXFKx70EAFZ0qyUdOjCcxbjqyJOEUpDe6RIyaunGxT34Anf9ue/wuWOqBW2WcQ==",
"os": ["linux"],
"cpu": ["ppc64"]
},
"@img/sharp-libvips-linux-s390x@1.2.0": {
"integrity": "sha512-eMKfzDxLGT8mnmPJTNMcjfO33fLiTDsrMlUVcp6b96ETbnJmd4uvZxVJSKPQfS+odwfVaGifhsB07J1LynFehw==",
"os": ["linux"],
"cpu": ["s390x"]
},
"@img/sharp-libvips-linux-x64@1.2.0": {
"integrity": "sha512-ZW3FPWIc7K1sH9E3nxIGB3y3dZkpJlMnkk7z5tu1nSkBoCgw2nSRTFHI5pB/3CQaJM0pdzMF3paf9ckKMSE9Tg==",
"os": ["linux"],
"cpu": ["x64"]
},
"@img/sharp-libvips-linuxmusl-arm64@1.2.0": {
"integrity": "sha512-UG+LqQJbf5VJ8NWJ5Z3tdIe/HXjuIdo4JeVNADXBFuG7z9zjoegpzzGIyV5zQKi4zaJjnAd2+g2nna8TZvuW9Q==",
"os": ["linux"],
"cpu": ["arm64"]
},
"@img/sharp-libvips-linuxmusl-x64@1.2.0": {
"integrity": "sha512-SRYOLR7CXPgNze8akZwjoGBoN1ThNZoqpOgfnOxmWsklTGVfJiGJoC/Lod7aNMGA1jSsKWM1+HRX43OP6p9+6Q==",
"os": ["linux"],
"cpu": ["x64"]
},
"@img/sharp-linux-arm64@0.34.3": {
"integrity": "sha512-QdrKe3EvQrqwkDrtuTIjI0bu6YEJHTgEeqdzI3uWJOH6G1O8Nl1iEeVYRGdj1h5I21CqxSvQp1Yv7xeU3ZewbA==",
"optionalDependencies": [
"@img/sharp-libvips-linux-arm64"
],
"os": ["linux"],
"cpu": ["arm64"]
},
"@img/sharp-linux-arm@0.34.3": {
"integrity": "sha512-oBK9l+h6KBN0i3dC8rYntLiVfW8D8wH+NPNT3O/WBHeW0OQWCjfWksLUaPidsrDKpJgXp3G3/hkmhptAW0I3+A==",
"optionalDependencies": [
"@img/sharp-libvips-linux-arm"
],
"os": ["linux"],
"cpu": ["arm"]
},
"@img/sharp-linux-ppc64@0.34.3": {
"integrity": "sha512-GLtbLQMCNC5nxuImPR2+RgrviwKwVql28FWZIW1zWruy6zLgA5/x2ZXk3mxj58X/tszVF69KK0Is83V8YgWhLA==",
"optionalDependencies": [
"@img/sharp-libvips-linux-ppc64"
],
"os": ["linux"],
"cpu": ["ppc64"]
},
"@img/sharp-linux-s390x@0.34.3": {
"integrity": "sha512-3gahT+A6c4cdc2edhsLHmIOXMb17ltffJlxR0aC2VPZfwKoTGZec6u5GrFgdR7ciJSsHT27BD3TIuGcuRT0KmQ==",
"optionalDependencies": [
"@img/sharp-libvips-linux-s390x"
],
"os": ["linux"],
"cpu": ["s390x"]
},
"@img/sharp-linux-x64@0.34.3": {
"integrity": "sha512-8kYso8d806ypnSq3/Ly0QEw90V5ZoHh10yH0HnrzOCr6DKAPI6QVHvwleqMkVQ0m+fc7EH8ah0BB0QPuWY6zJQ==",
"optionalDependencies": [
"@img/sharp-libvips-linux-x64"
],
"os": ["linux"],
"cpu": ["x64"]
},
"@img/sharp-linuxmusl-arm64@0.34.3": {
"integrity": "sha512-vAjbHDlr4izEiXM1OTggpCcPg9tn4YriK5vAjowJsHwdBIdx0fYRsURkxLG2RLm9gyBq66gwtWI8Gx0/ov+JKQ==",
"optionalDependencies": [
"@img/sharp-libvips-linuxmusl-arm64"
],
"os": ["linux"],
"cpu": ["arm64"]
},
"@img/sharp-linuxmusl-x64@0.34.3": {
"integrity": "sha512-gCWUn9547K5bwvOn9l5XGAEjVTTRji4aPTqLzGXHvIr6bIDZKNTA34seMPgM0WmSf+RYBH411VavCejp3PkOeQ==",
"optionalDependencies": [
"@img/sharp-libvips-linuxmusl-x64"
],
"os": ["linux"],
"cpu": ["x64"]
},
"@img/sharp-wasm32@0.34.3": {
"integrity": "sha512-+CyRcpagHMGteySaWos8IbnXcHgfDn7pO2fiC2slJxvNq9gDipYBN42/RagzctVRKgxATmfqOSulgZv5e1RdMg==",
"dependencies": [
"@emnapi/runtime"
],
"cpu": ["wasm32"]
},
"@img/sharp-win32-arm64@0.34.3": {
"integrity": "sha512-MjnHPnbqMXNC2UgeLJtX4XqoVHHlZNd+nPt1kRPmj63wURegwBhZlApELdtxM2OIZDRv/DFtLcNhVbd1z8GYXQ==",
"os": ["win32"],
"cpu": ["arm64"]
},
"@img/sharp-win32-ia32@0.34.3": {
"integrity": "sha512-xuCdhH44WxuXgOM714hn4amodJMZl3OEvf0GVTm0BEyMeA2to+8HEdRPShH0SLYptJY1uBw+SCFP9WVQi1Q/cw==",
"os": ["win32"],
"cpu": ["ia32"]
},
"@img/sharp-win32-x64@0.34.3": {
"integrity": "sha512-OWwz05d++TxzLEv4VnsTz5CmZ6mI6S05sfQGEMrNrQcOEERbX46332IvE7pO/EUiw7jUrrS40z/M7kPyjfl04g==",
"os": ["win32"],
"cpu": ["x64"]
},
"@types/node@22.15.15": {
"integrity": "sha512-R5muMcZob3/Jjchn5LcO8jdKwSCbzqmPB6ruBxMcf9kbxtniZHP327s6C37iOfuw8mbKK3cAQa7sEl7afLrQ8A==",
"dependencies": [
@@ -48,6 +236,81 @@
"chalk@5.4.1": {
"integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="
},
"color-convert@2.0.1": {
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": [
"color-name"
]
},
"color-name@1.1.4": {
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"color-string@1.9.1": {
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"dependencies": [
"color-name",
"simple-swizzle"
]
},
"color@4.2.3": {
"integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
"dependencies": [
"color-convert",
"color-string"
]
},
"detect-libc@2.0.4": {
"integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA=="
},
"is-arrayish@0.3.2": {
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
},
"semver@7.7.2": {
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"bin": true
},
"sharp@0.34.3": {
"integrity": "sha512-eX2IQ6nFohW4DbvHIOLRB3MHFpYqaqvXd3Tp5e/T/dSH83fxaNJQRvDMhASmkNTsNTVF2/OOopzRCt7xokgPfg==",
"dependencies": [
"color",
"detect-libc",
"semver"
],
"optionalDependencies": [
"@img/sharp-darwin-arm64",
"@img/sharp-darwin-x64",
"@img/sharp-libvips-darwin-arm64",
"@img/sharp-libvips-darwin-x64",
"@img/sharp-libvips-linux-arm",
"@img/sharp-libvips-linux-arm64",
"@img/sharp-libvips-linux-ppc64",
"@img/sharp-libvips-linux-s390x",
"@img/sharp-libvips-linux-x64",
"@img/sharp-libvips-linuxmusl-arm64",
"@img/sharp-libvips-linuxmusl-x64",
"@img/sharp-linux-arm",
"@img/sharp-linux-arm64",
"@img/sharp-linux-ppc64",
"@img/sharp-linux-s390x",
"@img/sharp-linux-x64",
"@img/sharp-linuxmusl-arm64",
"@img/sharp-linuxmusl-x64",
"@img/sharp-wasm32",
"@img/sharp-win32-arm64",
"@img/sharp-win32-ia32",
"@img/sharp-win32-x64"
],
"scripts": true
},
"simple-swizzle@0.2.2": {
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
"dependencies": [
"is-arrayish"
]
},
"tslib@2.8.1": {
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
},
"undici-types@6.21.0": {
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="
},
@@ -57,10 +320,12 @@
},
"workspace": {
"dependencies": [
"jsr:@felix/bcrypt@^1.0.5",
"jsr:@hono/hono@^4.8.5",
"jsr:@hono/zod-validator@~0.7.2",
"jsr:@proxnet/undead-logging@^1.5.0",
"jsr:@std/assert@1",
"npm:sharp@~0.34.3",
"npm:zod@^4.0.5"
]
}

1
res/AvatarItems.json Normal file

File diff suppressed because one or more lines are too long

BIN
res/baseimg/3DCharades.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
res/baseimg/Bowling.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/Clearcut.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/Crescendo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/Dodgeball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/Gym.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/Hangar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
res/baseimg/Homestead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/Lake.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/LaserTag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
res/baseimg/Lounge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/MakerRoom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
res/baseimg/Paddleball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
res/baseimg/Paintball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
res/baseimg/Park.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/Quarry.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
res/baseimg/RecCenter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/River.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
res/baseimg/Soccer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/Spillway.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
res/baseimg/Stadium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
res/baseimg/StuntRunner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -43,7 +43,8 @@ await routeImporter(AppRoot.app, 'src/', [
'routes/api',
'routes/auth',
'routes/accounts',
'routes/match'
'routes/match',
'routes/img'
]);
// deno-lint-ignore require-await
@@ -59,7 +60,7 @@ const onListen = async () => {
await Deno.mkdir('persist');
await Promise.all(Object.values(Server).map(base => ((base as ServerContentBase).kvInit ? (base as ServerContentBase).kvInit() : undefined)));
Object.values(Server).forEach(base => ((base as ServerContentBase).start ? (base as ServerContentBase).start() : undefined));
Server.emit('server.start', undefined);
}
const netConfig = getNetConfig();
@@ -162,7 +163,7 @@ Deno.addSignalListener('SIGINT', () => {
for (const socket of consoleSockets) socket.destroy();
for (const socket of gameSockets) socket.sendNotification(PushNotificationId.ModerationQuitGame);
Object.values(Server).forEach(base => ((base as ServerContentBase).destroy ? (base as ServerContentBase).destroy() : undefined));
Server.emit('server.destroy', undefined);
});
Server.Commands.addRootCommand(new Command({

View File

@@ -0,0 +1,3 @@
import { createHonoRoute } from "../../../util/import.ts";
export const route = createHonoRoute("/messages");

View File

@@ -0,0 +1,29 @@
import z from "zod";
import { createHonoRoute } from "../../../util/import.ts";
import { typedZValidator } from "../../../util/validators.ts";
import { authenticate } from "../../../util/api.ts";
import Server from "../../../server/server.ts";
export const route = createHonoRoute("/playerReputation");
const getRepIdParamSchema = z.object({
id: z.coerce.number().min(0).max(2_147_483_647)
})
route.app.get('/v1/:id', typedZValidator('param', getRepIdParamSchema), authenticate, async c => {
const { id } = c.req.valid('param');
const prof = await Server.Profiles.get(id);
if (!prof) return c.status(404);
else return c.json({
AccountId: id,
Noteriety: 0.0,
CheerGeneral: 0,
CheerHelpful: 0,
CheerGreatHost: 0,
CheerSportsman: 0,
CheerCreative: 0,
CheerCredit: 0,
SubscriberCount: 0,
SubscribedCount: 0,
});
});

74
src/routes/img/base.ts Normal file
View File

@@ -0,0 +1,74 @@
import z from "zod";
import Server from "../../server/server.ts";
import { createHonoRoute } from "../../util/import.ts";
import { typedZValidator } from "../../util/validators.ts";
import { FileType, File } from "../../server/content/base.ts";
import sharp from "sharp";
import path from "node:path";
import { RootPath } from "../../util/path.ts";
import Logging from "@proxnet/undead-logging";
export const route = createHonoRoute('/img');
async function convertImage(query: {cropSquare?: boolean | undefined;width?: number | undefined;height?: number | undefined;}, data: Uint8Array<ArrayBufferLike>): Promise<Uint8Array<ArrayBufferLike>> {
const image = sharp(data);
const rootMetadata = await image.metadata();
const rootWidth = rootMetadata.width;
const rootHeight = rootMetadata.height;
const squareSize = Math.min(rootWidth, rootHeight);
if (query.cropSquare) image.resize(squareSize, squareSize);
const newImage = sharp(await image.png().toBuffer());
if (query.width && query.height)
newImage.resize(query.width, query.height);
else if (query.width)
newImage.resize(query.width);
else if (query.height)
newImage.resize(undefined, query.height);
return await newImage.png().toBuffer();
}
const imgNameParamSchema = z.object({
imgName: z.string().min(4).includes('.')
});
const imgQuerySchema = z.object({
cropSquare: z.coerce.boolean().optional(),
width: z.coerce.number().max(3840).optional(),
height: z.coerce.number().max(2160).optional(),
});
route.app.get('/:imgName',
typedZValidator('param', imgNameParamSchema),
typedZValidator('query', imgQuerySchema),
async c => {
const { imgName } = c.req.valid('param');
const query = c.req.valid('query');
const file: File | null = await Server.Content.getFile(`img/${imgName}`);
let raw: Uint8Array<ArrayBuffer> | null = null;
if (!file) {
try {
raw = await Deno.readFile(path.join(RootPath, "res/baseimg/", imgName));
} catch {
raw = null;
}
}
if (!raw && file && file.Meta.Type !== FileType.Image) return c.status(404);
try {
let result: Uint8Array<ArrayBufferLike> | null = null;
if (file) result = await convertImage(query, file.Data);
else if (raw) result = await convertImage(query, raw);
if (result) return c.body(result, 200, { "Cache-Control": "public, no-transform, max-age=1800", "Content-Type": "image/png" });
else return c.status(404);
} catch (err) {
new Logging("ImageRoute").w(`Sharp error: ${err}`);
return c.status(500);
}
}
);

View File

@@ -8,6 +8,9 @@ export class ServerContentBase {
constructor(server: ServerBase, id: string, kv?: boolean) {
this.server = server;
this.kv = new KV(id, kv);
server.on('server.start', this.start);
server.on('server.destroy', this.destroy);
}
async kvInit() {
@@ -19,7 +22,7 @@ export class ServerContentBase {
*
* Override me!
*/
start() {
protected start() {
return;
}
@@ -28,7 +31,7 @@ export class ServerContentBase {
*
* Override me!
*/
destroy() {
protected destroy() {
return;
}

View File

@@ -45,6 +45,7 @@ export class AvatarContentBase extends ServerContentBase {
return this.#rawImport;
}
// unused
formatAllPossibleCombinations() {
const parsed = JSON.parse(Deno.readTextFileSync(path.join(RootPath, '/res/avatar.json'))) as AvatarImport;
function formatVisualData(data: {
@@ -68,8 +69,11 @@ export class AvatarContentBase extends ServerContentBase {
Rarity: ItemRarity.None
}));
}
importAllItems() {
this.#rawImport = JSON.parse(Deno.readTextFileSync(path.join(RootPath, '/res/AvatarItems.json'))) as AvatarItemExport[];
}
override start() {
this.formatAllPossibleCombinations();
this.importAllItems();
}
}

View File

@@ -23,7 +23,7 @@ interface MetaFile {
SavedBy?: Profile
OriginalFilename?: string
}
interface File {
export interface File {
Meta: MetaFile,
Data: Uint8Array<ArrayBufferLike>
}
@@ -172,8 +172,7 @@ export class ServerContentManager extends ServerContentBase {
Data: data
}
return file;
} catch (err) {
this.#log.w(`Could not get file "${path}": ${err}`);
} catch {
return null;
}
}

View File

@@ -1,5 +1,6 @@
import { CloudRegionCode } from "../../util/photon.ts";
import type Profile from "../profiles/profile.ts";
import { RoomLocation } from "./base.ts";
import { RoomInstance, RoomLocation } from "./base.ts";
export class Instance {
@@ -8,7 +9,18 @@ export class Instance {
#players: Set<Profile> = new Set();
#instanceId: number;
//#roomId: number;
//#subRoomId: number;
#location: RoomLocation;
//#name: string;
//#maxCapacity: number;
#isFull: boolean = false;
//#isPrivate: boolean;
#isInProgress: boolean = false;
#photonRegionId: string = CloudRegionCode.us;
//#photonRoomId: string;
#dataBlob?: string;
#eventId?: string
constructor(options: {
id: number,
@@ -30,10 +42,18 @@ export class Instance {
}
addPlayer(profile: Profile) {
this.#players.add(profile);
}
getCreatedAt() {
return this.#createdAt;
}
export() {
/*const inst: RoomInstance = {
roomInstanceId: this.#instanceId,
}*/
}
}

View File

@@ -53,7 +53,7 @@ export interface RoomInstance {
photonRegionId: string,
photonRoomId: string,
dataBlob?: string,
eventId?: string
eventId?: number
}
export class InstanceManager extends ServerContentBase {

View File

@@ -55,7 +55,6 @@ export class Presence {
isOnline ?
this.#statusVisibility :
PlayerStatusVisibility.Offline;
this.#roomInstance = this.#profile.getInstance();
this.#server.emit('presence.update', { profile: this.#profile, presence: this });
}

View File

@@ -0,0 +1,40 @@
import ProfileContentManager from "./base.ts";
enum MessageType {
GameInvite,
GameInviteDeclined,
GameJoinFailed,
PartyActivitySwitch,
FriendInvite,
VoteToKick,
GameInviteV2,
PartyActivitySwitchV2,
RequestGameInvite = 10,
RequestGameInviteDeclined,
FriendStatusOnline = 20,
TextMessage = 30,
FriendRequestAccepted = 40,
PlayerCheer = 50,
PlayerCheerAnonymous,
RoomCoOwnerAdded = 60,
RoomCoOwnerRemoved,
RoomCoOwnerInvited,
CreatorPublishedNewRoom = 70,
PlayerAttendingEvent = 80,
PlayerEventInvitation,
GroupInvitation = 90,
PlayerJoinedGroup,
CoachMessage = 100
}
interface MessageBase {
Id: number,
FromPlayerId: number,
SentTime: string,
Type: MessageType,
Data: string,
}
export class ProfileMessageManager extends ProfileContentManager {
}

View File

@@ -0,0 +1,5 @@
import ProfileContentManager from "./base.ts";
export class ProfileReputationManager extends ProfileContentManager {
}

View File

@@ -0,0 +1,5 @@
import ProfileContentManager from "./base.ts";
export class ProfileSubscriptionsManager extends ProfileContentManager {
}

View File

@@ -1,4 +1,4 @@
import { RoomInstance } from "../instances/base.ts";
import { Instance } from "../instances/Instance.ts";
import KV from "../persistence/kv.ts";
import { PlatformMask, ProfileRole } from "../platforms/types.ts";
import { type ServerBase } from "../server.ts";
@@ -6,7 +6,10 @@ import { type SignalRSocketHandler } from "../socket/signalr/socket.ts";
import { ProfileAvatarManager } from "./content/Avatar.ts";
import ProfileContentManager from "./content/base.ts";
import { ProfileMatchmakingManager } from "./content/Matchmaking.ts";
import { ProfileMessageManager } from "./content/Messages.ts";
import { ProfileReputationManager } from "./content/Reputation.ts";
import { ProfileSettingsManager } from "./content/Settings.ts";
import { ProfileSubscriptionsManager } from "./content/Subscriptions.ts";
import ProfileManagerBase from "./manager.ts";
import { recNetAccountSchema, SelfAccount, type RecNetAccount } from "./types/profile.ts";
@@ -16,7 +19,7 @@ class Profile {
#kv: KV;
#socket: SignalRSocketHandler | null = null;
#instance: RoomInstance | null = null;
#instance: Instance | null = null;
#server: ServerBase;
#selfAcc: SelfAccount;
@@ -26,6 +29,9 @@ class Profile {
Settings: ProfileSettingsManager;
Avatar: ProfileAvatarManager;
Matchmaking: ProfileMatchmakingManager;
Reputation: ProfileReputationManager;
Subscriptions: ProfileSubscriptionsManager;
Messages: ProfileMessageManager;
constructor(acc: SelfAccount, kv: KV, server: ServerBase) {
this.#id = acc.accountId;
@@ -36,6 +42,9 @@ class Profile {
this.Settings = new ProfileSettingsManager(this, this.#kv);
this.Avatar = new ProfileAvatarManager(this, this.#kv);
this.Matchmaking = new ProfileMatchmakingManager(this, this.#kv);
this.Reputation = new ProfileReputationManager(this, this.#kv);
this.Subscriptions = new ProfileSubscriptionsManager(this, this.#kv);
this.Messages = new ProfileMessageManager(this, this.#kv);
}
async #saveSelfAcc() {
@@ -121,7 +130,7 @@ class Profile {
getInstance() {
return this.#instance;
}
setInstance(inst: RoomInstance) {
setInstance(inst: Instance) {
this.#instance = inst;
}

View File

@@ -14,6 +14,8 @@ interface ServerEvents {
'profile.roleupdate': RoleUpdateEvent,
'profile.update': ProfileUpdateEvent,
'presence.update': PresenceUpdateEvent,
'server.start': undefined,
'server.destroy': undefined,
}
class ServerBase extends EventManager<ServerEvents> {

View File

View File

@@ -1,19 +1,23 @@
import { zValidator } from "@hono/zod-validator";
import type { MiddlewareHandler } from "@hono/hono";
import { z } from "zod";
import { z, ZodObject } from "zod";
import type { HonoEnv } from "./types.ts";
// thanks claude, this hurt my brain!
export const typedZValidator = <T extends z.ZodSchema>(
target: 'query' | 'json' | 'form' | 'header' | 'param' | 'cookie',
schema: T
export const typedZValidator = <
Target extends 'query' | 'json' | 'form' | 'header' | 'param' | 'cookie',
Schema extends ZodObject
>(
target: Target,
schema: Schema
) => {
return zValidator(target, schema) as MiddlewareHandler<
HonoEnv,
string,
{
in: { [K in typeof target]: z.input<T> };
out: { [K in typeof target]: z.output<T> };
in: { [K in Target]: z.input<Schema> };
out: { [K in Target]: z.output<Schema> };
}
>;
};