another update
This commit is contained in:
@@ -1,81 +1,83 @@
|
||||
"use client";
|
||||
|
||||
import { getCookie } from "./roblox";
|
||||
import { proxyFetch } from "./utils";
|
||||
|
||||
type RecommendationEntry = {
|
||||
contentType: "Game"|string,
|
||||
contentId: number,
|
||||
contentStringId: string,
|
||||
contentType: "Game" | string;
|
||||
contentId: number;
|
||||
contentStringId: string;
|
||||
contentMetadata: {
|
||||
Score: string
|
||||
}
|
||||
}
|
||||
Score: string;
|
||||
};
|
||||
};
|
||||
|
||||
type RecommendationSort = {
|
||||
topic: string,
|
||||
topicId: number,
|
||||
treatmentType: string,
|
||||
recommendationList: RecommendationEntry[],
|
||||
nextPageTokenForTopic: null,
|
||||
numberOfRows: number,
|
||||
topicLayoutData: any
|
||||
}
|
||||
topic: string;
|
||||
topicId: number;
|
||||
treatmentType: string;
|
||||
recommendationList: RecommendationEntry[];
|
||||
nextPageTokenForTopic: null;
|
||||
numberOfRows: number;
|
||||
topicLayoutData: any;
|
||||
};
|
||||
|
||||
export type ContentMetadata = {
|
||||
totalUpVotes: number,
|
||||
totalDownVotes: number,
|
||||
universeId: number,
|
||||
name: string,
|
||||
rootPlaceId: number,
|
||||
description: null,
|
||||
playerCount: number,
|
||||
primaryMediaAsset: any,
|
||||
under9: boolean,
|
||||
under13: boolean,
|
||||
minimumAge: number,
|
||||
ageRecommendationDisplayName: string,
|
||||
friendVisits: any[],
|
||||
friendVisitedString: string,
|
||||
layoutDataBySort: any
|
||||
}
|
||||
totalUpVotes: number;
|
||||
totalDownVotes: number;
|
||||
universeId: number;
|
||||
name: string;
|
||||
rootPlaceId: number;
|
||||
description: null;
|
||||
playerCount: number;
|
||||
primaryMediaAsset: any;
|
||||
under9: boolean;
|
||||
under13: boolean;
|
||||
minimumAge: number;
|
||||
ageRecommendationDisplayName: string;
|
||||
friendVisits: any[];
|
||||
friendVisitedString: string;
|
||||
layoutDataBySort: any;
|
||||
};
|
||||
|
||||
export type OmniRecommendation = {
|
||||
pageType: "Home" | string,
|
||||
requestId: string,
|
||||
sortsRefreshInterval: number,
|
||||
contentMetadata: {
|
||||
Game: {[id: string]: ContentMetadata},
|
||||
CatalogAsset: any,
|
||||
CatalogBundle: any,
|
||||
RecommendedFriend: any,
|
||||
GameCoPlay: any
|
||||
},
|
||||
nextPageToken: string,
|
||||
isSessionExpired: boolean,
|
||||
globalLayoutData: any,
|
||||
isPartialFeed: boolean,
|
||||
DebugInfoGroups: boolean,
|
||||
sorts: RecommendationSort[]
|
||||
}
|
||||
pageType: "Home" | string;
|
||||
requestId: string;
|
||||
sortsRefreshInterval: number;
|
||||
contentMetadata: {
|
||||
Game: { [id: string]: ContentMetadata };
|
||||
CatalogAsset: any;
|
||||
CatalogBundle: any;
|
||||
RecommendedFriend: any;
|
||||
GameCoPlay: any;
|
||||
};
|
||||
nextPageToken: string;
|
||||
isSessionExpired: boolean;
|
||||
globalLayoutData: any;
|
||||
isPartialFeed: boolean;
|
||||
DebugInfoGroups: boolean;
|
||||
sorts: RecommendationSort[];
|
||||
};
|
||||
|
||||
export async function getOmniRecommendationsHome(): Promise<OmniRecommendation> {
|
||||
const data = await proxyFetch(`https://apis.roblox.com/discovery-api/omni-recommendation`,{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
pageType: "Home",
|
||||
sessionId: crypto.randomUUID(),
|
||||
supportedTreatmentTypes: ["SortlessGrid"],
|
||||
authIntentData: null,
|
||||
cpuCores: 4,
|
||||
maxResolution: "1920x1080",
|
||||
maxMemory: 8192
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
const data = await proxyFetch(
|
||||
`https://apis.roblox.com/discovery-api/omni-recommendation`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
pageType: "Home",
|
||||
sessionId: crypto.randomUUID(),
|
||||
supportedTreatmentTypes: ["SortlessGrid"],
|
||||
authIntentData: null,
|
||||
cpuCores: 4,
|
||||
maxResolution: "1920x1080",
|
||||
maxMemory: 8192
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
})
|
||||
return await data.json() as OmniRecommendation
|
||||
);
|
||||
return (await data.json()) as OmniRecommendation;
|
||||
}
|
||||
|
||||
// https://apis.roblox.com/discovery-api/omni-recommendation
|
||||
// https://apis.roblox.com/discovery-api/omni-recommendation
|
||||
|
||||
@@ -1,41 +1,48 @@
|
||||
import { getCookie } from "./roblox"
|
||||
import { proxyFetch } from "./utils"
|
||||
import { proxyFetch } from "./utils";
|
||||
|
||||
export type UserProfileDetails = {
|
||||
description: string,
|
||||
created: Date,
|
||||
isBanned: boolean,
|
||||
externalAppDisplayName: string,
|
||||
hasVerifiedBadge: boolean,
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
}
|
||||
description: string;
|
||||
created: Date;
|
||||
isBanned: boolean;
|
||||
externalAppDisplayName: string;
|
||||
hasVerifiedBadge: boolean;
|
||||
id: number;
|
||||
name: string;
|
||||
displayName: string;
|
||||
};
|
||||
|
||||
export async function getLoggedInUser(): Promise<{
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
id: number;
|
||||
name: string;
|
||||
displayName: string;
|
||||
}> {
|
||||
const data = await proxyFetch(`https://users.roblox.com/v1/users/authenticated`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
const data = await proxyFetch(
|
||||
`https://users.roblox.com/v1/users/authenticated`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
})
|
||||
return (await data.json() as any) as {
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
}
|
||||
);
|
||||
return (await data.json()) as any as {
|
||||
id: number;
|
||||
name: string;
|
||||
displayName: string;
|
||||
};
|
||||
}
|
||||
|
||||
export async function getUserByUserId(userid: string): Promise<UserProfileDetails> {
|
||||
const data = await proxyFetch(`https://users.roblox.com/v1/users/${userid}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
export async function getUserByUserId(
|
||||
userid: string
|
||||
): Promise<UserProfileDetails> {
|
||||
const data = await proxyFetch(
|
||||
`https://users.roblox.com/v1/users/${userid}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
})
|
||||
return (await data.json() as any) as UserProfileDetails
|
||||
}
|
||||
);
|
||||
return (await data.json()) as any as UserProfileDetails;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export function setCookie(cookie: string): void {}
|
||||
|
||||
export async function getCookie(): Promise<string> {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ export async function getThumbnails(
|
||||
targetId: a.targetId,
|
||||
token: "",
|
||||
format: a.format,
|
||||
size: a.size,
|
||||
size: a.size
|
||||
}))
|
||||
),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
const json = await data.json();
|
||||
|
||||
@@ -13,8 +13,8 @@ export async function proxyFetch(
|
||||
typeof input === "string"
|
||||
? input
|
||||
: input instanceof Request
|
||||
? input.url
|
||||
: "";
|
||||
? input.url
|
||||
: "";
|
||||
const proxyUrl = `/api/proxy?url=${encodeURIComponent(url)}`;
|
||||
|
||||
// fix headers
|
||||
@@ -25,7 +25,7 @@ export async function proxyFetch(
|
||||
...init,
|
||||
method: init?.method || "GET",
|
||||
headers,
|
||||
body: init?.body,
|
||||
body: init?.body
|
||||
};
|
||||
|
||||
return window.fetch(proxyUrl, fetchInit);
|
||||
|
||||
Reference in New Issue
Block a user