1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 13:14:06 +01:00

fix message model

This commit is contained in:
Flam3rboy 2021-05-30 01:45:22 +02:00
parent f030b13bf5
commit 16099a7b24
2 changed files with 5 additions and 3 deletions

View File

@ -125,8 +125,9 @@ export interface Attachment {
size: number; // size of file in bytes size: number; // size of file in bytes
url: string; // source url of file url: string; // source url of file
proxy_url: string; // a proxied url of file proxy_url: string; // a proxied url of file
height: number; // height of file (if image) height?: number; // height of file (if image)
width: number; // width of file (if image) width?: number; // width of file (if image)
content_type?: string;
} }
export interface Embed { export interface Embed {
@ -205,6 +206,7 @@ export const Attachment = {
proxy_url: String, // a proxied url of file proxy_url: String, // a proxied url of file
height: Number, // height of file (if image) height: Number, // height of file (if image)
width: Number, // width of file (if image) width: Number, // width of file (if image)
content_type: String,
}; };
export const EmbedImage = { export const EmbedImage = {

View File

@ -8,7 +8,7 @@ export function checkToken(token: string, jwtSecret: string): Promise<any> {
if (err || !decoded) return rej("Invalid Token"); if (err || !decoded) return rej("Invalid Token");
const user = await UserModel.findOne({ id: decoded.id }, { "user_data.valid_tokens_since": true }).exec(); const user = await UserModel.findOne({ id: decoded.id }, { "user_data.valid_tokens_since": true }).exec();
if (!user) return rej("User not found"); if (!user) return rej("Invalid Token");
if (decoded.iat * 1000 < user.user_data.valid_tokens_since.getTime()) return rej("Invalid Token"); if (decoded.iat * 1000 < user.user_data.valid_tokens_since.getTime()) return rej("Invalid Token");
if (user.disabled) return rej("User disabled"); if (user.disabled) return rej("User disabled");
if (user.deleted) return rej("User not found"); if (user.deleted) return rej("User not found");