The Rewrite™️
- Discord bot removed, will return *eventually*
- Watchdog kills the server with a knife when it does not shut down in (default) 60 seconds
- New event system that works.. better.. and callbacks have types
- Removed a metric ton of circular dependencies that previously would not let the server start up
* This included splitting up some classes
- Other. internal stuff. I forgot.
This commit is contained in:
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/announcement");
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import express from "express";
|
||||
import { AvatarSettings } from "../../data/profile/avatar.ts";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/challenge");
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ 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 { ObjectiveType } from "../../data/objectives.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { ObjectiveType } from "../../data/content/ObjectiveTypes.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/checklist');
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ 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";
|
||||
import { Config } from "../../config/config.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
const config = Config.getConfig();
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ 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 { GameConfigs } from "../../data/config.ts";
|
||||
import { getPublicConfig } from "../../data/config/PublicConfig.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/config");
|
||||
|
||||
const rateLimit = new APIUtils.RateLimiter();
|
||||
|
||||
route.router.get("/v2", rateLimit.middle(), (_rq, rs) => {
|
||||
const config = GameConfigs.getConfig();
|
||||
const config = getPublicConfig();
|
||||
if (config == null) rs.sendStatus(500);
|
||||
else rs.json(config);
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/consumables');
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/equipment');
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ 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 { GameConfigs } from "../../data/config.ts";
|
||||
import { GameConfigs } from "../../data/config/GameConfigs.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/gameconfigs");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/images');
|
||||
|
||||
@@ -27,4 +27,17 @@ route.router.get('/v2/named',
|
||||
|
||||
APIUtils.emptyArrayResponse
|
||||
|
||||
);
|
||||
|
||||
route.router.post('/v4/uploadsaved',
|
||||
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
APIUtils.requestDebug,
|
||||
|
||||
(_rq, rs) => {
|
||||
rs.json({ImageName:"notsaved.png"});
|
||||
},
|
||||
|
||||
);
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import express from "express";
|
||||
|
||||
export const route = APIUtils.createRouter('/objectives');
|
||||
|
||||
@@ -17,9 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import express from "express";
|
||||
import Server from "../../data/server.ts";
|
||||
import Server from "../../data/server/server.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/playerReputation");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ 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";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/playerevents');
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import express from "express";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import { z } from "zod";
|
||||
import Server from "../../data/server.ts";
|
||||
import Server from "../../data/server/server.ts";
|
||||
|
||||
const log = new Logging("ProgressionRoute");
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ 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";
|
||||
import { Config } from "../../config/config.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
|
||||
export const route = APIUtils.createRouter("/quickPlay");
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import express from "express";
|
||||
|
||||
export const route = APIUtils.createRouter("/relationships");
|
||||
|
||||
@@ -17,13 +17,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { z } from "zod";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import Rooms from "../../data/content/rooms.ts";
|
||||
import { FactoryMode, RoomDataTypes, WriteMode } from "../../data/content/rooms/DataTypes.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import RoomsMisc from "../../data/content/rooms/Rooms.ts";
|
||||
import { FactoryMode, RoomDataTypes, WriteMode } from "../../data/content/rooms/base/DataTypes.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import express from "express";
|
||||
import { RoomFactory } from "../../data/content/rooms/RoomFactory.ts";
|
||||
import { SubroomFactory } from "../../data/content/rooms/SubroomFactory.ts";
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import Rooms from "../../data/content/rooms/base/RoomsBase.ts";
|
||||
|
||||
const log = new Logging("RoomsRoute");
|
||||
|
||||
@@ -83,7 +84,7 @@ route.router.get('/v1/hot',
|
||||
|
||||
async (_rq, rs) => {
|
||||
// temporary: return all public AG rooms for testing
|
||||
const rooms = await Rooms.getAllBuiltinRoomGenerations();
|
||||
const rooms = await RoomsMisc.getAllBuiltinRoomGenerations();
|
||||
rs.json(rooms.map(room => room.Room).filter(room => room.Accessibility == RoomDataTypes.RoomAccessibility.Public));
|
||||
},
|
||||
|
||||
@@ -95,7 +96,7 @@ route.router.get('/v2/baserooms',
|
||||
APIUtils.AuthenticationType(AuthType.Game),
|
||||
|
||||
async (_rq, rs) => {
|
||||
const rooms = await Rooms.getAllBuiltinRoomGenerations();
|
||||
const rooms = await RoomsMisc.getAllBuiltinRoomGenerations();
|
||||
rs.json(rooms.map(room => room.Room).filter(room => room.CloningAllowed));
|
||||
},
|
||||
|
||||
@@ -120,7 +121,7 @@ route.router.get('/v2/name/:name',
|
||||
rs.json(room.Room);
|
||||
return;
|
||||
} else if (rq.params.name == 'DormRoom') {
|
||||
const dorm = await Rooms.getProfileDormDefault(rs.locals.profile);
|
||||
const dorm = await RoomsMisc.getProfileDormDefault(rs.locals.profile);
|
||||
if (dorm) rs.json(dorm.Room);
|
||||
else rs.sendStatus(404);
|
||||
return;
|
||||
@@ -150,7 +151,7 @@ route.router.get('/v1/agRoomIds',
|
||||
|
||||
async (_rq, rs) => {
|
||||
|
||||
const rooms = await Rooms.getAllBuiltinRoomGenerations();
|
||||
const rooms = await RoomsMisc.getAllBuiltinRoomGenerations();
|
||||
rs.json(rooms.map(det => det.Room.RoomId));
|
||||
|
||||
},
|
||||
@@ -175,7 +176,7 @@ route.router.post('/v1/clone',
|
||||
|
||||
async (rq: express.Request<NoBody, NoBody, CloneRoomBody>, rs: express.Response) => {
|
||||
|
||||
const room = await Rooms.cloneRoom(rq.body.RoomId, rq.body.Name, rs.locals.profile);
|
||||
const room = await RoomsMisc.cloneRoom(rq.body.RoomId, rq.body.Name, rs.locals.profile);
|
||||
|
||||
const masterRoomFactory = await new RoomFactory({ id: rq.body.RoomId }).init();
|
||||
|
||||
@@ -231,7 +232,6 @@ route.router.post('/v4/saveData',
|
||||
}
|
||||
|
||||
const subroomFactory = await new SubroomFactory({
|
||||
roomId: currentInstance.roomId,
|
||||
subroomId: rq.body.RoomSceneId,
|
||||
factoryMode: FactoryMode.Write,
|
||||
writeMode: WriteMode.Overwrite
|
||||
@@ -249,10 +249,6 @@ route.router.post('/v4/saveData',
|
||||
await subroomFactory.write();
|
||||
|
||||
rs.json(subroomFactory.export());
|
||||
|
||||
currentInstance.dataBlob = newFilename;
|
||||
currentInstance.updatePlayers();
|
||||
Rooms.socketUpdateRoom(currentInstance);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import { APIUtils, NoBody } from "../../apiutils.ts";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import z from "zod";
|
||||
import express from "express";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import express from "express";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { AuthType } from "../../data/UserTypes.ts";
|
||||
import { StorefrontBalanceType } from "../../data/content/storefronts.ts";
|
||||
|
||||
export const route = APIUtils.createRouter('/storefronts');
|
||||
|
||||
Reference in New Issue
Block a user