FLINT AND STEEL!!!! THE NETHER!!!!!! RELEASE!!!!!!!!!
* Account bio support (fetch only route right now)
* Room cloning fixes
- Dorm Room cloning is still broken
* Instance changing fixes
* Presence: VRMovementMode and StatusVisibility updates automatically
* Routes for the above two properties
* Settings can take numbers, too (enums)
* No microtransations in my game (parental controls)
* A whole lotta routes for various unfinished but planned features
- Equipment
- Consumables
- Objectives
- Checklist (orientation rewards)
- Objectives (three daily tasks)
- Image metadata
- Community Board
- Player Events
- Storefronts
* Matchmaking instance querying
- Empty instances are not yet cleared
* Avatar items, saved avatars, save current avatar routes
* No loading screen tips for now
* Send presence at an interval over the socket
- Error FROSTBITE is reported in the game logs during bootup sometimes. Maybe due to the lack of ping messages?
* Socket push notifications
Note to self: Set up deno compilation in runners on gitea
This commit is contained in:
@@ -17,7 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../apiutils.ts";
|
||||
import { route as AccountRoute } from "./account/account.ts";
|
||||
import { route as ParentalControlRoute } from "./account/parentalcontrol.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/accountservice");
|
||||
|
||||
route.router.use(AccountRoute.path, AccountRoute.router);
|
||||
route.router.use(ParentalControlRoute.path, ParentalControlRoute.router);
|
||||
@@ -17,17 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import express from "express";
|
||||
import { Profile } from "../../data/profiles.ts";
|
||||
import UnifiedProfile, { Profile } from "../../data/profiles.ts";
|
||||
import { z } from "zod";
|
||||
|
||||
export const route = APIUtils.createRouter("/account");
|
||||
|
||||
interface CreateAccountRequestBody {
|
||||
platform: string;
|
||||
platformId: string;
|
||||
deviceId: string;
|
||||
}
|
||||
|
||||
const CreateAccountRequestBodySchema = z.object({
|
||||
platform: z.string(),
|
||||
platformId: z.string(),
|
||||
@@ -106,4 +100,33 @@ route.router.get("/me",
|
||||
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
interface BioFetchParams {
|
||||
id?: string
|
||||
}
|
||||
route.router.get('/:id/bio',
|
||||
|
||||
APIUtils.Authentication,
|
||||
|
||||
async (rq: express.Request<BioFetchParams>, rs: express.Response) => {
|
||||
|
||||
const unparsedId = rq.params.id;
|
||||
if (!unparsedId) {
|
||||
rs.sendStatus(500);
|
||||
return;
|
||||
}
|
||||
const parsedId = parseInt(unparsedId);
|
||||
if (isNaN(parsedId)) {
|
||||
rs.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
const player = UnifiedProfile.get(parsedId);
|
||||
|
||||
rs.json({
|
||||
accountId: parsedId,
|
||||
bio: await player.getBio(),
|
||||
});
|
||||
}
|
||||
|
||||
);
|
||||
35
src/routes/account/parentalcontrol.ts
Normal file
35
src/routes/account/parentalcontrol.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/parentalcontrol');
|
||||
|
||||
route.router.get('/me',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json({
|
||||
accountId: rs.locals.profile.getId(),
|
||||
disallowInAppPurchases: true // no transations here buddy
|
||||
});
|
||||
},
|
||||
|
||||
);
|
||||
@@ -30,6 +30,14 @@ import { route as AvatarRoute } from "./api/avatar.ts";
|
||||
import { route as QuickPlayRoute } from "./api/quickplay.ts";
|
||||
import { route as RoomsRoute } from "./api/rooms.ts";
|
||||
import { route as ChallengeRoute } from "./api/challenge.ts";
|
||||
import { route as EquipmentRoute } from "./api/equipment.ts";
|
||||
import { route as ConsumablesRoute } from "./api/consumables.ts";
|
||||
import { route as ObjectivesRoute } from "./api/objectives.ts";
|
||||
import { route as ChecklistRoute } from "./api/checklist.ts";
|
||||
import { route as ImagesRoute } from "./api/images.ts";
|
||||
import { route as CommunityBoardRoute } from "./api/communityboard.ts";
|
||||
import { route as PlayerEventsRoute } from "./api/playerevents.ts";
|
||||
import { route as StorefrontsRoute } from "./api/storefronts.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/api");
|
||||
|
||||
@@ -46,4 +54,12 @@ route.router.use(PlayerReputationRoute.path, PlayerReputationRoute.router);
|
||||
route.router.use(AvatarRoute.path, AvatarRoute.router);
|
||||
route.router.use(QuickPlayRoute.path, QuickPlayRoute.router);
|
||||
route.router.use(RoomsRoute.path, RoomsRoute.router);
|
||||
route.router.use(ChallengeRoute.path, ChallengeRoute.router);
|
||||
route.router.use(ChallengeRoute.path, ChallengeRoute.router);
|
||||
route.router.use(EquipmentRoute.path, EquipmentRoute.router);
|
||||
route.router.use(ConsumablesRoute.path, ConsumablesRoute.router);
|
||||
route.router.use(ObjectivesRoute.path, ObjectivesRoute.router);
|
||||
route.router.use(ChecklistRoute.path, ChecklistRoute.router);
|
||||
route.router.use(ImagesRoute.path, ImagesRoute.router);
|
||||
route.router.use(CommunityBoardRoute.path, CommunityBoardRoute.router);
|
||||
route.router.use(PlayerEventsRoute.path, PlayerEventsRoute.router);
|
||||
route.router.use(StorefrontsRoute.path, StorefrontsRoute.router);
|
||||
@@ -15,8 +15,11 @@ GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import express from "express";
|
||||
import { AvatarSettings } from "../../data/profile/avatar.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/avatar");
|
||||
|
||||
@@ -31,13 +34,49 @@ route.router.get('/v2',
|
||||
|
||||
);
|
||||
|
||||
const AvatarSettingsSchema = z.object({
|
||||
OutfitSelections: z.string(),
|
||||
HairColor: z.string(),
|
||||
SkinColor: z.string(),
|
||||
FaceFeatures: z.string()
|
||||
});
|
||||
route.router.post('/v2/set',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
express.json(),
|
||||
APIUtils.validateRequestBody(AvatarSettingsSchema),
|
||||
|
||||
(rq: express.Request<NoBody, NoBody, AvatarSettings>, rs: express.Response) => {
|
||||
rs.locals.profile.Avatar.setAvatar(rq.body);
|
||||
rs.sendStatus(200);
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v4/items',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json([]);
|
||||
}
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v3/saved',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v2/gifts',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
30
src/routes/api/checklist.ts
Normal file
30
src/routes/api/checklist.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/checklist');
|
||||
|
||||
route.router.get('/v1/current',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
51
src/routes/api/communityboard.ts
Normal file
51
src/routes/api/communityboard.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { Config } from "../../config.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
const config = Config.getConfig();
|
||||
|
||||
export const route = APIUtils.createRouter('/communityboard');
|
||||
|
||||
route.router.get('/v1/current',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json({
|
||||
FeaturedPlayer: {
|
||||
Id: 1,
|
||||
TitleOverride: "",
|
||||
UrlOverride: ""
|
||||
},
|
||||
FeaturedRoomGroup: {
|
||||
Name: "",
|
||||
FeaturedRooms: []
|
||||
},
|
||||
CurrentAnnouncement: {
|
||||
Message: config.public.motd,
|
||||
MoreInfoUrl: ""
|
||||
},
|
||||
InstagramImages: [],
|
||||
Videos: []
|
||||
});
|
||||
},
|
||||
|
||||
);
|
||||
30
src/routes/api/consumables.ts
Normal file
30
src/routes/api/consumables.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/consumables');
|
||||
|
||||
route.router.get('/v1/getUnlocked',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
30
src/routes/api/equipment.ts
Normal file
30
src/routes/api/equipment.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/equipment');
|
||||
|
||||
route.router.get('/v2/getUnlocked',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
)
|
||||
@@ -19,6 +19,4 @@ import { APIUtils } from "../../apiutils.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/gameconfigs");
|
||||
|
||||
route.router.get("/v1/all", (_rq, rs) => {
|
||||
rs.json([]);
|
||||
});
|
||||
route.router.get("/v1/all", APIUtils.emptyArrayResponse);
|
||||
30
src/routes/api/images.ts
Normal file
30
src/routes/api/images.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/images');
|
||||
|
||||
route.router.get('/v2/named',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
@@ -23,8 +23,6 @@ route.router.get('/v2/get',
|
||||
|
||||
APIUtils.Authentication,
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json([]); // temporary
|
||||
}
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
)
|
||||
35
src/routes/api/objectives.ts
Normal file
35
src/routes/api/objectives.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/objectives');
|
||||
|
||||
route.router.get('/v1/myprogress',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json({
|
||||
Objectives: [],
|
||||
ObjectiveGroups: []
|
||||
});
|
||||
},
|
||||
|
||||
);
|
||||
44
src/routes/api/playerevents.ts
Normal file
44
src/routes/api/playerevents.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/playerevents');
|
||||
|
||||
route.router.get('/v1/all',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json({
|
||||
Created: [],
|
||||
Responses: []
|
||||
});
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v1',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
@@ -21,8 +21,6 @@ export const route = APIUtils.createRouter("/playersubscriptions");
|
||||
|
||||
route.router.get('/v1/my',
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json([]); // temporary: todo
|
||||
}
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import Rooms from "../../data/content/rooms.ts";
|
||||
import { RoomAccessibility } from "../../data/content/roomtypes.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import express from "express";
|
||||
|
||||
@@ -46,4 +47,75 @@ route.router.get('/v4/details/:roomId',
|
||||
else rs.json(room);
|
||||
},
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
route.router.get('/v2/myrooms',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v1/hot',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
async (_rq, rs) => {
|
||||
// temporary: return all public AG rooms for testing
|
||||
const rooms = await Rooms.getAllBuiltinRoomGenerations();
|
||||
rs.json(rooms.map(room => room.Room).filter(room => room.Accessibility !== RoomAccessibility.Private));
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
route.router.get('/v2/baserooms',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
async (_rq, rs) => {
|
||||
const rooms = await Rooms.getAllBuiltinRoomGenerations();
|
||||
rs.json(rooms.map(room => room.Room).filter(room => room.CloningAllowed));
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
interface GetRoomByNameParams {
|
||||
name?: string
|
||||
}
|
||||
route.router.get('/v2/name/:name',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
async (rq: express.Request<GetRoomByNameParams>, rs: express.Response) => {
|
||||
if (!rq.params.name) {
|
||||
rs.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
|
||||
const room = await Rooms.getByName(rq.params.name.trim());
|
||||
if (!room || rq.params.name == 'DormRoom') {
|
||||
rs.sendStatus(404);
|
||||
return;
|
||||
} else {
|
||||
rs.json(room.Room);
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
route.router.post('/v1/roomRolePermissions',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(rq, rs) => {
|
||||
rs.sendStatus(200);
|
||||
},
|
||||
|
||||
);
|
||||
42
src/routes/api/storefronts.ts
Normal file
42
src/routes/api/storefronts.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import express from "express";
|
||||
|
||||
export const route = APIUtils.createRouter('/storefronts');
|
||||
|
||||
interface StorefrontFetchParams {
|
||||
id?: string
|
||||
}
|
||||
route.router.get('/v3/giftdropstore/:id',
|
||||
|
||||
APIUtils.Authentication,
|
||||
|
||||
(rq: express.Request<StorefrontFetchParams>, rs: express.Response) => {
|
||||
if (!rq.params.id) {
|
||||
rs.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
rs.json({
|
||||
StorefrontType: parseInt(rq.params.id),
|
||||
NextUpdate: new Date(Date.now() + 604_800_000).toISOString(),
|
||||
StoreItems: []
|
||||
});
|
||||
},
|
||||
|
||||
);
|
||||
@@ -23,8 +23,6 @@ route.router.get('/LoadingScreenTipData',
|
||||
|
||||
APIUtils.Authentication,
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json([]);
|
||||
}
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
@@ -18,8 +18,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
import { APIUtils } from "../apiutils.ts";
|
||||
import { route as PlayerRoute } from "./match/player.ts";
|
||||
import { route as GotoRoute } from "./match/goto.ts";
|
||||
import { route as RoomRoute } from "./match/room.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/match');
|
||||
|
||||
route.router.use(PlayerRoute.path, PlayerRoute.router);
|
||||
route.router.use(GotoRoute.path, GotoRoute.router);
|
||||
route.router.use(GotoRoute.path, GotoRoute.router);
|
||||
route.router.use(RoomRoute.path, RoomRoute.router);
|
||||
@@ -15,12 +15,15 @@ GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import Matchmaking from "../../data/live/base.ts";
|
||||
import { MatchmakingErrorCode } from "../../data/live/types.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import express from "express";
|
||||
|
||||
const log = new Logging("MatchGotoRoute");
|
||||
|
||||
export const route = APIUtils.createRouter('/goto');
|
||||
|
||||
interface MatchmakingParams {
|
||||
@@ -35,6 +38,7 @@ route.router.post('/room/:roomName',
|
||||
|
||||
async (rq: express.Request<MatchmakingParams>, rs: express.Response) => {
|
||||
if (!rq.params.roomName) {
|
||||
log.d('Matchmake failed: No room specified');
|
||||
rs.json({
|
||||
errorCode: MatchmakingErrorCode.NoSuchRoom
|
||||
});
|
||||
|
||||
@@ -23,6 +23,8 @@ import Presence, { PresenceExport } from "../../data/live/presence.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import UnifiedProfile from "../../data/profiles.ts";
|
||||
import { PlayerStatusVisibility, VRMovementMode } from "../../data/live/types.ts";
|
||||
import { SettingKey } from "../../data/content/settings.ts";
|
||||
|
||||
const log = new Logging("MatchPlayerRoute");
|
||||
|
||||
@@ -51,7 +53,6 @@ route.router.get('/',
|
||||
const presExport: PresenceExport[] = [];
|
||||
for (const id of ids) {
|
||||
const pres = await Presence.get(UnifiedProfile.get(id));
|
||||
await pres.update();
|
||||
presExport.push(await pres.export());
|
||||
}
|
||||
|
||||
@@ -100,8 +101,51 @@ route.router.post('/heartbeat',
|
||||
|
||||
async (_rq, rs) => {
|
||||
const pres = await Presence.get(rs.locals.profile);
|
||||
await pres.update();
|
||||
rs.json(await pres.export());
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
interface StatusVisibilityBody {
|
||||
statusVisibility: PlayerStatusVisibility
|
||||
}
|
||||
const StatusVisibilitySchema = z.object({
|
||||
statusVisibility: z.nativeEnum(PlayerStatusVisibility)
|
||||
});
|
||||
|
||||
route.router.put('/statusvisibility',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
express.urlencoded({ extended: true }),
|
||||
APIUtils.validateRequestBody(StatusVisibilitySchema),
|
||||
|
||||
async (rq: express.Request<NoBody, NoBody, StatusVisibilityBody>, rs: express.Response) => {
|
||||
rs.locals.profile.Settings.setSetting(SettingKey.PlayerStatusVisibility, rq.body.statusVisibility.toString());
|
||||
(await Presence.get(rs.locals.profile)).updateStatusVisibility();
|
||||
rs.sendStatus(200);
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
interface VRMovementModeBody {
|
||||
vrMovementMode: PlayerStatusVisibility
|
||||
}
|
||||
const VRMovementModeSchema = z.object({
|
||||
vrMovementMode: z.nativeEnum(VRMovementMode)
|
||||
});
|
||||
|
||||
route.router.put('/vrmovementmode',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
express.urlencoded({ extended: true }),
|
||||
APIUtils.validateRequestBody(VRMovementModeSchema),
|
||||
|
||||
async (rq: express.Request<NoBody, NoBody, VRMovementModeBody>, rs: express.Response) => {
|
||||
rs.locals.profile.Settings.setSetting(SettingKey.VRMovementMode, rq.body.vrMovementMode.toString());
|
||||
(await Presence.get(rs.locals.profile)).updateVRMovementMode();
|
||||
rs.sendStatus(200);
|
||||
},
|
||||
|
||||
);
|
||||
56
src/routes/match/room.ts
Normal file
56
src/routes/match/room.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Galvanic Corrosion - Rec Room custom server for communities.
|
||||
<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
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import Instances from "../../data/live/instances.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import express from "express";
|
||||
|
||||
export const route = APIUtils.createRouter('/room');
|
||||
|
||||
interface RoomGetInstancesParams {
|
||||
id?: string
|
||||
}
|
||||
route.router.get('/:id/instances',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
(rq: express.Request<RoomGetInstancesParams>, rs: express.Response) => {
|
||||
// TODO: send forbidden request when player is requesting instances for a room that they do not have permissions for
|
||||
if (!rq.params.id) {
|
||||
rs.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
const parsedId = parseInt(rq.params.id);
|
||||
if (isNaN(parsedId)) {
|
||||
rs.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
|
||||
const instances = Instances.getAllRoomInstances(parsedId);
|
||||
rs.json(instances.values().toArray().map(instance => ({
|
||||
roomInstanceId: instance.roomInstanceId,
|
||||
roomId: parsedId,
|
||||
subRoomId: instance.subRoomId,
|
||||
isFull: instance.isFull,
|
||||
createdAt: new Date().toISOString(), // TODO: rewrite instance - create instance class rather than using sets - include datetime when instance was created
|
||||
playerIds: Instances.getInstancePlayers(instance).values().toArray().map(profile => profile.getId())
|
||||
})));
|
||||
},
|
||||
|
||||
);
|
||||
Reference in New Issue
Block a user