diff --git a/packages/discord-types/enums/activity.ts b/packages/discord-types/enums/activity.ts index bc1b2a985..90a7e85ae 100644 --- a/packages/discord-types/enums/activity.ts +++ b/packages/discord-types/enums/activity.ts @@ -9,15 +9,19 @@ export const enum ActivityType { } export const enum ActivityFlags { - INSTANCE = 1, - JOIN = 2, - SYNC = 16, - PLAY = 32, - PARTY_PRIVACY_FRIENDS = 64, - PARTY_PRIVACY_VOICE_CHANNEL = 128, - EMBEDDED = 256, - CONTEXTLESS = 512, - SUPPORTS_GATEWAY_ACTIVITY_ACTION_JOIN = 1024, + INSTANCE = 1 << 0, + JOIN = 1 << 1, + /** @deprecated */ + SPECTATE = 1 << 2, + /** @deprecated */ + JOIN_REQUEST = 1 << 3, + SYNC = 1 << 4, + PLAY = 1 << 5, + PARTY_PRIVACY_FRIENDS = 1 << 6, + PARTY_PRIVACY_VOICE_CHANNEL = 1 << 7, + EMBEDDED = 1 << 8, + CONTEXTLESS = 1 << 9, + SUPPORTS_GATEWAY_ACTIVITY_ACTION_JOIN = 1 << 10, } export const enum ActivityStatusDisplayType { diff --git a/packages/discord-types/enums/application.ts b/packages/discord-types/enums/application.ts index b032a2a8f..99a9e1b64 100644 --- a/packages/discord-types/enums/application.ts +++ b/packages/discord-types/enums/application.ts @@ -19,25 +19,23 @@ export const enum CarouselItemType { } export const enum ApplicationFlags { - EMBEDDED_RELEASED = 2, - EMBEDDED_IAP = 8, - APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE = 64, - GAME_PROFILE_DISABLED = 128, - CONTEXTLESS_ACTIVITY = 512, - SOCIAL_LAYER_INTEGRATION_LIMITED = 1024, - CLOUD_GAMING_DEMO = 2048, - GATEWAY_PRESENCE = 4096, - GATEWAY_PRESENCE_LIMITED = 8192, - GATEWAY_GUILD_MEMBERS = 16384, - GATEWAY_GUILD_MEMBERS_LIMITED = 32768, - EMBEDDED = 131072, - GATEWAY_MESSAGE_CONTENT = 262144, - GATEWAY_MESSAGE_CONTENT_LIMITED = 524288, - EMBEDDED_FIRST_PARTY = 1048576, - APPLICATION_COMMAND_BADGE = 8388608, - SOCIAL_LAYER_INTEGRATION = 134217728, - PROMOTED = 536870912, - PARTNER = 1073741824, - PARENT = 8589934592, - DISABLE_RELATIONSHIPS_ACCESS = 17179869184, + EMBEDDED_RELEASED = 1 << 1, + EMBEDDED_IAP = 1 << 3, + APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE = 1 << 6, + GAME_PROFILE_DISABLED = 1 << 7, + CONTEXTLESS_ACTIVITY = 1 << 9, + SOCIAL_LAYER_INTEGRATION_LIMITED = 1 << 10, + CLOUD_GAMING_DEMO = 1 << 11, + GATEWAY_PRESENCE = 1 << 12, + GATEWAY_PRESENCE_LIMITED = 1 << 13, + GATEWAY_GUILD_MEMBERS = 1 << 14, + GATEWAY_GUILD_MEMBERS_LIMITED = 1 << 15, + EMBEDDED = 1 << 17, + GATEWAY_MESSAGE_CONTENT = 1 << 18, + GATEWAY_MESSAGE_CONTENT_LIMITED = 1 << 19, + EMBEDDED_FIRST_PARTY = 1 << 20, + APPLICATION_COMMAND_BADGE = 1 << 23, + SOCIAL_LAYER_INTEGRATION = 1 << 27, + PROMOTED = 1 << 29, + PARTNER = 1 << 30, } diff --git a/packages/discord-types/enums/user.ts b/packages/discord-types/enums/user.ts index 0ad2ec6d6..cf9852f6e 100644 --- a/packages/discord-types/enums/user.ts +++ b/packages/discord-types/enums/user.ts @@ -28,28 +28,30 @@ export const enum ReadStateType { } export const enum UserFlags { - STAFF = 1, - PARTNER = 2, - HYPESQUAD = 4, - BUG_HUNTER_LEVEL_1 = 8, - MFA_SMS = 16, - PREMIUM_PROMO_DISMISSED = 32, - HYPESQUAD_ONLINE_HOUSE_1 = 64, - HYPESQUAD_ONLINE_HOUSE_2 = 128, - HYPESQUAD_ONLINE_HOUSE_3 = 256, - PREMIUM_EARLY_SUPPORTER = 512, - HAS_UNREAD_URGENT_MESSAGES = 8192, - BUG_HUNTER_LEVEL_2 = 16384, - VERIFIED_BOT = 65536, - VERIFIED_DEVELOPER = 131072, - CERTIFIED_MODERATOR = 262144, - BOT_HTTP_INTERACTIONS = 524288, - SPAMMER = 1048576, - DISABLE_PREMIUM = 2097152, - PROVISIONAL_ACCOUNT = 8388608, - QUARANTINED = 17592186044416, - COLLABORATOR = 1125899906842624, - RESTRICTED_COLLABORATOR = 2251799813685248, + STAFF = 1 << 0, + PARTNER = 1 << 1, + HYPESQUAD = 1 << 2, + BUG_HUNTER_LEVEL_1 = 1 << 3, + MFA_SMS = 1 << 4, + PREMIUM_PROMO_DISMISSED = 1 << 5, + HYPESQUAD_ONLINE_HOUSE_1 = 1 << 6, + HYPESQUAD_ONLINE_HOUSE_2 = 1 << 7, + HYPESQUAD_ONLINE_HOUSE_3 = 1 << 8, + PREMIUM_EARLY_SUPPORTER = 1 << 9, + TEAM_PSEUDO_USER = 1 << 10, + IS_HUBSPOT_CONTACT = 1 << 11, + SYSTEM = 1 << 12, + HAS_UNREAD_URGENT_MESSAGES = 1 << 13, + BUG_HUNTER_LEVEL_2 = 1 << 14, + UNDERAGE_DELETED = 1 << 15, + VERIFIED_BOT = 1 << 16, + VERIFIED_DEVELOPER = 1 << 17, + CERTIFIED_MODERATOR = 1 << 18, + BOT_HTTP_INTERACTIONS = 1 << 19, + SPAMMER = 1 << 20, + DISABLE_PREMIUM = 1 << 21, + ACTIVE_DEVELOPER = 1 << 22, + PROVISIONAL_ACCOUNT = 1 << 23, } export const enum StandingState { diff --git a/packages/discord-types/package.json b/packages/discord-types/package.json index dabf89de8..e14132719 100644 --- a/packages/discord-types/package.json +++ b/packages/discord-types/package.json @@ -3,7 +3,7 @@ "author": "Equicord & Vencord Contributors", "private": false, "description": "Typescript definitions for the webpack modules of the Discord Web app", - "version": "1.0.3", + "version": "1.0.4", "license": "LGPL-3.0-or-later", "types": "src/index.d.ts", "type": "module", diff --git a/packages/discord-types/src/stores/ApplicationStreamPreviewStore.d.ts b/packages/discord-types/src/stores/ApplicationStreamPreviewStore.d.ts new file mode 100644 index 000000000..cddb63f9c --- /dev/null +++ b/packages/discord-types/src/stores/ApplicationStreamPreviewStore.d.ts @@ -0,0 +1,7 @@ +import { FluxStore } from ".."; + +export interface ApplicationStreamPreviewStore extends FluxStore { + getIsPreviewLoading: (guildId: string | bigint | null, channelId: string | bigint, ownerId: string | bigint) => boolean; + getPreviewURL: (guildId: string | bigint | null, channelId: string | bigint, ownerId: string | bigint) => Promise; + getPreviewURLForStreamKey: (streamKey: string) => ReturnType; +} diff --git a/src/plugins/biggerStreamPreview/webpack/types/stores.ts b/packages/discord-types/src/stores/ApplicationStreamingStore.d.ts similarity index 51% rename from src/plugins/biggerStreamPreview/webpack/types/stores.ts rename to packages/discord-types/src/stores/ApplicationStreamingStore.d.ts index e11ede504..a764d1467 100644 --- a/src/plugins/biggerStreamPreview/webpack/types/stores.ts +++ b/packages/discord-types/src/stores/ApplicationStreamingStore.d.ts @@ -1,39 +1,4 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { FluxStore } from "@vencord/discord-types"; - -export interface ApplicationStreamPreviewStore extends FluxStore { - getIsPreviewLoading: (guildId: string | bigint | null, channelId: string | bigint, ownerId: string | bigint) => boolean; - getPreviewURL: (guildId: string | bigint | null, channelId: string | bigint, ownerId: string | bigint) => Promise; - getPreviewURLForStreamKey: (streamKey: string) => ReturnType; -} - -export interface ApplicationStream { - streamType: string; - guildId: string | null; - channelId: string; - ownerId: string; -} - -export interface Stream extends ApplicationStream { - state: string; -} +import { ApplicationStream, FluxStore, Stream } from ".."; export interface RTCStream { region: string, @@ -54,9 +19,6 @@ export interface StreamingStoreState { streamsByUserAndGuild: { [key: string]: { [key: string]: ApplicationStream; }; }; } -/** - * example how a stream key could look like: `call(type of connection):1116549917987192913(channelId):305238513941667851(ownerId)` - */ export interface ApplicationStreamingStore extends FluxStore { getActiveStreamForApplicationStream: (stream: ApplicationStream) => Stream | null; getActiveStreamForStreamKey: (streamKey: string) => Stream | null; diff --git a/packages/discord-types/src/stores/index.d.ts b/packages/discord-types/src/stores/index.d.ts index ba6c0aa5c..77c14eef0 100644 --- a/packages/discord-types/src/stores/index.d.ts +++ b/packages/discord-types/src/stores/index.d.ts @@ -3,6 +3,8 @@ export * from "./AccessibilityStore"; export * from "./ActiveJoinedThreadsStore"; export * from "./ApplicationCommandIndexStore"; export * from "./ApplicationStore"; +export * from "./ApplicationStreamingStore"; +export * from "./ApplicationStreamPreviewStore"; export * from "./AuthenticationStore"; export * from "./CallStore"; export * from "./ChannelRTCStore"; diff --git a/src/plugins/biggerStreamPreview/index.tsx b/src/plugins/biggerStreamPreview/index.tsx index e77e3a02b..2e8beb86a 100644 --- a/src/plugins/biggerStreamPreview/index.tsx +++ b/src/plugins/biggerStreamPreview/index.tsx @@ -21,11 +21,8 @@ import { ScreenshareIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; import { openImageModal } from "@utils/discord"; import definePlugin from "@utils/types"; -import { Channel, User } from "@vencord/discord-types"; -import { Menu } from "@webpack/common"; - -import { ApplicationStreamingStore, ApplicationStreamPreviewStore } from "./webpack/stores"; -import { ApplicationStream, Stream } from "./webpack/types/stores"; +import { ApplicationStream, Channel, Stream, User } from "@vencord/discord-types"; +import { ApplicationStreamingStore, ApplicationStreamPreviewStore, Menu } from "@webpack/common"; export interface UserContextProps { channel: Channel, diff --git a/src/plugins/biggerStreamPreview/webpack/stores.ts b/src/plugins/biggerStreamPreview/webpack/stores.ts deleted file mode 100644 index ba5227baa..000000000 --- a/src/plugins/biggerStreamPreview/webpack/stores.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { findStoreLazy } from "@webpack"; - -import * as t from "./types/stores"; - -export const ApplicationStreamPreviewStore: t.ApplicationStreamPreviewStore = findStoreLazy("ApplicationStreamPreviewStore"); -export const ApplicationStreamingStore: t.ApplicationStreamingStore = findStoreLazy("ApplicationStreamingStore"); diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index 9750f2800..0716a3a2d 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -85,6 +85,8 @@ export let EditMessageStore: t.EditMessageStore; export let QuestStore: t.QuestStore; export let ExperimentStore: t.ExperimentStore; export let UserAffinitiesStore: t.UserAffinitiesStore; +export let ApplicationStreamingStore: t.ApplicationStreamingStore; +export let ApplicationStreamPreviewStore: t.ApplicationStreamPreviewStore; /** * @see jsdoc of {@link t.useStateFromStores} @@ -142,6 +144,8 @@ waitForStore("EditMessageStore", m => EditMessageStore = m); waitForStore("ExperimentStore", m => ExperimentStore = m); waitForStore("QuestStore", m => QuestStore = m); waitForStore("UserAffinitiesV2Store", m => UserAffinitiesStore = m); +waitForStore("ApplicationStreamingStore", m => ApplicationStreamingStore = m); +waitForStore("ApplicationStreamPreviewStore", m => ApplicationStreamPreviewStore = m); waitForStore("ThemeStore", m => { ThemeStore = m; // Importing this directly causes all webpack commons to be imported, which can easily cause circular dependencies.