mirror of
https://github.com/djhackersdev/minime.git
synced 2026-04-22 01:07:24 -05:00
idz: Add explicit CreateProfileResponse
This commit is contained in:
parent
2a546c0d9d
commit
efcc1caa76
11
src/idz/userdb/encoder/createProfile.ts
Normal file
11
src/idz/userdb/encoder/createProfile.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { CreateProfileResponse } from "../response/createProfile";
|
||||
|
||||
export function createProfile(res: CreateProfileResponse) {
|
||||
const buf = Buffer.alloc(0x0020);
|
||||
|
||||
// Shares message type code with the "generic" response
|
||||
buf.writeInt16LE(0x0001, 0x0000);
|
||||
buf.writeInt32LE(res.aimeId, 0x0004);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import logger from "debug";
|
|||
|
||||
import { _team } from "./_team";
|
||||
import { checkTeamName } from "./checkTeamName";
|
||||
import { createProfile } from "./createProfile";
|
||||
import { createTeam } from "./createTeam";
|
||||
import { discoverProfile } from "./discoverProfile";
|
||||
import { generic } from "./generic";
|
||||
|
|
@ -47,6 +48,9 @@ function encode110(res: Response): Buffer {
|
|||
case "create_auto_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "create_profile_res":
|
||||
return createProfile(res);
|
||||
|
||||
case "create_team_res":
|
||||
return createTeam(res);
|
||||
|
||||
|
|
@ -149,6 +153,9 @@ function encode130(res: Response): Buffer {
|
|||
case "create_auto_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "create_profile_res":
|
||||
return createProfile(res);
|
||||
|
||||
case "create_team_res":
|
||||
return createTeam(res);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import { Settings } from "../model/settings";
|
|||
import { Story } from "../model/story";
|
||||
import { Unlocks } from "../model/unlocks";
|
||||
import { CreateProfileRequest } from "../request/createProfile";
|
||||
import { GenericResponse } from "../response/generic";
|
||||
import { CreateProfileResponse } from "../response/createProfile";
|
||||
import { Repositories } from "../repo";
|
||||
|
||||
export async function createProfile(
|
||||
w: Repositories,
|
||||
req: CreateProfileRequest
|
||||
): Promise<GenericResponse> {
|
||||
): Promise<CreateProfileResponse> {
|
||||
const { aimeId, version, name } = req;
|
||||
const now = new Date();
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ export async function createProfile(
|
|||
await w.teamReservations().commitHack(aimeId);
|
||||
|
||||
return {
|
||||
type: "generic_res",
|
||||
status: aimeId, // "Generic response" my fucking *ass*
|
||||
type: "create_profile_res",
|
||||
aimeId: aimeId,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
6
src/idz/userdb/response/createProfile.ts
Normal file
6
src/idz/userdb/response/createProfile.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { AimeId } from "../../../model";
|
||||
|
||||
export interface CreateProfileResponse {
|
||||
type: "create_profile_res";
|
||||
aimeId: AimeId;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { CheckTeamNameResponse } from "./checkTeamName";
|
||||
import { CreateAutoTeamResponse } from "./createAutoTeam";
|
||||
import { CreateProfileResponse } from "./createProfile";
|
||||
import { CreateTeamResponse } from "./createTeam";
|
||||
import { DiscoverProfileResponse } from "./discoverProfile";
|
||||
import { GenericResponse } from "./generic";
|
||||
|
|
@ -33,6 +34,7 @@ import { UnlockProfileResponse } from "./unlockProfile";
|
|||
export type Response =
|
||||
| CheckTeamNameResponse
|
||||
| CreateAutoTeamResponse
|
||||
| CreateProfileResponse
|
||||
| CreateTeamResponse
|
||||
| DiscoverProfileResponse
|
||||
| GenericResponse
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user