Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recents and DLd #113

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions _src/base/gotham/psdle.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ repod.psdle = {

// Regret part 1.
document.querySelectorAll(`${config.DOMElements.collectionFilter} .psw-radio`)
.forEach( systemFilter =>
.forEach( systemFilter =>
systemFilter.addEventListener("click", e => config.root.reactisms.stateChange.callback(config))
)

Expand All @@ -232,7 +232,7 @@ repod.psdle = {
let excludeProps = ['__typename','webctas','conceptId']

Object.assign(config, {
propCache: config.gameList.map(i => Object.keys(i)).reduce((i, itemKeys) => itemKeys).concat(customProps)
propCache: config.gameList.map(i => Object.keys(i)).reduce((i, itemKeys) => Object.assign(i,itemKeys)).concat(customProps)
})

if (Object.keys(config.catalogCache).length > 0) {
Expand Down Expand Up @@ -751,16 +751,31 @@ repod.psdle = {
fetchIDs: function(config) {
//Temporarily broken.
return false;

config.catalogDatabase.transact.getNewIDs(
config, ((e) => this.catalog(config, e))
)
},
games: function(config, currentPage) {
//Currently only recents and plus, so hard assume purchasedTitlesRetrieve. Regret later.
return this.fetch(config, currentPage)
.then(r => r.json())
.then(data => data.data.purchasedTitlesRetrieve.games)
games: async function(config, currentPage) {
var recents = await this.fetch(config, "recently-played")
.then(r => r.json())
.then(data => data.data.gameLibraryTitlesRetrieve.games
.reduce((c, i) => (
c[i.titleId] = {
//name: i.name,
lastPlayed: i.lastPlayedDateTime,
}, c), {}
)
)

// Is currentPage needed at this point?
var games = await this.fetch(config, currentPage)
.then(r => r.json())
.then(data => data.data.purchasedTitlesRetrieve.games
.map(i => Object.assign({}, i, recents[i.titleId]))
)

return games
},
catalog: async function(config, newIDs) {
var target = (newIDs || config.gameList.map(e => e.entitlementId))
Expand Down Expand Up @@ -862,12 +877,17 @@ repod.psdle = {
"recently-purchased": {
operationName: "getPurchasedGameList",
variables: {"isActive":true,"platform":["ps4","ps5"],"size":9999,"sortBy":"ACTIVE_DATE","sortDirection":"desc","subscriptionService":"NONE"},
hash: "00694ada3d374422aa34564e91a0589f23c5f52e0e9a703b19d065dedceb3496"
hash: "827a423f6a8ddca4107ac01395af2ec0eafd8396fc7fa204aaf9b7ed2eefa168"
},
"ps-plus": {
operationName: "getPurchasedGameList",
variables: {"platform":["ps4","ps5"],"size":9999,"sortBy":"ACTIVE_DATE","sortDirection":"desc","subscriptionService":"PS_PLUS"},
hash: "00694ada3d374422aa34564e91a0589f23c5f52e0e9a703b19d065dedceb3496"
hash: "827a423f6a8ddca4107ac01395af2ec0eafd8396fc7fa204aaf9b7ed2eefa168"
},
"recently-played": {
operationName: "getUserGameList",
variables: {"limit":100,"categories":"ps4_game,ps5_native_game"},
hash: "e0136f81d7d1fb6be58238c574e9a46e1c0cc2f7f6977a08a5a46f224523a004"
},
catalog: {
query: `query queryRetrieveTelemetryDataPDPProduct($productId: String!) {\n productRetrieve(productId: $productId) {\n ... productFragment\n }\n}\nfragment productFragment on Product {\n id\n name\n publisherName\n topCategory\n releaseDate\n descriptions {\n type\n value\n }\n compatibilityNotices {\n type\n value\n }\n media {\n type\n url\n role\n }\n edition {\n name\n }\n defaultSku {\n id\n name\n type\n }\n skus {\n id\n }\n contentRating {\n name\n }\n localizedStoreDisplayClassification\n localizedGenres {\n value\n }\n price {\n basePrice\n discountedPrice\n serviceBranding\n }\n}`,
Expand Down
46 changes: 33 additions & 13 deletions _src/base/gotham/psdle.gotham.includes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*! psdle 4.1.4 (c) RePod, MIT https://github.com/RePod/psdle/blob/master/LICENSE - base - compiled 2023-04-28 */
/*! psdle 4.1.5 (c) RePod, MIT https://github.com/RePod/psdle/blob/master/LICENSE - base - compiled 2024-01-03 */
var repod = {}
repod.psdle = {
config: {
version: "4.1.4",
versionDate: "2023-04-28"
version: "4.869",
versionDate: "202X-🔥-39"
},
init: function() {
console.log(`PSDLE ${this.config.version} ${this.config.versionDate}`)
Expand Down Expand Up @@ -212,7 +212,7 @@ repod.psdle = {

// Regret part 1.
document.querySelectorAll(`${config.DOMElements.collectionFilter} .psw-radio`)
.forEach( systemFilter =>
.forEach( systemFilter =>
systemFilter.addEventListener("click", e => config.root.reactisms.stateChange.callback(config))
)

Expand All @@ -233,7 +233,7 @@ repod.psdle = {
let excludeProps = ['__typename','webctas','conceptId']

Object.assign(config, {
propCache: config.gameList.map(i => Object.keys(i)).reduce((i, itemKeys) => itemKeys).concat(customProps)
propCache: config.gameList.map(i => Object.keys(i)).reduce((i, itemKeys) => Object.assign(i,itemKeys)).concat(customProps)
})

if (Object.keys(config.catalogCache).length > 0) {
Expand Down Expand Up @@ -752,16 +752,31 @@ repod.psdle = {
fetchIDs: function(config) {
//Temporarily broken.
return false;

config.catalogDatabase.transact.getNewIDs(
config, ((e) => this.catalog(config, e))
)
},
games: function(config, currentPage) {
//Currently only recents and plus, so hard assume purchasedTitlesRetrieve. Regret later.
return this.fetch(config, currentPage)
.then(r => r.json())
.then(data => data.data.purchasedTitlesRetrieve.games)
games: async function(config, currentPage) {
var recents = await this.fetch(config, "recently-played")
.then(r => r.json())
.then(data => data.data.gameLibraryTitlesRetrieve.games
.reduce((c, i) => (
c[i.titleId] = {
name: i.name,
lastPlayed: i.lastPlayedDateTime,
}, c), {}
)
)

// Is currentPage needed at this point?
var games = await this.fetch(config, currentPage)
.then(r => r.json())
.then(data => data.data.purchasedTitlesRetrieve.games
.map(i => Object.assign({}, i, recents[i.titleId]))
)

return games
},
catalog: async function(config, newIDs) {
var target = (newIDs || config.gameList.map(e => e.entitlementId))
Expand Down Expand Up @@ -863,12 +878,17 @@ repod.psdle = {
"recently-purchased": {
operationName: "getPurchasedGameList",
variables: {"isActive":true,"platform":["ps4","ps5"],"size":9999,"sortBy":"ACTIVE_DATE","sortDirection":"desc","subscriptionService":"NONE"},
hash: "00694ada3d374422aa34564e91a0589f23c5f52e0e9a703b19d065dedceb3496"
hash: "827a423f6a8ddca4107ac01395af2ec0eafd8396fc7fa204aaf9b7ed2eefa168"
},
"ps-plus": {
operationName: "getPurchasedGameList",
variables: {"platform":["ps4","ps5"],"size":9999,"sortBy":"ACTIVE_DATE","sortDirection":"desc","subscriptionService":"PS_PLUS"},
hash: "00694ada3d374422aa34564e91a0589f23c5f52e0e9a703b19d065dedceb3496"
hash: "827a423f6a8ddca4107ac01395af2ec0eafd8396fc7fa204aaf9b7ed2eefa168"
},
"recently-played": {
operationName: "getUserGameList",
variables: {"limit":100,"categories":"ps4_game,ps5_native_game"},
hash: "e0136f81d7d1fb6be58238c574e9a46e1c0cc2f7f6977a08a5a46f224523a004"
},
catalog: {
query: `query queryRetrieveTelemetryDataPDPProduct($productId: String!) {\n productRetrieve(productId: $productId) {\n ... productFragment\n }\n}\nfragment productFragment on Product {\n id\n name\n publisherName\n topCategory\n releaseDate\n descriptions {\n type\n value\n }\n compatibilityNotices {\n type\n value\n }\n media {\n type\n url\n role\n }\n edition {\n name\n }\n defaultSku {\n id\n name\n type\n }\n skus {\n id\n }\n contentRating {\n name\n }\n localizedStoreDisplayClassification\n localizedGenres {\n value\n }\n price {\n basePrice\n discountedPrice\n serviceBranding\n }\n}`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "psdle",
"version": "4.1.4",
"version": "4.1.5",
"description": "Improving everyone's favorite online download list, one loop at a time.",
"main": "_src/psdle.base.js",
"scripts": {},
Expand Down