Giter VIP home page Giter VIP logo

Comments (5)

DavidoTek avatar DavidoTek commented on August 14, 2024 1

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)

from protonup-qt.

sonic2kk avatar sonic2kk commented on August 14, 2024 1

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 😄

from protonup-qt.

DavidoTek avatar DavidoTek commented on August 14, 2024

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.

from protonup-qt.

sonic2kk avatar sonic2kk commented on August 14, 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 :-)

from protonup-qt.

sonic2kk avatar sonic2kk commented on August 14, 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.

from protonup-qt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.