Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
410 lines
14 KiB
TypeScript
410 lines
14 KiB
TypeScript
// Module ID: 9373
|
|
// Function ID: 9374
|
|
// Name: oauth2/actions
|
|
// Dependencies: [5, 1957, 2011, 1074, 1272, 6694, 1083, 2]
|
|
// Exports: acceptWhitelist, authorize, fetchAuthorization, fetchChannels, finishUserCode, finishUserCodeTwoWayLinkError, logoutWithRedirect, startSamsungAuthorization, verifyUserCode
|
|
|
|
// Module 9373 (oauth2/actions)
|
|
import utils_PathUtils from "utils/PathUtils" /* 1083 */;
|
|
import HTTPUtils from "HTTPUtils" /* 1272 */;
|
|
import AuthenticationActionCreatorsDefault from "AuthenticationActionCreators" /* 6694 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
|
|
|
|
require = fn;
|
|
function getLocationContextServer() {
|
|
const basicChannel = ChannelStore.getBasicChannel(SelectedChannelStore.getChannelId());
|
|
let str;
|
|
if (basicChannel != null) {
|
|
str = basicChannel.guild_id;
|
|
}
|
|
if (str == null) {
|
|
str = "10000";
|
|
}
|
|
const obj = { guild_id: str, channel_id: null, channel_type: null };
|
|
let str2;
|
|
if (basicChannel != null) {
|
|
str2 = basicChannel.id;
|
|
}
|
|
if (str2 == null) {
|
|
str2 = "10000";
|
|
}
|
|
obj.channel_id = str2;
|
|
let type;
|
|
if (basicChannel != null) {
|
|
type = basicChannel.type;
|
|
}
|
|
if (type == null) {
|
|
type = constants.UNKNOWN;
|
|
}
|
|
obj.channel_type = type;
|
|
return obj;
|
|
}
|
|
let closure_9 = async function _authorize(arg0, value) {
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
closure_2 = tmp5;
|
|
closure_1 = tmp2;
|
|
closure_129_0 = undefined;
|
|
closure_129_1 = undefined;
|
|
closure_129_2 = undefined;
|
|
closure_129_3 = undefined;
|
|
closure_129_4 = undefined;
|
|
closure_129_5 = undefined;
|
|
closure_129_6 = undefined;
|
|
closure_129_7 = undefined;
|
|
closure_129_8 = undefined;
|
|
closure_129_9 = undefined;
|
|
closure_129_10 = undefined;
|
|
closure_129_11 = undefined;
|
|
closure_129_12 = undefined;
|
|
closure_129_13 = undefined;
|
|
({ authorize: closure_129_0, clientId: closure_129_1, scopes: closure_129_2, responseType: closure_129_3, redirectUri: closure_129_4, codeChallenge: closure_129_5, codeChallengeMethod: closure_129_6, state: closure_129_7, permissions: closure_129_8, guildId: closure_129_9, channelId: closure_129_10, integrationType: closure_129_11, connectedAccountProvider: closure_129_12, nonce: closure_129_13 } = closure_0);
|
|
c3 = 1;
|
|
c4 = 1;
|
|
return { value: "PX_16", done: true };
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj5 = { value, done: true };
|
|
return obj5;
|
|
} else {
|
|
const HTTP = closure_130_0(closure_130_2[4]).HTTP;
|
|
const request = { url: closure_130_7.OAUTH2_AUTHORIZE, query: null, body: null, oldFormErrors: true, rejectWithError: null };
|
|
const obj6 = { client_id: closure_129_1, response_type: closure_129_3, redirect_uri: closure_129_4, code_challenge: closure_129_5, code_challenge_method: closure_129_6, scope: closure_129_2.join(" "), state: closure_129_7, nonce: closure_129_13 };
|
|
request.query = obj6;
|
|
const obj7 = { guild_id: closure_129_9, webhook_channel_id: null, channel_id: null, permissions: null, authorize: null, integration_type: null, connected_account_provider: null, location_context: null };
|
|
let tmp8;
|
|
if (null != closure_129_9) {
|
|
if (null != closure_129_10) {
|
|
tmp8 = closure_129_10;
|
|
}
|
|
}
|
|
obj7.webhook_channel_id = tmp8;
|
|
let tmp12;
|
|
if (null == closure_129_9) {
|
|
if (null != closure_129_10) {
|
|
tmp12 = closure_129_10;
|
|
}
|
|
}
|
|
obj7.channel_id = tmp12;
|
|
obj7.permissions = closure_129_8;
|
|
obj7.authorize = closure_129_0;
|
|
obj7.integration_type = closure_129_11;
|
|
obj7.connected_account_provider = closure_129_12;
|
|
obj7.location_context = closure_130_8();
|
|
request.body = obj7;
|
|
request.rejectWithError = closure_130_0(closure_130_2[4]).rejectWithMigratedError();
|
|
c3 = 2;
|
|
c4 = 1;
|
|
const obj8 = { value: HTTP.post(request), done: false };
|
|
return obj8;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj9 = { value, done: true };
|
|
return obj9;
|
|
} else {
|
|
c4 = 3;
|
|
const obj = { value: value.body, done: true };
|
|
return obj;
|
|
}
|
|
} catch (tmp25) {
|
|
c4 = tmp;
|
|
throw tmp25;
|
|
}
|
|
}
|
|
};
|
|
let closure_10 = async function _fetchAuthorization(arg0, value) {
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
closure_2 = tmp5;
|
|
closure_1 = tmp2;
|
|
closure_129_0 = undefined;
|
|
closure_129_1 = undefined;
|
|
closure_129_2 = undefined;
|
|
closure_129_3 = undefined;
|
|
closure_129_4 = undefined;
|
|
closure_129_5 = undefined;
|
|
closure_129_6 = undefined;
|
|
closure_129_7 = undefined;
|
|
closure_129_8 = undefined;
|
|
closure_129_9 = undefined;
|
|
closure_129_10 = undefined;
|
|
({ clientId: closure_129_0, scopes: closure_129_1, responseType: closure_129_2, redirectUri: closure_129_3, codeChallenge: closure_129_4, codeChallengeMethod: closure_129_5, state: closure_129_6, integrationType: closure_129_7, connectedAccountProvider: closure_129_8, nonce: closure_129_9, signal: closure_129_10 } = closure_0);
|
|
c3 = 1;
|
|
c4 = 1;
|
|
return { value: "PX_16", done: true };
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
const HTTP = closure_130_0(closure_130_2[4]).HTTP;
|
|
const request = { url: closure_130_7.OAUTH2_AUTHORIZE, query: null, signal: null, retries: 3, oldFormErrors: true, rejectWithError: null };
|
|
const obj5 = { client_id: closure_129_0, response_type: closure_129_2, redirect_uri: closure_129_3, code_challenge: closure_129_4, code_challenge_method: closure_129_5, scope: closure_129_1.join(" "), state: closure_129_6, integration_type: closure_129_7, connected_account_provider: closure_129_8, nonce: closure_129_9 };
|
|
request.query = obj5;
|
|
request.signal = closure_129_10;
|
|
request.rejectWithError = closure_130_0(closure_130_2[4]).rejectWithMigratedError();
|
|
c3 = 2;
|
|
c4 = 1;
|
|
const obj6 = { value: HTTP.get(request), done: false };
|
|
return obj6;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj7 = { value, done: true };
|
|
return obj7;
|
|
} else {
|
|
c4 = 3;
|
|
const obj = { value: value.body, done: true };
|
|
return obj;
|
|
}
|
|
} catch (tmp6) {
|
|
c4 = tmp;
|
|
throw tmp6;
|
|
}
|
|
}
|
|
};
|
|
let closure_11 = async function _startSamsungAuthorization(client_id, arg1, response_type, redirect_uri, state) {
|
|
closure_1 = arg1;
|
|
c6 = 0;
|
|
c5 = 0;
|
|
return (async (arg0, value, arg2, arg3, arg4) => {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp3 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: closure_2_7.OAUTH2_AUTHORIZE_SAMSUNG, query: null, rejectWithError: null };
|
|
const obj4 = { client_id, state, response_type, redirect_uri, prompt: "consent", scope: closure_1.join(" ") };
|
|
request.query = obj4;
|
|
request.rejectWithError = HTTPUtils.rejectWithMigratedError();
|
|
c6 = 1;
|
|
c5 = 1;
|
|
const obj5 = { value: HTTP.get(request), done: false };
|
|
return obj5;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
} else {
|
|
c5 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} catch (tmp5) {
|
|
c5 = tmp;
|
|
throw tmp5;
|
|
}
|
|
}
|
|
})();
|
|
};
|
|
let closure_12 = async function _fetchChannels(guild_id) {
|
|
c2 = 0;
|
|
c1 = 0;
|
|
return (async (arg0, value) => {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: closure_2_7.OAUTH2_AUTHORIZE_WEBHOOK_CHANNELS, query: { guild_id }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
await HTTP.get(request);
|
|
return value.body;
|
|
})();
|
|
};
|
|
let closure_13 = async function _verifyUserCode(user_code) {
|
|
c2 = 0;
|
|
c1 = 0;
|
|
return (async (arg0, value) => {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: OAUTH2_DEVICE_VERIFY.OAUTH2_DEVICE_VERIFY, body: { user_code }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
await HTTP.post(request);
|
|
return value;
|
|
})();
|
|
};
|
|
let closure_14 = async function _finishUserCode(user_code, result) {
|
|
c3 = 0;
|
|
c2 = 0;
|
|
return (async (arg0, value) => {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: OAUTH2_DEVICE_FINISH.OAUTH2_DEVICE_FINISH, body: { user_code, result }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
await HTTP.post(request);
|
|
return value;
|
|
})();
|
|
};
|
|
let closure_15 = async function _finishUserCodeTwoWayLinkError(user_code, error_code, error_source) {
|
|
c4 = 0;
|
|
c3 = 0;
|
|
return (async (arg0, value, arg2) => {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: OAUTH2_DEVICE_FINISH.OAUTH2_DEVICE_FINISH, body: { user_code, result: "two_way_link_error", error_code, error_source }, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
await HTTP.post(request);
|
|
return value;
|
|
})();
|
|
};
|
|
const Constants = fn(1074);
|
|
({ ChannelTypes: metroRequire, Endpoints: closure_7 } = Constants);
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/oauth2/actions.tsx");
|
|
|
|
export { getLocationContextServer };
|
|
export const acceptWhitelist = function acceptWhitelist(token) {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: React5.OAUTH2_WHITELIST_ACCEPT, query: { token }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
return HTTP.post(request);
|
|
};
|
|
export const authorize = function authorize() {
|
|
const self = this;
|
|
const apply = closure_9.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const fetchAuthorization = function fetchAuthorization() {
|
|
const self = this;
|
|
const apply = closure_10.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const startSamsungAuthorization = function startSamsungAuthorization() {
|
|
const self = this;
|
|
const apply = closure_11.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const fetchChannels = function fetchChannels() {
|
|
const self = this;
|
|
const apply = closure_12.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const logoutWithRedirect = function logoutWithRedirect(pathname, TTI_test) {
|
|
const obj = AuthenticationActionCreatorsDefault;
|
|
obj.logout(TTI_test, utils_PathUtils.getLoginPath(pathname.pathname + pathname.search, false));
|
|
};
|
|
export const verifyUserCode = function verifyUserCode() {
|
|
const self = this;
|
|
const apply = closure_13.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const finishUserCode = function finishUserCode() {
|
|
const self = this;
|
|
const apply = closure_14.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const finishUserCodeTwoWayLinkError = function finishUserCodeTwoWayLinkError() {
|
|
const self = this;
|
|
const apply = closure_15.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|