mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-27 00:04:37 +08:00
* Add ape key authentication * Move ape key config to server config * Remove full stops * Fix
74 lines
1.5 KiB
TypeScript
74 lines
1.5 KiB
TypeScript
type ExpressRequest = import("express").Request;
|
|
|
|
declare namespace MonkeyTypes {
|
|
interface Configuration {
|
|
maintenance: boolean;
|
|
quoteReport: {
|
|
enabled: boolean;
|
|
maxReports: number;
|
|
contentReportLimit: number;
|
|
};
|
|
quoteSubmit: {
|
|
enabled: boolean;
|
|
};
|
|
resultObjectHashCheck: {
|
|
enabled: boolean;
|
|
};
|
|
apeKeys: {
|
|
endpointsEnabled: boolean;
|
|
acceptKeys: boolean;
|
|
maxKeysPerUser: number;
|
|
apeKeyBytes: number;
|
|
apeKeySaltRounds: number;
|
|
};
|
|
enableSavingResults: {
|
|
enabled: boolean;
|
|
};
|
|
}
|
|
|
|
interface DecodedToken {
|
|
uid?: string;
|
|
email?: string;
|
|
}
|
|
|
|
interface Context {
|
|
configuration: Configuration;
|
|
decodedToken: DecodedToken;
|
|
}
|
|
|
|
interface Request extends ExpressRequest {
|
|
ctx: Readonly<Context>;
|
|
}
|
|
|
|
// Data Model
|
|
|
|
interface User {
|
|
// TODO, Complete the typings for the user model
|
|
addedAt: number;
|
|
bananas: number;
|
|
completedTests: number;
|
|
discordId?: string;
|
|
email: string;
|
|
lastNameChange: number;
|
|
lbMemory: object;
|
|
lbPersonalBests: object;
|
|
name: string;
|
|
personalBests: object;
|
|
quoteRatings?: Record<string, Record<string, number>>;
|
|
startedTests: number;
|
|
tags: object[];
|
|
timeTyping: number;
|
|
uid: string;
|
|
quoteMod?: boolean;
|
|
cannotReport?: boolean;
|
|
apeKeys?: Record<string, ApeKey>;
|
|
}
|
|
|
|
interface ApeKey {
|
|
name: string;
|
|
hash: string;
|
|
createdOn: number;
|
|
modifiedOn: number;
|
|
enabled: boolean;
|
|
}
|
|
}
|