mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-02 15:41:48 +00:00
Shorten imports
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -34,7 +34,7 @@ import {
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import multer from "multer";
|
||||
import { handleMessage, postHandleMessage, route } from "../../../../../util";
|
||||
import { handleMessage, postHandleMessage, route } from "@spacebar/api";
|
||||
import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageEditSchema, ChannelType } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { ConnectionStore, FieldErrors } from "../../../../util";
|
||||
import { ConnectionStore, FieldErrors } from "@spacebar/util";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Request, Response, Router } from "express";
|
||||
import fs from "fs";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import path from "path";
|
||||
import { storage } from "../../../../cdn/util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -21,8 +21,8 @@ import { Request, Response, Router } from "express";
|
||||
import imageSize from "image-size";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { multer } from "../util/multer";
|
||||
import { storage } from "../util/Storage";
|
||||
import { CloudAttachment } from "../../util/entities/CloudAttachment";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { CloudAttachment } from "@spacebar/util";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { cache } from "../util/cache";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { cache } from "../util/cache";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { cache } from "../util/cache";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -21,7 +21,7 @@ import crypto from "crypto";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { multer } from "../util/multer";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { cache } from "../util/cache";
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Config, Snowflake } from "@spacebar/util";
|
||||
import { storage } from "../util/Storage";
|
||||
import { storage } from "@spacebar/cdn";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { BattleNetSettings } from "./BattleNetSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface BattleNetConnectionUser {
|
||||
sub: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { DiscordSettings } from "./DiscordSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface UserResponse {
|
||||
id: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { EpicGamesSettings } from "./EpicGamesSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
export interface UserResponse {
|
||||
accountId: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { FacebookSettings } from "./FacebookSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
export interface FacebookErrorResponse {
|
||||
error: {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { GitHubSettings } from "./GitHubSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface UserResponse {
|
||||
login: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { RedditSettings } from "./RedditSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
export interface UserResponse {
|
||||
verified: boolean;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { SpotifySettings } from "./SpotifySettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
export interface UserResponse {
|
||||
display_name: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { TwitchSettings } from "./TwitchSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface TwitchConnectionUserResponse {
|
||||
data: {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import { ConnectedAccount, ConnectionLoader, DiscordApiErrors, RefreshableConnection } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { TwitterSettings } from "./TwitterSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface TwitterUserResponse {
|
||||
data: {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { XboxSettings } from "./XboxSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface XboxUserResponse {
|
||||
IssueInstant: string;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util";
|
||||
import wretch from "wretch";
|
||||
import { YoutubeSettings } from "./YoutubeSettings";
|
||||
import { ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas";
|
||||
|
||||
interface YouTubeConnectionChannelListResult {
|
||||
items: {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { checkToken, closeDatabase, Config, initDatabase, initEvent, Rights } fr
|
||||
import ws from "ws";
|
||||
import { Connection, openConnections } from "./events/Connection";
|
||||
import http from "http";
|
||||
import { cleanupOnStartup } from "./util/Utils";
|
||||
import { cleanupOnStartup } from "./util";
|
||||
import { randomString } from "@spacebar/api";
|
||||
import { setInterval } from "timers";
|
||||
|
||||
|
||||
@@ -31,11 +31,9 @@ import {
|
||||
Recipient,
|
||||
Relationship,
|
||||
} from "@spacebar/util";
|
||||
import { CLOSECODES, OPCODES } from "../util/Constants";
|
||||
import { Send } from "../util/Send";
|
||||
import { CLOSECODES, OPCODES, Send } from "../util";
|
||||
import { WebSocket } from "@spacebar/gateway";
|
||||
import { Channel as AMQChannel } from "amqplib";
|
||||
import * as console from "node:console";
|
||||
import { PublicMember, RelationshipType } from "@spacebar/schemas";
|
||||
import { bgRedBright } from "picocolors";
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { Payload, WebSocket } from "@spacebar/gateway";
|
||||
import { Config, emitEvent, Guild, Member, VoiceServerUpdateEvent, VoiceState, VoiceStateUpdateEvent } from "@spacebar/util";
|
||||
import { genVoiceToken } from "../util/SessionUtils";
|
||||
import { genVoiceToken } from "@spacebar/gateway";
|
||||
import { check } from "./instanceOf";
|
||||
import { Region, VoiceStateUpdateSchema } from "@spacebar/schemas";
|
||||
// TODO: check if a voice server is setup
|
||||
|
||||
@@ -15,32 +15,3 @@
|
||||
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/>.
|
||||
*/
|
||||
|
||||
export interface LazyRequestSchema {
|
||||
guild_id: string;
|
||||
channels?: {
|
||||
/**
|
||||
* @items.type integer
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
[key: string]: number[][]; // puyo: changed from [number, number] because it breaks openapi
|
||||
};
|
||||
activities?: boolean;
|
||||
threads?: boolean;
|
||||
typing?: true;
|
||||
members?: string[];
|
||||
member_updates?: boolean;
|
||||
thread_member_lists?: unknown[];
|
||||
}
|
||||
|
||||
export const LazyRequestSchema = {
|
||||
guild_id: String,
|
||||
$activities: Boolean,
|
||||
$channels: Object,
|
||||
$typing: Boolean,
|
||||
$threads: Boolean,
|
||||
$members: [] as string[],
|
||||
$member_updates: Boolean,
|
||||
$thread_member_lists: [] as unknown[],
|
||||
};
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Attachment } from "../../util/entities";
|
||||
// TODO: remove dependency on entities...
|
||||
import { Attachment } from "@spacebar/util";
|
||||
|
||||
export enum AccountStandingState {
|
||||
ALL_GOOD = 100,
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Guild } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { Guild } from "@spacebar/util";
|
||||
|
||||
export interface DiscoverableGuildsResponse {
|
||||
total: number;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Guild } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { Guild } from "@spacebar/util";
|
||||
|
||||
export interface EmailDomainLookupVerifyCodeResponse {
|
||||
guild: Guild;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Attachment, Role } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { Attachment, Role } from "@spacebar/util";
|
||||
import { ActionRowComponent, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas";
|
||||
|
||||
export interface GuildMessagesSearchMessage {
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Guild } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { Guild } from "@spacebar/util";
|
||||
|
||||
export interface GuildRecommendationsResponse {
|
||||
recommended_guilds: Guild[];
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Guild } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { Guild } from "@spacebar/util";
|
||||
|
||||
export interface HubDirectoryEntry {
|
||||
author_id: string;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Emoji, Role, Sticker } from "../../util/entities";
|
||||
import { Emoji, Role, Sticker } from "@spacebar/util";
|
||||
import { GuildCreateResponse } from "@spacebar/schemas";
|
||||
|
||||
export interface MemberJoinGuildResponse {
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BackupCode, UserSettings } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { BackupCode, UserSettings } from "@spacebar/util";
|
||||
|
||||
export interface TokenResponse {
|
||||
token: string;
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
|
||||
import { GeneralConfiguration, LimitsConfiguration } from "../../util/config/types";
|
||||
import { DmChannelDTO } from "../../util/dtos";
|
||||
import { Application, BackupCode, Categories, Channel, Emoji, Guild, Invite, Member, Message, Role, Sticker, StickerPack, Template, Webhook } from "../../util/entities";
|
||||
import { Application, BackupCode, Categories, Channel, Emoji, Guild, Invite, Member, Message, Role, Sticker, StickerPack, Template, Webhook } from "@spacebar/util";
|
||||
import { GuildVoiceRegion } from "./GuildVoiceRegionsResponse";
|
||||
import { GuildBansResponse, GuildCreateResponse, PrivateUser, PublicMember, PublicUser } from "@spacebar/schemas";
|
||||
|
||||
// TODO: remove this entire file!
|
||||
// removes internal properties from the guild class
|
||||
export type APIGuild = Omit<Guild, "afk_channel" | "template" | "owner" | "public_updates_channel" | "rules_channel" | "system_channel" | "widget_channel">;
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { User, Webhook } from "../../util/entities";
|
||||
// TODO: remove dependency on entities
|
||||
import { User, Webhook } from "@spacebar/util";
|
||||
|
||||
export interface WebhookCreateResponse {
|
||||
user: User;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ConnectedAccountTokenData } from "../../util/interfaces";
|
||||
|
||||
export interface ConnectedAccountSchema {
|
||||
external_id: string;
|
||||
user_id: string;
|
||||
@@ -34,3 +32,21 @@ export interface ConnectedAccountSchema {
|
||||
metadata_visibility?: number;
|
||||
two_way_link?: boolean;
|
||||
}
|
||||
|
||||
export interface ConnectedAccountCommonOAuthTokenResponse {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
scope: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
}
|
||||
|
||||
export interface ConnectedAccountTokenData {
|
||||
access_token: string;
|
||||
token_type?: string;
|
||||
scope?: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
expires_at?: number;
|
||||
fetched_at: number;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { LazyRequestSchema } from "../gateway/LazyRequestSchema";
|
||||
|
||||
export interface GuildSubscriptionsBulkSchema {
|
||||
subscriptions: { [key: string]: GuildSubscriptionSchema };
|
||||
}
|
||||
@@ -9,3 +7,32 @@ export type GuildSubscriptionSchema = Omit<LazyRequestSchema, "guild_id">;
|
||||
export const GuildSubscriptionsBulkSchema = {
|
||||
$subscriptions: Object,
|
||||
};
|
||||
|
||||
export interface LazyRequestSchema {
|
||||
guild_id: string;
|
||||
channels?: {
|
||||
/**
|
||||
* @items.type integer
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
[key: string]: number[][]; // puyo: changed from [number, number] because it breaks openapi
|
||||
};
|
||||
activities?: boolean;
|
||||
threads?: boolean;
|
||||
typing?: true;
|
||||
members?: string[];
|
||||
member_updates?: boolean;
|
||||
thread_member_lists?: unknown[];
|
||||
}
|
||||
|
||||
export const LazyRequestSchema = {
|
||||
guild_id: String,
|
||||
$activities: Boolean,
|
||||
$channels: Object,
|
||||
$typing: Boolean,
|
||||
$threads: Boolean,
|
||||
$members: [] as string[],
|
||||
$member_updates: Boolean,
|
||||
$thread_member_lists: [] as unknown[],
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { ConnectionConfigEntity } from "../entities/ConnectionConfigEntity";
|
||||
import { ConnectionConfigEntity } from "../entities";
|
||||
import { OrmUtils } from "../imports";
|
||||
|
||||
let config: any;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import { ConnectedAccount } from "../entities";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces";
|
||||
import { Connection } from "./Connection";
|
||||
import { ConnectedAccountCommonOAuthTokenResponse } from "@spacebar/schemas";
|
||||
|
||||
/**
|
||||
* A connection that can refresh its token.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { BeforeRemove, Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { URL } from "url";
|
||||
import { deleteFile } from "../util/cdn";
|
||||
import { deleteFile } from "../util";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { getUrlSignature, NewUrlUserSignatureData, NewUrlSignatureData } from "../Signing";
|
||||
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
*/
|
||||
|
||||
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, ColumnOptions, FindOptionsWhere, ObjectIdColumn, PrimaryColumn } from "typeorm";
|
||||
import { Snowflake } from "../util/Snowflake";
|
||||
import { getDatabase } from "../util/Database";
|
||||
import { OrmUtils } from "../imports/OrmUtils";
|
||||
import { annotationsKey, JsonNumber } from "../util/Decorators";
|
||||
import { Snowflake, getDatabase } from "../util";
|
||||
import { OrmUtils } from "../imports";
|
||||
import { annotationsKey } from "../util/Decorators";
|
||||
|
||||
export class BaseClassWithoutId extends BaseEntity {
|
||||
private get construct() {
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { ConnectedAccountTokenData } from "../interfaces";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { ConnectedAccountTokenData } from "@spacebar/schemas";
|
||||
|
||||
@Entity({
|
||||
name: "connected_accounts",
|
||||
|
||||
@@ -21,8 +21,7 @@ import { BeforeInsert, BeforeUpdate, Column, Entity, Index, JoinColumn, JoinTabl
|
||||
import { Ban, Channel, PublicGuildRelations } from ".";
|
||||
import { ReadyGuildDTO } from "../dtos";
|
||||
import { GuildCreateEvent, GuildDeleteEvent, GuildMemberAddEvent, GuildMemberRemoveEvent, GuildMemberUpdateEvent, MessageCreateEvent } from "../interfaces";
|
||||
import { Config, emitEvent } from "../util";
|
||||
import { DiscordApiErrors } from "../util/Constants";
|
||||
import { Config, emitEvent, DiscordApiErrors } from "../util";
|
||||
import { BaseClassWithoutId } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { Message } from "./Message";
|
||||
|
||||
@@ -20,7 +20,7 @@ import { User } from "./User";
|
||||
import { Member } from "./Member";
|
||||
import { Role } from "./Role";
|
||||
import { Channel } from "./Channel";
|
||||
import { InteractionType } from "../interfaces/Interaction";
|
||||
import { InteractionType } from "../interfaces";
|
||||
import { Application } from "./Application";
|
||||
import { Column, CreateDateColumn, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, RelationId, FindOneOptions, Raw, Not, BaseEntity, In } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
|
||||
@@ -15,21 +15,3 @@
|
||||
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/>.
|
||||
*/
|
||||
|
||||
export interface ConnectedAccountCommonOAuthTokenResponse {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
scope: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
}
|
||||
|
||||
export interface ConnectedAccountTokenData {
|
||||
access_token: string;
|
||||
token_type?: string;
|
||||
scope?: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
expires_at?: number;
|
||||
fetched_at: number;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { existsSync } from "fs";
|
||||
import fs from "fs/promises";
|
||||
import { OrmUtils } from "..";
|
||||
import { ConfigValue } from "../config";
|
||||
import { ConfigEntity } from "../entities/Config";
|
||||
import { ConfigEntity } from "../entities";
|
||||
import { JsonValue } from "@protobuf-ts/runtime";
|
||||
|
||||
// TODO: yaml instead of json
|
||||
|
||||
@@ -21,7 +21,7 @@ import { closeDatabase, Config, initDatabase, initEvent } from "@spacebar/util";
|
||||
import http from "http";
|
||||
import ws from "ws";
|
||||
import { Connection } from "./events/Connection";
|
||||
import { loadWebRtcLibrary, mediaServer, WRTC_PORT_MAX, WRTC_PORT_MIN, WRTC_PUBLIC_IP } from "./util/MediaServer";
|
||||
import { loadWebRtcLibrary, mediaServer, WRTC_PORT_MAX, WRTC_PORT_MIN, WRTC_PUBLIC_IP } from "./util";
|
||||
import { green, yellow } from "picocolors";
|
||||
|
||||
export class Server {
|
||||
|
||||
Reference in New Issue
Block a user