mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-29 06:10:47 +00:00
Consolidate the messages into the same enum
This commit is contained in:
@@ -25,6 +25,7 @@ import { OpenAPITags, registry } from "@server/openApi";
|
||||
import { hashPassword } from "@server/auth/password";
|
||||
import { disconnectClient, sendToClient } from "#private/routers/ws";
|
||||
import { OlmErrorCodes, sendOlmError } from "@server/routers/olm/error";
|
||||
import { sendTerminateClient } from "@server/routers/client/terminate";
|
||||
|
||||
const reGenerateSecretParamsSchema = z.strictObject({
|
||||
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||
@@ -118,15 +119,12 @@ export async function reGenerateClientSecret(
|
||||
|
||||
// Only disconnect if explicitly requested
|
||||
if (disconnect) {
|
||||
const payload = {
|
||||
type: `olm/terminate`,
|
||||
data: {
|
||||
code: OlmErrorCodes.TERMINATED_REKEYED,
|
||||
message: "Client secret has been regenerated"
|
||||
}
|
||||
};
|
||||
// Don't await this to prevent blocking the response
|
||||
sendToClient(existingOlms[0].olmId, payload).catch((error) => {
|
||||
sendTerminateClient(
|
||||
clientId,
|
||||
OlmErrorCodes.TERMINATED_REKEYED,
|
||||
existingOlms[0].olmId
|
||||
).catch((error) => {
|
||||
logger.error(
|
||||
"Failed to send termination message to olm:",
|
||||
error
|
||||
|
||||
Reference in New Issue
Block a user