Skip to content

Commit

Permalink
fixed bug with setting cookie manually in the config not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Campbell authored and Cameron Campbell committed Aug 2, 2024
1 parent b7fb792 commit b7460df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openblox",
"type": "commonjs",
"version": "1.0.26",
"version": "1.0.27",
"license": "MIT",
"bugs": {
"url": "https://github.com/MightyPart/openblox/issues"
Expand Down
4 changes: 2 additions & 2 deletions src/apis/classic/gamePasses/gamePasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const addApiMethod = createApiGroup({ groupName: "ClassicGamePasses", baseUrl: "
* @param gamePassId The ID of the game pass to get information about.
*
* @example const { data:gamePassInfo } = await ClassicGamePassesApi.gamePassInfo({ gamePassId: 9260480 })
* @exampleData
* @exampleRawBody
* @exampleData "targetId":9260480,"productType":"Game Pass","assetId":0,"productId":979386303,"name":"Donate","description":"null","assetTypeId":0,"creator":{"id":1536374574,"name":"MightyPart Games","creatorType":"Group","creatorTargetId":5850082},"iconImageAssetId":5316458121,"created":"2020-05-01T15:05:21.543Z","updated":"2020-07-09T13:08:21.133Z","priceInRobux":15,"priceInTickets":null,"sales":6,"isNew":false,"isForSale":true,"isPublicDomain":false,"isLimited":false,"isLimitedUnique":false,"remaining":null,"minimumMembershipLevel":0}
* @exampleRawBody {"TargetId":9260480,"ProductType":"Game Pass","AssetId":0,"ProductId":979386303,"Name":"Donate","Description":"null","AssetTypeId":0,"Creator":{"Id":1536374574,"Name":"MightyPart Games","CreatorType":"Group","CreatorTargetId":5850082},"IconImageAssetId":5316458121,"Created":"2020-05-01T15:05:21.543Z","Updated":"2020-07-09T13:08:21.133Z","PriceInRobux":15,"PriceInTickets":null,"Sales":6,"IsNew":false,"IsForSale":true,"IsPublicDomain":false,"IsLimited":false,"IsLimitedUnique":false,"Remaining":null,"MinimumMembershipLevel":0}
*/
export const gamePassInfo = addApiMethod(async <GamePassId extends Identifier>(
{ gamePassId }: { gamePassId: GamePassId }
Expand Down
9 changes: 8 additions & 1 deletion src/apis/classic/gamePasses/gamePasses.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Identifier, ISODateTime } from "typeforge"
import { KeysToCamelCase } from "../../../utils/utils.types"


// GET /v1/virtual-events/create -------------------------------------------------------------------------------------
// GET /v1/game-passes/{gamePassId}/product-info ---------------------------------------------------------------------
type GamePassInfo<TemporalType extends ISODateTime | Date, GamePassId extends Identifier> = {
TargetId: GamePassId,
ProductType: "Game Pass",
Expand Down Expand Up @@ -36,3 +36,10 @@ export type RawGamePassInfo<GamePassId extends Identifier> = GamePassInfo<ISODat

export type PrettifiedGamePassInfo<GamePassId extends Identifier> = KeysToCamelCase<GamePassInfo<Date, GamePassId>>
// -------------------------------------------------------------------------------------------------------------------


// GET /v1/game-passes/universes/${universeId}/creator ---------------------------------------------------------------
export type PrettifiedGamePassesForUniverse = {

}
// -------------------------------------------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ function mergeDeepConfigs(target: Record<any, any>, ...sources: Record<any, any>
export const getConfig = () => config

export const setConfig = (newConfig: OpenbloxConfig) => {
const newConfigCookie = newConfig?.cookie
if (newConfigCookie) newConfig.cookie = `.ROBLOSECURITY=${newConfigCookie}` as any

Object.keys(config).forEach(key => delete config[key as keyof OpenbloxConfig])
Object.assign(config, newConfig)
}

export const updateConfig = (updateConfigWith: OpenbloxConfig) => {
const updateConfigWithCookie = updateConfigWith?.cookie
if (updateConfigWithCookie) updateConfigWith.cookie = `.ROBLOSECURITY=${updateConfigWithCookie}` as any

mergeDeepConfigs(config, updateConfigWith)
}
1 change: 0 additions & 1 deletion src/http/httpHandler/httpHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export const HttpHandler = async <RawData extends any = any>(
body
);*/


const requestDataHeaders = removeNullUndefined({
Cookie: cookie as string,
"x-api-key": cloudKey,
Expand Down

0 comments on commit b7460df

Please sign in to comment.