mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-05 23:29:48 +00:00
Prettier 5
This commit is contained in:
@@ -38,10 +38,7 @@ router.get(
|
||||
const { limit } = req.query;
|
||||
const showAllGuilds = Config.get().guild.discovery.showAllGuilds;
|
||||
|
||||
const genLoadId = (size: number) =>
|
||||
[...Array(size)]
|
||||
.map(() => Math.floor(Math.random() * 16).toString(16))
|
||||
.join("");
|
||||
const genLoadId = (size: number) => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join("");
|
||||
|
||||
const guilds = showAllGuilds
|
||||
? await Guild.find({ take: Math.abs(Number(limit || 24)) })
|
||||
|
||||
@@ -41,10 +41,7 @@ router.patch(
|
||||
async (req: Request, res: Response) => {
|
||||
const { guild_id } = req.params;
|
||||
let permissionString: PermissionResolvable = "MANAGE_NICKNAMES";
|
||||
const member_id =
|
||||
req.params.member_id === "@me"
|
||||
? ((permissionString = "CHANGE_NICKNAME"), req.user_id)
|
||||
: req.params.member_id;
|
||||
const member_id = req.params.member_id === "@me" ? ((permissionString = "CHANGE_NICKNAME"), req.user_id) : req.params.member_id;
|
||||
|
||||
const perms = await getPermission(req.user_id, guild_id);
|
||||
perms.hasThrow(permissionString);
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
HubWaitlistSignupResponse,
|
||||
HubWaitlistSignupSchema,
|
||||
} from "@spacebar/schemas";
|
||||
import { HubWaitlistSignupResponse, HubWaitlistSignupSchema } from "@spacebar/schemas";
|
||||
import { Request, Response, Router } from "express";
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@@ -45,10 +45,7 @@ router.post(
|
||||
|
||||
if (user.data.hash) {
|
||||
// guest accounts can delete accounts without password
|
||||
correctpass = await bcrypt.compare(
|
||||
req.body.password,
|
||||
user.data.hash,
|
||||
); //Not sure if user typed right password :/
|
||||
correctpass = await bcrypt.compare(req.body.password, user.data.hash); //Not sure if user typed right password :/
|
||||
}
|
||||
|
||||
if (correctpass) {
|
||||
|
||||
@@ -79,10 +79,7 @@ router.put(
|
||||
},
|
||||
})
|
||||
) {
|
||||
Note.update(
|
||||
{ owner: { id: owner.id }, target: { id: target.id } },
|
||||
{ owner, target, content: note },
|
||||
);
|
||||
Note.update({ owner: { id: owner.id }, target: { id: target.id } }, { owner, target, content: note });
|
||||
} else {
|
||||
Note.insert({
|
||||
id: Snowflake.generate(),
|
||||
|
||||
@@ -46,10 +46,7 @@ export async function verifyCaptcha(response: string, ip?: string) {
|
||||
const { security } = Config.get();
|
||||
const { service, secret, sitekey } = security.captcha;
|
||||
|
||||
if (!service || !secret || !sitekey)
|
||||
throw new Error(
|
||||
"CAPTCHA is not configured correctly. https://docs.spacebar.chat/setup/server/security/captcha/",
|
||||
);
|
||||
if (!service || !secret || !sitekey) throw new Error("CAPTCHA is not configured correctly. https://docs.spacebar.chat/setup/server/security/captcha/");
|
||||
|
||||
const res = await fetch(verifyEndpoints[service], {
|
||||
method: "POST",
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export class HTTPError extends Error {
|
||||
constructor(message: string, public code: number = 400) {
|
||||
constructor(
|
||||
message: string,
|
||||
public code: number = 400,
|
||||
) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,7 @@ export interface traverseDirectoryOptions {
|
||||
const DEFAULT_EXCLUDE_DIR = /^\./;
|
||||
const DEFAULT_FILTER = /^([^.].*)(?<!\.d)\.(ts|js)$/;
|
||||
|
||||
export async function traverseDirectory<T>(
|
||||
options: traverseDirectoryOptions,
|
||||
action: (path: string) => T
|
||||
): Promise<T[]> {
|
||||
export async function traverseDirectory<T>(options: traverseDirectoryOptions, action: (path: string) => T): Promise<T[]> {
|
||||
if (!options.filter) options.filter = DEFAULT_FILTER;
|
||||
if (!options.excludeDirs) options.excludeDirs = DEFAULT_EXCLUDE_DIR;
|
||||
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
|
||||
import { VoiceOPCodes, VoicePayload, WebRtcWebSocket, Send } from "../util";
|
||||
|
||||
export async function onBackendVersion(
|
||||
this: WebRtcWebSocket,
|
||||
data: VoicePayload,
|
||||
) {
|
||||
export async function onBackendVersion(this: WebRtcWebSocket, data: VoicePayload) {
|
||||
await Send(this, {
|
||||
op: VoiceOPCodes.VOICE_BACKEND_VERSION,
|
||||
d: { voice: "0.8.43", rtc_worker: "0.3.26" },
|
||||
|
||||
@@ -24,10 +24,7 @@ import { onSelectProtocol } from "./SelectProtocol";
|
||||
import { onSpeaking } from "./Speaking";
|
||||
import { onVideo } from "./Video";
|
||||
|
||||
export type OPCodeHandler = (
|
||||
this: WebRtcWebSocket,
|
||||
data: VoicePayload,
|
||||
) => Promise<void>;
|
||||
export type OPCodeHandler = (this: WebRtcWebSocket, data: VoicePayload) => Promise<void>;
|
||||
|
||||
export default {
|
||||
[VoiceOPCodes.HEARTBEAT]: onHeartbeat,
|
||||
|
||||
Reference in New Issue
Block a user