prettier
This commit is contained in:
parent
7116a9a1b0
commit
5a7765c7dc
@ -26,7 +26,7 @@ import {
|
||||
Sentry,
|
||||
WebAuthn,
|
||||
ConnectionConfig,
|
||||
ConnectionLoader
|
||||
ConnectionLoader,
|
||||
} from "@fosscord/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Server, ServerOptions } from "lambert-server";
|
||||
|
@ -53,7 +53,7 @@ export const NO_AUTHORIZATION_ROUTES = [
|
||||
// Asset delivery
|
||||
/\/guilds\/\d+\/widget\.(json|png)/,
|
||||
// Connections
|
||||
/\/connections\/\w+\/callback/
|
||||
/\/connections\/\w+\/callback/,
|
||||
];
|
||||
|
||||
export const API_PREFIX = /^\/api(\/v\d+)?/;
|
||||
|
@ -2,4 +2,4 @@ export class DiscordSettings {
|
||||
enabled: boolean = false;
|
||||
clientId: string | null = null;
|
||||
clientSecret: string | null = null;
|
||||
}
|
||||
}
|
||||
|
@ -79,53 +79,60 @@ export async function onIdentify(this: WebSocket, data: Payload) {
|
||||
this.user_id = decoded.id;
|
||||
const session_id = this.session_id;
|
||||
|
||||
const [user, read_states, members, recipients, session, application, connected_accounts] =
|
||||
await Promise.all([
|
||||
User.findOneOrFail({
|
||||
where: { id: this.user_id },
|
||||
relations: ["relationships", "relationships.to", "settings"],
|
||||
select: [...PrivateUserProjection, "relationships"],
|
||||
}),
|
||||
ReadState.find({ where: { user_id: this.user_id } }),
|
||||
Member.find({
|
||||
where: { id: this.user_id },
|
||||
select: MemberPrivateProjection,
|
||||
relations: [
|
||||
"guild",
|
||||
"guild.channels",
|
||||
"guild.emojis",
|
||||
"guild.roles",
|
||||
"guild.stickers",
|
||||
"user",
|
||||
"roles",
|
||||
],
|
||||
}),
|
||||
Recipient.find({
|
||||
where: { user_id: this.user_id, closed: false },
|
||||
relations: [
|
||||
"channel",
|
||||
"channel.recipients",
|
||||
"channel.recipients.user",
|
||||
],
|
||||
// TODO: public user selection
|
||||
}),
|
||||
// save the session and delete it when the websocket is closed
|
||||
Session.create({
|
||||
user_id: this.user_id,
|
||||
session_id: session_id,
|
||||
// TODO: check if status is only one of: online, dnd, offline, idle
|
||||
status: identify.presence?.status || "offline", //does the session always start as online?
|
||||
client_info: {
|
||||
//TODO read from identity
|
||||
client: "desktop",
|
||||
os: identify.properties?.os,
|
||||
version: 0,
|
||||
},
|
||||
activities: [],
|
||||
}).save(),
|
||||
Application.findOne({ where: { id: this.user_id } }),
|
||||
ConnectedAccount.find({ where: { user_id: this.user_id } })
|
||||
]);
|
||||
const [
|
||||
user,
|
||||
read_states,
|
||||
members,
|
||||
recipients,
|
||||
session,
|
||||
application,
|
||||
connected_accounts,
|
||||
] = await Promise.all([
|
||||
User.findOneOrFail({
|
||||
where: { id: this.user_id },
|
||||
relations: ["relationships", "relationships.to", "settings"],
|
||||
select: [...PrivateUserProjection, "relationships"],
|
||||
}),
|
||||
ReadState.find({ where: { user_id: this.user_id } }),
|
||||
Member.find({
|
||||
where: { id: this.user_id },
|
||||
select: MemberPrivateProjection,
|
||||
relations: [
|
||||
"guild",
|
||||
"guild.channels",
|
||||
"guild.emojis",
|
||||
"guild.roles",
|
||||
"guild.stickers",
|
||||
"user",
|
||||
"roles",
|
||||
],
|
||||
}),
|
||||
Recipient.find({
|
||||
where: { user_id: this.user_id, closed: false },
|
||||
relations: [
|
||||
"channel",
|
||||
"channel.recipients",
|
||||
"channel.recipients.user",
|
||||
],
|
||||
// TODO: public user selection
|
||||
}),
|
||||
// save the session and delete it when the websocket is closed
|
||||
Session.create({
|
||||
user_id: this.user_id,
|
||||
session_id: session_id,
|
||||
// TODO: check if status is only one of: online, dnd, offline, idle
|
||||
status: identify.presence?.status || "offline", //does the session always start as online?
|
||||
client_info: {
|
||||
//TODO read from identity
|
||||
client: "desktop",
|
||||
os: identify.properties?.os,
|
||||
version: 0,
|
||||
},
|
||||
activities: [],
|
||||
}).save(),
|
||||
Application.findOne({ where: { id: this.user_id } }),
|
||||
ConnectedAccount.find({ where: { user_id: this.user_id } }),
|
||||
]);
|
||||
|
||||
if (!user) return this.close(CLOSECODES.Authentication_failed);
|
||||
if (!user.settings) {
|
||||
|
@ -25,4 +25,4 @@ export * from "./dtos/index";
|
||||
export * from "./schemas";
|
||||
export * from "./imports";
|
||||
export * from "./config";
|
||||
export * from "./connections"
|
||||
export * from "./connections";
|
||||
|
Loading…
x
Reference in New Issue
Block a user