Still figuring out initial matchmaking hang (FROSTBITE). Lots of other changes.
- Added missing room images
- Removed internal rooms and disallow cloning some rooms
- License fixes
- Switched target to 20200306
- Socket header fixes
- Sockets are closed upon shutdown
* Sockets persist after being destroyed, fix
- Config changes for 20200306
- Settings initialized
- Name generation words cannot be longer than 9 characters
- Dorm generation changes and fixes
- Added some settings keys
- Matchmaking additions
* Instances are not yet updated to be or not to be in-progress
- Instance fixes and logging
- Image operation fixes
- DisplayName route start
- Challenge route start
- Default Amplitude key (i can see althe Amplitude requests are ignored
- Rate limiting ease
- GameConfigs properly queried and sent
- Many 'bulk' endpoints were added in or around 20200306
- Objective routes started
- DormRoom redirection in v2/name
- Client doesn't care if it gets 200 when setting prefs
- Balance/storefronts started
- Matchmaking goto/room timer and fixes
- Selfhosted Photon addition on the client sends matchmaking /photonregionpings, ignore since Photon is only one server in one region
This commit is contained in:
25
src/main.ts
25
src/main.ts
@@ -1,5 +1,5 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<https://gitea.proxnet.dev/zombieb-galvanic-corrosion>
|
||||
<https://gitea.proxnet.dev/zombieb/galvanic-corrosion>
|
||||
Copyright (C) 2025 @zombieb (Discord / proxnet Gitea)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -28,6 +28,7 @@ import UnifiedProfile, { ProfileTokenFormat } from "./data/profiles.ts";
|
||||
import { SocketHandoff } from "./socket/handoff.ts";
|
||||
import { SignalRSocketHandler } from "./socket/socket.ts";
|
||||
import Rooms from "./data/content/rooms.ts";
|
||||
import { GameConfigs } from "./data/config.ts";
|
||||
|
||||
const instanceId = generateRandomString(64);
|
||||
|
||||
@@ -114,10 +115,6 @@ if (!(await Rooms.generateBuiltinRooms())) log.i(`Generated built-in rooms`);
|
||||
|
||||
try {
|
||||
|
||||
/**
|
||||
* Galvanic WebSocket Server
|
||||
*/
|
||||
|
||||
type AuthResultBase = {
|
||||
valid: boolean
|
||||
}
|
||||
@@ -133,10 +130,13 @@ try {
|
||||
const authHeader = req.headers.get('authorization');
|
||||
if (!authHeader) return { valid: false } as AuthResult;
|
||||
|
||||
const token = authHeader.split(" ")[1];
|
||||
log.d(authHeader);
|
||||
const token = authHeader.split(", ")[1]; // Why is the header formatted like this?
|
||||
if (!token) return { valid: false } as AuthResult;
|
||||
const splitToken = token.split(' ')[1];
|
||||
if (!splitToken) return { valid: false } as AuthResult;
|
||||
|
||||
const decodedToken = await decode<ProfileTokenFormat>(token, config.auth.secret, {algorithm: 'HS512'});
|
||||
const decodedToken = await decode<ProfileTokenFormat>(splitToken, config.auth.secret, {algorithm: 'HS512'});
|
||||
const schemaResult = ProfileTokenSchema.safeParse(decodedToken);
|
||||
if (!schemaResult.success) return { valid: false } as AuthResult;
|
||||
else return { token: decodedToken, valid: true } as AuthResult;
|
||||
@@ -149,6 +149,14 @@ try {
|
||||
|
||||
const abort = new AbortController();
|
||||
|
||||
abort.signal.addEventListener('abort', () => {
|
||||
log.n("Closing all sockets");
|
||||
const sockets = UnifiedProfile.getAllSockets();
|
||||
for (const socket of sockets.values()) {
|
||||
socket.destroy(socket)();
|
||||
} // I used the socket to destroy the socket
|
||||
});
|
||||
|
||||
// Galvanic WebSocket
|
||||
Deno.serve({port: config.web.socket.port, hostname: config.web.socket.host, signal: abort.signal, onListen: addr => {
|
||||
log.n(`Socket listening on http://${addr.hostname}:${addr.port}`);
|
||||
@@ -209,6 +217,9 @@ try {
|
||||
if (!(await UnifiedProfile.existsByName("Coach"))) UnifiedProfile.create({ username: "Coach", id: 1 }); // create Coach id 1 if they do not exist
|
||||
if (!(await UnifiedProfile.existsByName("Server"))) UnifiedProfile.create({ username: "Server", id: 2 }); // create Server id 2 if they do not exist
|
||||
|
||||
if (!(await GameConfigs.getGameConfig('splitTestSoftOverrides'))) GameConfigs.setGameConfig('splitTestSoftOverrides', '');
|
||||
if (!(await GameConfigs.getGameConfig('splitTestHardOverrides'))) GameConfigs.setGameConfig('splitTestHardOverrides', '');
|
||||
|
||||
});
|
||||
|
||||
http.on('error', err => {
|
||||
|
||||
Reference in New Issue
Block a user