openblox
Version:
Roblox API Wrapper For Both Classic And OpenCloud APIs.
53 lines (52 loc) • 2.15 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var config_exports = {};
__export(config_exports, {
createOpenbloxConfig: () => createOpenbloxConfig,
defaultOpenbloxConfig: () => defaultOpenbloxConfig,
setDefaultOpenbloxConfig: () => setDefaultOpenbloxConfig
});
module.exports = __toCommonJS(config_exports);
var import_cacheAdapters = require("../cache/cacheAdapters");
const formatRobloxCookie = (cookie) => `.ROBLOSECURITY=${cookie}; RBXEventTrackerV2=CreateDate=1/1/1 1:1:1 PM&rbxid=1&browserid=1;`;
const initialCookie = process.env.ROBLOX_COOKIE;
const defaultOpenbloxConfig = {
cookie: initialCookie ? formatRobloxCookie(initialCookie) : void 0,
cloudKey: process.env.ROBLOX_CLOUD_KEY,
cache: [(0, import_cacheAdapters.TtlCacheAdapter)({ included: { lifetime: 300 } })],
http: {}
};
const setDefaultOpenbloxConfig = (newConfig) => {
for (var key in defaultOpenbloxConfig) {
delete defaultOpenbloxConfig[key];
}
Object.assign(defaultOpenbloxConfig, newConfig);
};
const createOpenbloxConfig = (newConfig) => {
if (!newConfig?.http) newConfig.http = {};
const newConfigCookie = newConfig?.cookie;
if (newConfigCookie) newConfig.cookie = formatRobloxCookie(newConfigCookie);
return newConfig;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createOpenbloxConfig,
defaultOpenbloxConfig,
setDefaultOpenbloxConfig
});