decord/beta/source/modules/oauth2/Authorize.tsx
github-actions 19e52f659f chore: update source for beta 347.11
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-26 17:57:22 +00:00

94 lines
3.4 KiB
TypeScript

// Module ID: 9361
// Function ID: 9362
// Name: Authorize
// Dependencies: [2041, 4609, 1074, 9362, 8642, 5705, 4432, 1086, 2]
// Exports: filterScopes, parseOAuth2AuthorizeProps
// Module 9361 (Authorize)
import BigFlagUtilsAll from "BigFlagUtils" /* 1086 */;
import PermissionUtilsAll from "PermissionUtils" /* 4432 */;
import keysSorter from "keysSorter" /* 5705 */;
import OAuth2Scopes from "OAuth2Scopes" /* 8642 */;
import scopes from "scopes" /* 9362 */;
import ChannelStore from "ChannelStore" /* 2041 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4609 */;
require = fn;
const Constants = fn(1074);
({ EMPTY_NUX_SERVER: hasOwnProperty, FAVORITES: metroRequire, ME: closure_7 } = Constants);
const size = fn(2);
const result = size.fileFinishedImporting("modules/oauth2/Authorize.tsx");
export const filterScopes = function filterScopes(items) {
const found = items.filter((item) => {
const RemovedScopes = scopes.RemovedScopes;
return !RemovedScopes.includes(item);
});
let hasItem = found.includes(OAuth2Scopes.OAuth2Scopes.BOT);
if (hasItem) {
hasItem = !found.includes(tmp(8642).OAuth2Scopes.APPLICATIONS_COMMANDS);
}
if (hasItem) {
found.push(tmp(8642).OAuth2Scopes.APPLICATIONS_COMMANDS);
}
return found;
};
export const parseOAuth2AuthorizeProps = function parseOAuth2AuthorizeProps(query) {
const parsed = keysSorter.parse(query, { arrayFormat: "bracket" });
const NONE = PermissionUtilsAll.NONE;
try {
const deserializer = BigFlagUtilsAll;
let str2 = "0";
if (null != parsed.permissions) {
str2 = "0";
if ("" !== parsed.permissions) {
str2 = parsed.permissions;
}
}
({ channel_id, guild_id } = parsed);
if (guild_id == null) {
const channel = ChannelStore.getChannel(channel_id);
let guild_id1;
if (channel != null) {
guild_id1 = channel.guild_id;
}
guild_id = guild_id1;
}
if (guild_id == null) {
guild_id = SelectedGuildStore.getGuildId();
}
let str4 = parsed.client_id;
const deserializeResult = deserializer.deserialize(str2);
if (str4 == null) {
str4 = "";
}
const obj3 = { clientId: str4, scopes: null, responseType: null, redirectUri: null, codeChallenge: null, codeChallengeMethod: null, state: null, permissions: null, channelId: null, guildId: null, prompt: null, disableGuildSelect: null, integrationType: null, nonce: null };
let str5 = parsed.scope;
if (str5 == null) {
str5 = "";
}
const tmp11 = (function sanitizeOAuthGuild(guild_id) {
const items = [closure_1_7, closure_1_6, closure_1_5];
if (!items.includes(guild_id)) {
return tmp;
}
})(guild_id);
const parts = str5.replace(/\+/g, " ").split(" ");
obj3.scopes = parts.filter((item) => item.length > 0);
({ response_type: obj2.responseType, redirect_uri: obj2.redirectUri, code_challenge: obj2.codeChallenge, code_challenge_method: obj2.codeChallengeMethod, state: obj2.state } = parsed);
obj3.permissions = deserializeResult;
obj3.channelId = channel_id;
obj3.guildId = tmp11;
obj3.prompt = parsed.prompt;
obj3.disableGuildSelect = "true" === parsed.disable_guild_select;
let NumberResult;
if (null != parsed.integration_type) {
const _Number = Number;
NumberResult = Number(parsed.integration_type);
}
obj3.integrationType = NumberResult;
obj3.nonce = parsed.nonce;
return obj3;
} catch (err) {
}
};