achievements-app/psn-api

Add a function to retrieve user presence

wescopeland opened this issue ยท 4 comments

Ref: https://github.com/FunkeyFlo/ps5-mqtt/blob/main/ps5-mqtt/server/src/psn-account.ts#L113

cc @FunkeyFlo
Sometime this week I'll shoot to have this function added -- I'd like to first prioritize the "what's missing" bucket based on projects that are actively using psn-api and having to use workarounds

I've tested the endpoint, which is honestly the simplest one to add (so I might as well PR this myself in a week or two) and it gives decent information, pulling data from both PS4 and PS5 online statuses. Can't talk about PS3 or Vita, didn't test those yet.

This is the data that is returned when the user is offline:

{
    "basicPresence": {
        "availability": "unavailable",
        "lastAvailableDate": "2023-02-06T05:43:38.019Z",
        "primaryPlatformInfo": {
            "onlineStatus": "offline",
            "platform": "PS5",
            "lastOnlineDate": "2023-02-06T05:43:38.019Z"
        }
    }
}

and this is the data when the user is online:

{
    "basicPresence": {
        "availability": "availableToPlay",
        "primaryPlatformInfo": {
            "onlineStatus": "online",
            "platform": "PS5",
            "lastOnlineDate": "2023-02-28T23:04:41.937Z"
        },
        "gameTitleInfoList": [
            {
                "npTitleId": "CUSA32853_00",
                "titleName": "THEATRHYTHM FINAL BAR LINE",
                "format": "ps4",
                "launchPlatform": "PS5",
                "npTitleIconUrl": "http://gs2-sec.ww.prod.dl.playstation.net/gs2-sec/appkgo/prod/CUSA32853_00/4/i_41661140eb4b3829075887f5dc48fddc015fb01cc8daacb171b37d6eeb5b37af/i/icon0.png"
            }
        ]
    }
}

Both were different users. I like how neither data can be traced back to the original users, as there is no PSN ID or accountId listed in either of them.

What's missing:

  • testing the data returned for accounts that are playing on legacy systems, like PS3 and PSVita
  • testing what is returned if the user doesn't have their online status as public (this is a setting, right?)
  • testing what happens if the target user blocked the account querying for data (shouldn't be an issue if people are using unknown alts to query data, as they should be)

The only thing that I'm worried about from adding this is for library users to combine the "fetch all account friends" endpoint with this and then expose their friends' list status at all times on whatever public project they create.

Let's hope that won't happen though, and that people will abide by the warning of using "this project to elevate the PlayStation Network experience, not damage it" that Wes added to the Readme's disclaimer.

Hi @TheYuriG did you PR this one in yet?

Hi @TheYuriG did you PR this one in yet?

nope and not going to, feel free to work on it

๐ŸŽ‰ This issue has been resolved in version 2.10.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€