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

Link to specific Are We Anti-Cheat yet page #346

Open
ChildishGiant opened this issue Jan 24, 2024 · 5 comments
Open

Link to specific Are We Anti-Cheat yet page #346

ChildishGiant opened this issue Jan 24, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@ChildishGiant
Copy link

Is your feature request related to a problem? Please describe.
On show game list double clicking the anticheat icon will open https://areweanticheatyet.com/?search=&sortOrder=&sortBy=

Describe the solution you'd like
It could/should open the site's specific page, either by direct URL (https://areweanticheatyet.com/game/team-fortress-2), though I'm not sure on the exact way they're escaping titles to make them, or just by using the search query string (https://areweanticheatyet.com/?search=Team+Fortress+2)

@ChildishGiant ChildishGiant added the enhancement New feature or request label Jan 24, 2024
@DavidoTek
Copy link
Owner

either by direct URL (https://areweanticheatyet.com/game/team-fortress-2), though I'm not sure on the exact way they're escaping titles to make them

This one isn't that easy as we would need to determine how AWACY creates the urls from the game title. We could look it up in the source code, but it is subject to change.

or just by using the search query string (https://areweanticheatyet.com/?search=Team+Fortress+2)

ProtonUp-Qt is actually doing this, but only if the AWACY status is known. If it is unknown, it will just open the page without searching:

search_str = ("" if game.awacy_status == AWACYStatus.UNKNOWN else game.game_name)
lblicon_item.setData(Qt.UserRole, AWACY_WEB_URL.format(GAMENAME=search_str))

Is there any game which has an entry on AWACY, but ProtonUp-Qt shows a question mark and won't open the page with a search term? Please let me know.
In that case, there might be a problem that ProtonUp-Qt doesn't correctly map the games on AWACY to the installed games.

Otherwise, we can close this issue.

I guess there are also the options of (a) not opening the URL at all if the status is unknown and (b) opening the URL with search parameters anyway, even if the status is unknown. But I think option a would make it inconsistent and option b gives an empty page which looks like an issue occured. This way the users can manually search for the game if they are unsure.

@sonic2kk
Copy link
Contributor

sonic2kk commented Jan 26, 2024

The URL for the page is built based on the slug attribute on the JSON object for each game n awacy_games.json. The format is https://areweanticheatyet.com/game/slug-here Here is an example with Halo MCC, with some data stripped out :-)

  {
    "url": "",
    "name": "Halo: The Master Chief Collection",
    "logo": "",
    "native": false,
    "status": "Supported",
    "reference": "",
    "anticheats": [
      "Easy Anti-Cheat"
    ],
    "notes": [
        [],
        []
    ],
    "storeIds": {

    },
    "slug": "halo-the-master-chief-collection",
    "dateChanged": "2024-01-19T04:40:56.000Z"

For MCC, its page is https://areweanticheatyet.com/game/halo-the-master-chief-collection.

This JSON is downloaded by ProtonUp-Qt already, and for anyone unaware, is publicly available at (and retrieved by ProtonUp-Qt from) AreWeAntiCheatYet's GitHub repository, in the file games.json.


(b) opening the URL with search parameters anyway, even if the status is unknown

I think this is the ideal solution. I agree that an empty page may look strange, but that's not really ProtonUp-Qt's issue. Imo upstream can always change the page layout. If a user were to manually visit this page they would have the same experience, so the ball isn't really in our court here so-to-speak, and it may also not be as big of a problem as we're anticipating if the AWACY folks haven't had any issues yet :-)

@sonic2kk
Copy link
Contributor

sonic2kk commented Jan 26, 2024

The question now becomes, if we are going forward with this, how best to store this. One solution I thought of is, we could modify SteamApp.awacy_status to be awacy_info and contain slug and status. This would require a refactor but may be a clean way to go about it - although one could argue having a dictionary with arbitrary values that we just expect to be present is not clean. I just didn't think having a new SteamApp.awacy_slug was very elegant 😅

Although, if we're going with this dictionary approach, we're essentially mapping elements from the AreWeAntiCheatYet games.json to our own per-game dictionary. Perhaps that's reliable enough, if we use the same key names. We're basically storing a version of the JSON object per-game, only popping off the information we need and storing it in our SteamApp. We could refactor update_steamapp_awacystatus to do essentially this.

@DavidoTek
Copy link
Owner

DavidoTek commented Jan 26, 2024

The URL for the page is built based on the slug attribute

Ah, I wasn't aware of that. Should be possible to store the slug inside SteamApp (awacy_slug) when setting the awacy status (steamutil.py#update_steamapp_awacystatus)

I think [(b)] is the ideal solution ....

Hmm, yeah. I guess you're right about that users manually entering the details have the same issue.

modify SteamApp.awacy_status to be awacy_info and contain slug and status

In theory we could add another (data)class for storing awacy info. That could also be adopted by LutrisGame and HeroicGame.

although one could argue having a dictionary with arbitrary values that we just expect to be present is not clean

Yeah, I agree that dicts are not clean (at all). I would go for a dataclass then.
One should use the (typing) freedom Python gives carefully 😄


Maybe like that:

# datastructues.py
@dataclass
class AWACYInfo:
    """ Data class to store game-specific information from areweanticheatyet.com's games.json """
    status: AWACYStatus
    slug: str

class SteamApp:
    ...
    awacy_info: AWACYInfo

# steamutil.py
def update_steamapp_awacystatus(steamapp_list: List[SteamApp]) -> List[SteamApp]:
    ...
            gm = {g.get('name') : g for g in json.load(f)}
                status = ...
                slug = g[game_name].get('slug', '')
                app.awacy_info = AwacyInfo(status, slug)

@sonic2kk
Copy link
Contributor

A dataclass that represents the AWACY object sounds like a good solution to me :-) Better to map it onto a dataclass than a dict. I guess then each SteamApp would have some AWACY info as a dataclass, and it would contain our status and slug - and in future, any other information we want to include. For example, we could list the anti-cheat in use by the game in the tooltip.

I won't be available to tackle this but this sounds like a good enhancement and I hope I was able to help 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants