Reorganise schemas a little bit
This commit is contained in:
parent
0da7169b00
commit
e52c237326
90
.idea/workspace.xml
generated
90
.idea/workspace.xml
generated
@ -16,6 +16,14 @@
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="TypeScript File" />
|
||||
<option value="JavaScript File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
@ -39,53 +47,57 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
|
||||
"NIXITCH_NIX_CONF_DIR": "",
|
||||
"NIXITCH_NIX_OTHER_STORES": "",
|
||||
"NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
|
||||
"NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
|
||||
"NIXITCH_NIX_REMOTE": "",
|
||||
"NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
|
||||
"Node.js.Server.ts.executor": "Debug",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"javascript.nodejs.core.library.configured.version": "24.8.0",
|
||||
"javascript.nodejs.core.library.typings.version": "24.7.0",
|
||||
"last_opened_file_path": "/home/Rory/git/spacebar/server/src/admin-api/routes/v0",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_interpreter_path": "node",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"npm.Start API.executor": "Run",
|
||||
"npm.Start CDN.executor": "Run",
|
||||
"npm.Start Gateway.executor": "Run",
|
||||
"npm.build.executor": "Run",
|
||||
"npm.start.executor": "Debug",
|
||||
"prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server/node_modules/prettier",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
|
||||
"NIXITCH_NIX_CONF_DIR": "",
|
||||
"NIXITCH_NIX_OTHER_STORES": "",
|
||||
"NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
|
||||
"NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
|
||||
"NIXITCH_NIX_REMOTE": "",
|
||||
"NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
|
||||
"Node.js.Server.ts.executor": "Debug",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"javascript.nodejs.core.library.configured.version": "24.8.0",
|
||||
"javascript.nodejs.core.library.typings.version": "24.7.0",
|
||||
"last_opened_file_path": "/home/Rory/git/spacebar/server-master/src/schemas",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_interpreter_path": "node",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"npm.Start API.executor": "Run",
|
||||
"npm.Start CDN.executor": "Run",
|
||||
"npm.Start Gateway.executor": "Run",
|
||||
"npm.build.executor": "Run",
|
||||
"npm.start.executor": "Debug",
|
||||
"prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server-master/node_modules/prettier",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"GitStage.ChangesTree.GroupingKeys": [
|
||||
"directory",
|
||||
"module",
|
||||
"repository"
|
||||
"keyToStringList": {
|
||||
"GitStage.ChangesTree.GroupingKeys": [
|
||||
"directory",
|
||||
"module",
|
||||
"repository"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/schemas" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/api/users" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/api/messages" />
|
||||
<recent name="$PROJECT_DIR$/src/admin-api/routes/v0" />
|
||||
<recent name="$PROJECT_DIR$/src" />
|
||||
<recent name="$PROJECT_DIR$/src/api/routes/channels/#channel_id/messages" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src" />
|
||||
<recent name="$PROJECT_DIR$/src/api/routes/store/published-listings/applications/#application_id" />
|
||||
<recent name="$PROJECT_DIR$/src/api/routes/store/published-listings/skus/#sku_id" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/uncategorised" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/gateway" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/api/developers" />
|
||||
<recent name="$PROJECT_DIR$/src/schemas/webrtc" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
@ -132,7 +144,7 @@
|
||||
<workItem from="1735848116134" duration="80763000" />
|
||||
<workItem from="1759868659577" duration="8847000" />
|
||||
<workItem from="1760044946282" duration="43683000" />
|
||||
<workItem from="1760402350251" duration="18740000" />
|
||||
<workItem from="1760402350251" duration="40134000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -5,10 +5,10 @@
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"postinstall": "npx patch-package",
|
||||
"start": "node dist/bundle/start.js",
|
||||
"start:api": "node dist/api/start.js",
|
||||
"start:cdn": "node dist/cdn/start.js",
|
||||
"start:gateway": "node dist/gateway/start.js",
|
||||
"start": "node --enable-source-maps dist/bundle/start.js",
|
||||
"start:api": "node --enable-source-maps dist/api/start.js",
|
||||
"start:cdn": "node --enable-source-maps dist/cdn/start.js",
|
||||
"start:gateway": "node --enable-source-maps dist/gateway/start.js",
|
||||
"build": "npm run build:src && npm run generate:schema && npm run generate:openapi",
|
||||
"build:src": "tsc -b -v",
|
||||
"watch": "tsc -w -b .",
|
||||
|
||||
69
scripts/genIndex.js
Normal file
69
scripts/genIndex.js
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
let content = `/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) ${new Date().getFullYear()} Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
`;
|
||||
|
||||
// node scripts/genIndex.js /path/to/dir
|
||||
const targetDir = process.argv[2];
|
||||
if (!targetDir) {
|
||||
console.error("Please provide a target directory.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (fs.existsSync(path.join(targetDir, "index.js")) || fs.existsSync(path.join(targetDir, "index.ts"))) {
|
||||
console.error("index.js or index.ts already exists in the target directory.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const dirs = fs.readdirSync(targetDir).filter(f => fs.statSync(path.join(targetDir, f)).isDirectory());
|
||||
for (const dir of dirs) {
|
||||
content += `export * from "./${dir}";\n`;
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(targetDir).filter(f => f.endsWith(".js") || f.endsWith(".ts"));
|
||||
for (const file of files) {
|
||||
const filePath = path.join(targetDir, file);
|
||||
const stat = fs.statSync(filePath);
|
||||
if (stat.isFile()) {
|
||||
const ext = path.extname(file);
|
||||
const base = path.basename(file, ext);
|
||||
content += `export * from "./${base}";\n`;
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(targetDir, "index.ts"), content);
|
||||
@ -19,7 +19,6 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Application,
|
||||
BotModifySchema,
|
||||
DiscordApiErrors,
|
||||
User,
|
||||
createAppBotUser,
|
||||
@ -29,6 +28,7 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { BotModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Application,
|
||||
ApplicationModifySchema,
|
||||
DiscordApiErrors,
|
||||
Guild,
|
||||
handleFile,
|
||||
@ -27,6 +26,7 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { ApplicationModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Application,
|
||||
ApplicationCreateSchema,
|
||||
Config,
|
||||
User,
|
||||
createAppBotUser,
|
||||
trimSpecial,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ApplicationCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
RefreshUrlsRequestSchema,
|
||||
getUrlSignature,
|
||||
NewUrlSignatureData,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { RefreshUrlsRequestSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { getIpAdress, route, verifyCaptcha } from "@spacebar/api";
|
||||
import { Config, Email, ForgotPasswordSchema, User } from "@spacebar/util";
|
||||
import { Config, Email, User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ForgotPasswordSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -20,7 +20,6 @@ import { getIpAdress, route, verifyCaptcha } from "@spacebar/api";
|
||||
import {
|
||||
Config,
|
||||
FieldErrors,
|
||||
LoginSchema,
|
||||
User,
|
||||
WebAuthn,
|
||||
generateToken,
|
||||
@ -29,6 +28,7 @@ import {
|
||||
import bcrypt from "bcrypt";
|
||||
import crypto from "crypto";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { LoginSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
export default router;
|
||||
@ -47,8 +47,7 @@ router.post(
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const { login, password, captcha_key, undelete } =
|
||||
req.body as LoginSchema;
|
||||
const { login, password, captcha_key, undelete } = req.body as LoginSchema;
|
||||
|
||||
const config = Config.get();
|
||||
|
||||
|
||||
@ -17,10 +17,11 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { BackupCode, TotpSchema, User, generateToken } from "@spacebar/util";
|
||||
import { BackupCode, User, generateToken } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { TotpSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -23,11 +23,11 @@ import {
|
||||
User,
|
||||
verifyWebAuthnToken,
|
||||
WebAuthn,
|
||||
WebAuthnTotpSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ExpectedAssertionResult } from "fido2-lib";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { WebAuthnTotpSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
function toArrayBuffer(buf: Buffer) {
|
||||
|
||||
@ -27,7 +27,6 @@ import {
|
||||
Config,
|
||||
FieldErrors,
|
||||
Invite,
|
||||
RegisterSchema,
|
||||
User,
|
||||
ValidRegistrationToken,
|
||||
generateToken,
|
||||
@ -36,6 +35,7 @@ import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { MoreThan } from "typeorm";
|
||||
import { RegisterSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -22,11 +22,11 @@ import {
|
||||
Email,
|
||||
FieldErrors,
|
||||
generateToken,
|
||||
PasswordResetSchema,
|
||||
User,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { PasswordResetSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,9 +17,10 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { BackupCodesChallengeSchema, FieldErrors, User } from "@spacebar/util";
|
||||
import { FieldErrors, User } from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { BackupCodesChallengeSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -21,13 +21,12 @@ import {
|
||||
Channel,
|
||||
Config,
|
||||
Permissions,
|
||||
UploadAttachmentRequestSchema,
|
||||
UploadAttachmentResponseSchema,
|
||||
User,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CloudAttachment } from "../../../../util/entities/CloudAttachment";
|
||||
import { CloudAttachment } from "@spacebar/util";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { UploadAttachmentRequestSchema, UploadAttachmentResponseSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { HubDirectoryEntriesResponse } from "@spacebar/util";
|
||||
import { HubDirectoryEntriesResponse } from "@spacebar/schemas";
|
||||
import { Request, Response, Router } from "express";
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,9 +17,10 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Channel, emitEvent, GreetRequestSchema, Message, MessageCreateEvent, MessageType, Permissions, Sticker } from "@spacebar/util";
|
||||
import { Channel, emitEvent, Message, MessageCreateEvent, Permissions, Sticker } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { In } from "typeorm";
|
||||
import { GreetRequestSchema, MessageType } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import { route } from "@spacebar/api";
|
||||
import {
|
||||
Channel,
|
||||
ChannelDeleteEvent,
|
||||
ChannelModifySchema,
|
||||
ChannelType,
|
||||
ChannelUpdateEvent,
|
||||
Recipient,
|
||||
@ -28,6 +27,7 @@ import {
|
||||
handleFile,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ChannelModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
// TODO: delete channel
|
||||
|
||||
@ -17,9 +17,10 @@
|
||||
*/
|
||||
|
||||
import { randomString, route } from "@spacebar/api";
|
||||
import { Channel, Guild, Invite, InviteCreateEvent, InviteCreateSchema, PublicInviteRelation, User, emitEvent, isTextChannel } from "@spacebar/util";
|
||||
import { Channel, Guild, Invite, InviteCreateEvent, PublicInviteRelation, User, emitEvent, isTextChannel } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { InviteCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -21,9 +21,7 @@ import {
|
||||
Channel,
|
||||
Message,
|
||||
MessageCreateEvent,
|
||||
MessageCreateSchema,
|
||||
MessageDeleteEvent,
|
||||
MessageEditSchema,
|
||||
MessageUpdateEvent,
|
||||
Snowflake,
|
||||
SpacebarApiErrors,
|
||||
@ -32,13 +30,12 @@ import {
|
||||
getRights,
|
||||
uploadFile,
|
||||
NewUrlUserSignatureData,
|
||||
MessageCreateAttachment,
|
||||
MessageCreateCloudAttachment,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import multer from "multer";
|
||||
import { handleMessage, postHandleMessage, route } from "../../../../../util";
|
||||
import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageEditSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
// TODO: message content/embed string length limit
|
||||
|
||||
@ -28,7 +28,6 @@ import {
|
||||
MessageReactionRemoveAllEvent,
|
||||
MessageReactionRemoveEmojiEvent,
|
||||
MessageReactionRemoveEvent,
|
||||
PartialEmoji,
|
||||
PublicMemberProjection,
|
||||
PublicUserProjection,
|
||||
User,
|
||||
@ -36,9 +35,10 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { In } from "typeorm";
|
||||
import { PartialEmoji } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
// TODO: check if emoji is really an unicode emoji or a prperly encoded external emoji
|
||||
// TODO: check if emoji is really an unicode emoji or a properly encoded external emoji
|
||||
|
||||
function getEmoji(emoji: string): PartialEmoji {
|
||||
emoji = decodeURIComponent(emoji);
|
||||
|
||||
@ -26,8 +26,6 @@ import {
|
||||
Member,
|
||||
Message,
|
||||
MessageCreateEvent,
|
||||
MessageCreateSchema,
|
||||
Reaction,
|
||||
ReadState,
|
||||
Rights,
|
||||
Snowflake,
|
||||
@ -39,14 +37,13 @@ import {
|
||||
uploadFile,
|
||||
NewUrlSignatureData,
|
||||
NewUrlUserSignatureData,
|
||||
MessageCreateCloudAttachment,
|
||||
MessageCreateAttachment,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import multer from "multer";
|
||||
import { FindManyOptions, FindOperator, LessThan, MoreThan, MoreThanOrEqual } from "typeorm";
|
||||
import { URL } from "url";
|
||||
import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, Reaction } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -16,11 +16,12 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Channel, ChannelPermissionOverwrite, ChannelPermissionOverwriteSchema, ChannelPermissionOverwriteType, ChannelUpdateEvent, emitEvent, Member, Role } from "@spacebar/util";
|
||||
import { Channel, ChannelPermissionOverwrite, ChannelPermissionOverwriteType, ChannelUpdateEvent, emitEvent, Member, Role } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { ChannelPermissionOverwriteSchema } from "@spacebar/schemas"
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
// TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel)
|
||||
|
||||
@ -21,7 +21,6 @@ import {
|
||||
Channel,
|
||||
Message,
|
||||
MessageDeleteBulkEvent,
|
||||
PurgeSchema,
|
||||
emitEvent,
|
||||
getPermission,
|
||||
getRights,
|
||||
@ -30,6 +29,7 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { Between, FindManyOptions, FindOperator, Not } from "typeorm";
|
||||
import { PurgeSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ import {
|
||||
DiscordApiErrors,
|
||||
User,
|
||||
Webhook,
|
||||
WebhookCreateSchema,
|
||||
WebhookType,
|
||||
handleFile,
|
||||
isTextChannel,
|
||||
@ -33,6 +32,7 @@ import {
|
||||
import crypto from "crypto";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { WebhookCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Config, PreloadMessagesRequestSchema, Message, PreloadMessagesResponseSchema } from "@spacebar/util";
|
||||
import { Config, Message } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { PreloadMessagesRequestSchema, PreloadMessagesResponseSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CollectiblesCategoriesResponse } from "@spacebar/util";
|
||||
import { CollectiblesCategoriesResponse } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CollectiblesShopResponse } from "@spacebar/util";
|
||||
import { CollectiblesShopResponse } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionStore,
|
||||
emitEvent,
|
||||
FieldErrors,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,14 +19,12 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Emoji,
|
||||
APIErrorResponse,
|
||||
DiscordApiErrors,
|
||||
EmojiSourceResponse,
|
||||
Guild,
|
||||
Member,
|
||||
EmojiGuild,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { APIErrorResponse, EmojiGuild, EmojiSourceResponse } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,15 +18,14 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
TenorMediaTypes,
|
||||
getGifApiKey,
|
||||
parseGifResult,
|
||||
TenorGif,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
import http from "http";
|
||||
import { TenorGif, TenorMediaTypes } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,15 +18,14 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
TenorMediaTypes,
|
||||
getGifApiKey,
|
||||
parseGifResult,
|
||||
TenorGif,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
import http from "http";
|
||||
import { TenorGif, TenorMediaTypes } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
TenorCategoriesResults,
|
||||
TenorTrendingResults,
|
||||
getGifApiKey,
|
||||
parseGifResult,
|
||||
} from "@spacebar/util";
|
||||
@ -27,6 +25,7 @@ import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
import http from "http";
|
||||
import { TenorCategoriesResults, TenorTrendingResults } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,9 +17,10 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { User, AutomodRuleSchema, AutomodRule } from "@spacebar/util";
|
||||
import { User, AutomodRule } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { AutomodRuleSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,19 +18,17 @@
|
||||
|
||||
import { getIpAdress, route } from "@spacebar/api";
|
||||
import {
|
||||
APIBansArray,
|
||||
Ban,
|
||||
BanRegistrySchema,
|
||||
DiscordApiErrors,
|
||||
GuildBanAddEvent,
|
||||
GuildBanRemoveEvent,
|
||||
GuildBansResponse,
|
||||
Member,
|
||||
User,
|
||||
emitEvent,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { APIBansArray, BanRegistrySchema, GuildBansResponse } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Channel,
|
||||
ChannelModifySchema,
|
||||
ChannelReorderSchema,
|
||||
ChannelUpdateEvent,
|
||||
Guild,
|
||||
emitEvent,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ChannelModifySchema, ChannelReorderSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.get(
|
||||
|
||||
@ -21,8 +21,6 @@ import {
|
||||
Config,
|
||||
DiscordApiErrors,
|
||||
Emoji,
|
||||
EmojiCreateSchema,
|
||||
EmojiModifySchema,
|
||||
GuildEmojisUpdateEvent,
|
||||
Member,
|
||||
Snowflake,
|
||||
@ -31,6 +29,7 @@ import {
|
||||
handleFile,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { EmojiCreateSchema, EmojiModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ import {
|
||||
DiscordApiErrors,
|
||||
Guild,
|
||||
GuildUpdateEvent,
|
||||
GuildUpdateSchema,
|
||||
Member,
|
||||
Permissions,
|
||||
SpacebarApiErrors,
|
||||
@ -33,6 +32,7 @@ import {
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildUpdateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -27,13 +27,13 @@ import {
|
||||
GuildMemberUpdateEvent,
|
||||
handleFile,
|
||||
Member,
|
||||
MemberChangeSchema,
|
||||
PublicMemberProjection,
|
||||
PublicUserProjection,
|
||||
Role,
|
||||
Sticker,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { MemberChangeSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Guild, GuildProfileResponse, GuildVisibilityLevel } from "@spacebar/util";
|
||||
import { Guild } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { GuildProfileResponse, GuildVisibilityLevel } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -22,10 +22,10 @@ import {
|
||||
GuildMemberUpdateEvent,
|
||||
handleFile,
|
||||
Member,
|
||||
MemberChangeProfileSchema,
|
||||
OrmUtils,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { MemberChangeProfileSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -24,10 +24,10 @@ import {
|
||||
handleFile,
|
||||
Member,
|
||||
Role,
|
||||
RoleModifySchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { RoleModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -25,12 +25,11 @@ import {
|
||||
GuildRoleUpdateEvent,
|
||||
Member,
|
||||
Role,
|
||||
RoleModifySchema,
|
||||
RolePositionUpdateSchema,
|
||||
Snowflake,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Not } from "typeorm";
|
||||
import { RoleModifySchema, RolePositionUpdateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import { route } from "@spacebar/api";
|
||||
import {
|
||||
GuildStickersUpdateEvent,
|
||||
Member,
|
||||
ModifyGuildStickerSchema,
|
||||
Snowflake,
|
||||
Sticker,
|
||||
StickerFormatType,
|
||||
@ -33,6 +32,7 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import multer from "multer";
|
||||
import { ModifyGuildStickerSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.get(
|
||||
|
||||
@ -22,10 +22,10 @@ import {
|
||||
ChannelType,
|
||||
Guild,
|
||||
Invite,
|
||||
VanityUrlSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { VanityUrlSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -25,9 +25,9 @@ import {
|
||||
getPermission,
|
||||
VoiceState,
|
||||
VoiceStateUpdateEvent,
|
||||
VoiceStateUpdateSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { VoiceStateUpdateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
//TODO need more testing when community guild and voice stage channel are working
|
||||
|
||||
@ -20,10 +20,10 @@ import { route } from "@spacebar/api";
|
||||
import {
|
||||
Channel,
|
||||
Guild,
|
||||
GuildUpdateWelcomeScreenSchema,
|
||||
Member,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { GuildUpdateWelcomeScreenSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Guild, WidgetModifySchema } from "@spacebar/util";
|
||||
import { Guild } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { WidgetModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,14 +18,12 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
EmailDomainLookupResponse,
|
||||
EmailDomainLookupSchema,
|
||||
EmailDomainLookupVerifyCodeSchema,
|
||||
FieldErrors,
|
||||
} from "@spacebar/util";
|
||||
import emailProviders from "email-providers/all.json";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { EmailDomainLookupResponse, EmailDomainLookupSchema, EmailDomainLookupVerifyCodeSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -21,11 +21,11 @@ import {
|
||||
Config,
|
||||
DiscordApiErrors,
|
||||
Guild,
|
||||
GuildCreateSchema,
|
||||
Member,
|
||||
getRights,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { GuildCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,10 +17,11 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Config, DiscordApiErrors, Guild, GuildTemplateCreateSchema, Member, Template } from "@spacebar/util";
|
||||
import { Config, DiscordApiErrors, Guild, Member, Template } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildTemplateCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ import { route } from "@spacebar/api";
|
||||
import {
|
||||
HubWaitlistSignupResponse,
|
||||
HubWaitlistSignupSchema,
|
||||
} from "@spacebar/util";
|
||||
} from "@spacebar/schemas";
|
||||
import { Request, Response, Router } from "express";
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import { route } from "@spacebar/api";
|
||||
import {
|
||||
ApiError,
|
||||
Application,
|
||||
ApplicationAuthorizeSchema,
|
||||
DiscordApiErrors,
|
||||
FieldErrors,
|
||||
Member,
|
||||
@ -29,6 +28,7 @@ import {
|
||||
getPermission,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ApplicationAuthorizeSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
// TODO: scopes, other oauth types
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { AckBulkSchema, ReadState } from "@spacebar/util";
|
||||
import { ReadState } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { AckBulkSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CollectiblesCategoriesResponse } from "@spacebar/util";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { AccountStandingResponse, AccountStandingState, AppealEligibility, User } from "@spacebar/util";
|
||||
import { User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { AccountStandingResponse, AccountStandingState, AppealEligibility } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { AccountStandingResponse, AccountStandingState, AppealEligibility, User } from "@spacebar/util";
|
||||
import { User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { AccountStandingResponse, AccountStandingState, AppealEligibility } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -20,13 +20,13 @@ import { Request, Response, Router } from "express";
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Team,
|
||||
TeamCreateSchema,
|
||||
TeamMember,
|
||||
TeamMemberRole,
|
||||
TeamMemberState,
|
||||
User,
|
||||
} from "@spacebar/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { TeamCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Config, DmMessagesResponseSchema, Message, User } from "@spacebar/util";
|
||||
import { Config, Message, User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { DmMessagesResponseSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.get(
|
||||
|
||||
@ -28,13 +28,12 @@ import {
|
||||
PublicUser,
|
||||
PublicUserProjection,
|
||||
Relationship,
|
||||
RelationshipType,
|
||||
User,
|
||||
UserProfileModifySchema,
|
||||
UserUpdateEvent,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { In } from "typeorm";
|
||||
import { RelationshipType, UserProfileModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { User, UserRelationsResponse } from "@spacebar/util";
|
||||
import { User } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { UserRelationsResponse } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,13 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Channel,
|
||||
DmChannelCreateSchema,
|
||||
DmChannelDTO,
|
||||
Recipient,
|
||||
} from "@spacebar/util";
|
||||
import { Channel, DmChannelDTO, Recipient } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { DmChannelCreateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CollectiblesMarketingResponse } from "@spacebar/util";
|
||||
import { CollectiblesMarketingResponse } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,13 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
ConnectedAccount,
|
||||
ConnectionUpdateSchema,
|
||||
DiscordApiErrors,
|
||||
emitEvent,
|
||||
} from "@spacebar/util";
|
||||
import { ConnectedAccount, DiscordApiErrors, emitEvent } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ConnectionUpdateSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
// TODO: connection update schema
|
||||
|
||||
@ -21,9 +21,9 @@ import {
|
||||
Channel,
|
||||
Member,
|
||||
OrmUtils,
|
||||
UserGuildSettingsSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { UserGuildSettingsSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -25,11 +25,11 @@ import {
|
||||
handleFile,
|
||||
PrivateUserProjection,
|
||||
User,
|
||||
UserModifySchema,
|
||||
UserUpdateEvent,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { UserModifySchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,12 +19,12 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
BackupCode,
|
||||
CodesVerificationSchema,
|
||||
DiscordApiErrors,
|
||||
User,
|
||||
generateMfaBackupCodes,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { CodesVerificationSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -21,11 +21,11 @@ import {
|
||||
BackupCode,
|
||||
FieldErrors,
|
||||
generateMfaBackupCodes,
|
||||
MfaCodesSchema,
|
||||
User,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { MfaCodesSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
BackupCode,
|
||||
TotpDisableSchema,
|
||||
User,
|
||||
generateToken,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { TotpDisableSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
TotpEnableSchema,
|
||||
User,
|
||||
generateMfaBackupCodes,
|
||||
generateToken,
|
||||
@ -27,6 +26,7 @@ import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { TotpEnableSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -18,21 +18,19 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
CreateWebAuthnCredentialSchema,
|
||||
DiscordApiErrors,
|
||||
FieldErrors,
|
||||
GenerateWebAuthnCredentialsSchema,
|
||||
generateWebAuthnTicket,
|
||||
SecurityKey,
|
||||
User,
|
||||
verifyWebAuthnToken,
|
||||
WebAuthn,
|
||||
WebAuthnPostSchema,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ExpectedAttestationResult } from "fido2-lib";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { CreateWebAuthnCredentialSchema, GenerateWebAuthnCredentialsSchema, WebAuthnPostSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
const isGenerateSchema = (
|
||||
|
||||
@ -24,12 +24,12 @@ import {
|
||||
Relationship,
|
||||
RelationshipAddEvent,
|
||||
RelationshipRemoveEvent,
|
||||
RelationshipType,
|
||||
User,
|
||||
emitEvent,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { RelationshipType } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -21,14 +21,11 @@ import { Request, Response, Router } from "express";
|
||||
import {
|
||||
emitEvent,
|
||||
OrmUtils,
|
||||
SettingsProtoJsonResponse,
|
||||
SettingsProtoResponse,
|
||||
SettingsProtoUpdateJsonSchema,
|
||||
SettingsProtoUpdateSchema,
|
||||
UserSettingsProtos,
|
||||
} from "@spacebar/util";
|
||||
import { PreloadedUserSettings } from "discord-protos";
|
||||
import { JsonValue } from "@protobuf-ts/runtime";
|
||||
import { SettingsProtoJsonResponse, SettingsProtoResponse, SettingsProtoUpdateJsonSchema, SettingsProtoUpdateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -21,14 +21,11 @@ import { Request, Response, Router } from "express";
|
||||
import {
|
||||
emitEvent,
|
||||
OrmUtils,
|
||||
SettingsProtoJsonResponse,
|
||||
SettingsProtoResponse,
|
||||
SettingsProtoUpdateJsonSchema,
|
||||
SettingsProtoUpdateSchema,
|
||||
UserSettingsProtos,
|
||||
} from "@spacebar/util";
|
||||
import { FrecencyUserSettings } from "discord-protos";
|
||||
import { JsonValue } from "@protobuf-ts/runtime";
|
||||
import { SettingsProtoJsonResponse, SettingsProtoResponse, SettingsProtoUpdateJsonSchema, SettingsProtoUpdateSchema } from "@spacebar/schemas"
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { User, UserSettings, UserSettingsSchema } from "@spacebar/util";
|
||||
import { User, UserSettings } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { UserSettingsSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
@ -66,7 +67,7 @@ router.patch(
|
||||
});
|
||||
|
||||
if (!user.settings)
|
||||
user.settings = UserSettings.create(body);
|
||||
user.settings = UserSettings.create(body as Partial<UserSettings>);
|
||||
else
|
||||
user.settings.assign(body);
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { getProxyUrl, route } from "@spacebar/api";
|
||||
import { capitalize, EmbedType, WebhookExecuteSchema } from "@spacebar/util";
|
||||
import { capitalize } from "@spacebar/util";
|
||||
import { NextFunction, Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { executeWebhook } from "../../../../util/handlers/Webhook";
|
||||
import { EmbedType, WebhookExecuteSchema } from "@spacebar/schemas"
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@ import {
|
||||
ValidateName,
|
||||
Webhook,
|
||||
WebhooksUpdateEvent,
|
||||
WebhookUpdateSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import multer from "multer";
|
||||
import { executeWebhook } from "../../../../util/handlers/Webhook";
|
||||
import { WebhookUpdateSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.get(
|
||||
|
||||
@ -6,13 +6,13 @@ import {
|
||||
Webhook,
|
||||
WebhooksUpdateEvent,
|
||||
emitEvent,
|
||||
WebhookUpdateSchema,
|
||||
Channel,
|
||||
handleFile,
|
||||
ValidateName,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { WebhookUpdateSchema } from "@spacebar/schemas"
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
router.get(
|
||||
|
||||
@ -22,7 +22,6 @@ import {
|
||||
Attachment,
|
||||
Channel,
|
||||
Config,
|
||||
Embed,
|
||||
EmbedCache,
|
||||
emitEvent,
|
||||
EVERYONE_MENTION,
|
||||
@ -32,8 +31,6 @@ import {
|
||||
HERE_MENTION,
|
||||
Message,
|
||||
MessageCreateEvent,
|
||||
MessageCreateSchema,
|
||||
MessageType,
|
||||
MessageUpdateEvent,
|
||||
Role,
|
||||
ROLE_MENTION,
|
||||
@ -45,14 +42,12 @@ import {
|
||||
handleFile,
|
||||
Permissions,
|
||||
normalizeUrl,
|
||||
Reaction,
|
||||
MessageCreateCloudAttachment,
|
||||
MessageCreateAttachment,
|
||||
} from "@spacebar/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { In } from "typeorm";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { CloudAttachment } from "../../../util/entities/CloudAttachment";
|
||||
import { Embed, MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageType, Reaction } from "@spacebar/schemas";
|
||||
const allow_empty = false;
|
||||
// TODO: check webhook, application, system author, stickers
|
||||
// TODO: embed gifs/videos/images
|
||||
|
||||
@ -10,11 +10,11 @@ import {
|
||||
uploadFile,
|
||||
ValidateName,
|
||||
Webhook,
|
||||
WebhookExecuteSchema,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { MoreThan } from "typeorm";
|
||||
import { WebhookExecuteSchema } from "@spacebar/schemas"
|
||||
|
||||
export const executeWebhook = async (req: Request, res: Response) => {
|
||||
const { wait } = req.query;
|
||||
|
||||
@ -25,12 +25,12 @@ import {
|
||||
RightResolvable,
|
||||
Rights,
|
||||
SpacebarApiErrors,
|
||||
ajv,
|
||||
getPermission,
|
||||
getRights,
|
||||
} from "@spacebar/util";
|
||||
import { AnyValidateFunction } from "ajv/dist/core";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { ajv } from "@spacebar/schemas"
|
||||
|
||||
const ignoredRequestSchemas = [
|
||||
// skip validation for settings proto JSON updates - TODO: figure out if this even possible to fix?
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Config, Embed, EmbedImage, EmbedType } from "@spacebar/util";
|
||||
import { Config }from "@spacebar/util";
|
||||
import { Embed, EmbedImage, EmbedType } from "@spacebar/schemas";
|
||||
import * as cheerio from "cheerio";
|
||||
import crypto from "crypto";
|
||||
import fetch, { RequestInit } from "node-fetch-commonjs";
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { BattleNetSettings } from "./BattleNetSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface BattleNetConnectionUser {
|
||||
sub: string;
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { DiscordSettings } from "./DiscordSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface UserResponse {
|
||||
id: string;
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { EpicGamesSettings } from "./EpicGamesSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
export interface UserResponse {
|
||||
accountId: string;
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { FacebookSettings } from "./FacebookSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
export interface FacebookErrorResponse {
|
||||
error: {
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { GitHubSettings } from "./GitHubSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface UserResponse {
|
||||
login: string;
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { RedditSettings } from "./RedditSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
export interface UserResponse {
|
||||
verified: boolean;
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
RefreshableConnection,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { SpotifySettings } from "./SpotifySettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
export interface UserResponse {
|
||||
display_name: string;
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
RefreshableConnection,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { TwitchSettings } from "./TwitchSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface TwitchConnectionUserResponse {
|
||||
data: {
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
RefreshableConnection,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { TwitterSettings } from "./TwitterSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface TwitterUserResponse {
|
||||
data: {
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { XboxSettings } from "./XboxSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface XboxUserResponse {
|
||||
IssueInstant: string;
|
||||
|
||||
@ -20,12 +20,12 @@ import {
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
Connection,
|
||||
ConnectionCallbackSchema,
|
||||
ConnectionLoader,
|
||||
DiscordApiErrors,
|
||||
} from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { YoutubeSettings } from "./YoutubeSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas"
|
||||
|
||||
interface YouTubeConnectionChannelListResult {
|
||||
items: {
|
||||
|
||||
@ -17,13 +17,14 @@
|
||||
*/
|
||||
|
||||
import { CLOSECODES, OPCODES, Payload, WebSocket } from "@spacebar/gateway";
|
||||
import { ErlpackType, PayloadSchema } from "@spacebar/util";
|
||||
import { ErlpackType } from "@spacebar/util";
|
||||
import fs from "fs/promises";
|
||||
import BigIntJson from "json-bigint";
|
||||
import path from "path";
|
||||
import WS from "ws";
|
||||
import OPCodeHandlers from "../opcodes";
|
||||
import { check } from "../opcodes/instanceOf";
|
||||
import { PayloadSchema } from "@spacebar/schemas"
|
||||
|
||||
const bigIntJson = BigIntJson({ storeAsString: true });
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ import {
|
||||
Member,
|
||||
EVENTEnum,
|
||||
Relationship,
|
||||
RelationshipType,
|
||||
Message,
|
||||
NewUrlUserSignatureData,
|
||||
} from "@spacebar/util";
|
||||
@ -36,6 +35,7 @@ import { WebSocket } from "@spacebar/gateway";
|
||||
import { Channel as AMQChannel } from "amqplib";
|
||||
import { Recipient } from "@spacebar/util";
|
||||
import * as console from "node:console";
|
||||
import { RelationshipType } from "@spacebar/schemas"
|
||||
|
||||
// TODO: close connection on Invalidated Token
|
||||
// TODO: check intent
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { WebSocket, Payload } from "@spacebar/gateway";
|
||||
import { onLazyRequest } from "./LazyRequest";
|
||||
import { GuildSubscriptionsBulkSchema } from "@spacebar/util";
|
||||
import { GuildSubscriptionsBulkSchema } from "@spacebar/schemas";
|
||||
import { check } from "./instanceOf";
|
||||
|
||||
export async function onGuildSubscriptionsBulk(
|
||||
|
||||
@ -25,7 +25,6 @@ import {
|
||||
EVENTEnum,
|
||||
Guild,
|
||||
GuildOrUnavailable,
|
||||
IdentifySchema,
|
||||
Intents,
|
||||
Member,
|
||||
MemberPrivateProjection,
|
||||
@ -60,6 +59,7 @@ import {
|
||||
import { check } from "./instanceOf";
|
||||
import { In } from "typeorm";
|
||||
import { PreloadedUserSettings } from "discord-protos";
|
||||
import { IdentifySchema } from "@spacebar/schemas"
|
||||
|
||||
// TODO: user sharding
|
||||
// TODO: check privileged intents, if defined in the config
|
||||
|
||||
@ -23,7 +23,6 @@ import {
|
||||
Member,
|
||||
Role,
|
||||
Session,
|
||||
LazyRequestSchema,
|
||||
User,
|
||||
Presence,
|
||||
Channel,
|
||||
@ -38,6 +37,7 @@ import {
|
||||
} from "@spacebar/gateway";
|
||||
import murmur from "murmurhash-js/murmurhash3_gc";
|
||||
import { check } from "./instanceOf";
|
||||
import { LazyRequestSchema } from "@spacebar/schemas"
|
||||
|
||||
// TODO: only show roles/members that have access to this channel
|
||||
// TODO: config: to list all members (even those who are offline) sorted by role, or just those who are online
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user