mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
chore: add backend-y bits of heartbeats
This commit is contained in:
parent
f65779f925
commit
a34aebabe3
12 changed files with 174 additions and 2 deletions
|
@ -69,6 +69,20 @@ export const getSessionID = (request: Request): { type: string; id: string } | n
|
|||
return { type, id };
|
||||
};
|
||||
|
||||
export const getSharedKey = (request: Request): { type: string; id: string } | null => {
|
||||
const sharedKey = request.headers.get('authorization');
|
||||
if (!sharedKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const [type, id] = sharedKey.split(' ');
|
||||
if (type !== 'Shared') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { type, id };
|
||||
};
|
||||
|
||||
export const userAgent =
|
||||
'DiscordBot (https://github.com/roleypoly/roleypoly, git-main) (+https://roleypoly.com)';
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ const list = (x: string) => x.split(',');
|
|||
export const botClientID = env('BOT_CLIENT_ID');
|
||||
export const botClientSecret = env('BOT_CLIENT_SECRET');
|
||||
export const botToken = env('BOT_TOKEN');
|
||||
export const botHeartbeatToken = env('BOT_HEARTBEAT_TOKEN');
|
||||
export const uiPublicURI = safeURI(env('UI_PUBLIC_URI'));
|
||||
export const apiPublicURI = safeURI(env('API_PUBLIC_URI'));
|
||||
export const rootUsers = list(env('ROOT_USERS'));
|
||||
|
|
|
@ -88,3 +88,6 @@ const self = (global as any) as Record<string, any>;
|
|||
export const Sessions = new WrappedKVNamespace(kvOrLocal(self.KV_SESSIONS ?? null));
|
||||
export const GuildData = new WrappedKVNamespace(kvOrLocal(self.KV_GUILD_DATA ?? null));
|
||||
export const Guilds = new WrappedKVNamespace(kvOrLocal(self.KV_GUILDS ?? null));
|
||||
export const Infrastructure = new WrappedKVNamespace(
|
||||
kvOrLocal(self.KV_INFRASTRUCTURE ?? null)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue