dolphin-emu / www

Dolphin Emulator official website source code (running on https://dolphin-emu.org/)
MIT License
115 stars 68 forks source link

allow win-arm64 platform #145

Closed shuffle2 closed 2 years ago

PEmu2 commented 2 years ago

Screenshot

I've noticed that the ARM64 builds are also highlighted downloads even when using an x64 system. This probably isn't a great idea as those builds won't even run and less technically proficient users may get confused with the option.

@shuffle2 @delroth is it possible to only highlight the x64 Windows builds on x64 systems? I'm not sure how exactly the site does detection for that and if browsers on ARM systems include that info in their user agent or not.

I think the reverse situation of highlighting x64 builds on ARM systems is still fine as some users may still want to run those especially older versions before the buildbot was updated.

shuffle2 commented 2 years ago

Afaik it’s not possible to differentiate.

I prefer it how it is (unless there’s a real way to differentiate)

reflectronic commented 2 years ago

It would be possible to differentiate using the new User Agent Client Hints feature. We would need to set the following headers in our response:

Accept-CH: Sec-CH-UA-Arch
Critical-CH: Sec-CH-UA-Arch

This would allow us to read the Sec-CH-UA-Arch header, which will either be arm or x86.

I don't really know Django, but if nobody is interested in contributing a patch then I could figure it out myself.

shuffle2 commented 2 years ago

@reflectronic while i'm not against the idea, it's not that simple: 1) browser on windows arm64 could be x86, x64, arm32, arm64 2) browser on windows x64 could be x86, x64

(granted, non-native browser is expected to be rare, but..)

It looks like Sec-CH-UA may expose enough information to resolve all these possibilities back to the real underlying OS arch, but I'm not sure / probably would need a test. It's not clear if the browser is required to expose the OS information or just information relating to the browser build itself (and it seems more likely to be the latter...?)

If the OS arch resolving fails, it's probably best to just fallback to highlighting both windows buttons (as it is now), as opposed to highlighting nothing.

reflectronic commented 2 years ago

it's not that simple

The standard specifically says that the only values that Sec-CH-UA-Arch can have are:

You need to use Sec-CH-UA-Bitness to differentiate between e.g. 32- and 64-bit Arm.

It's not clear if the browser is required to expose the OS information or just information relating to the browser build itself

The hints specifically describe "the user agent's underlying CPU architecture." Chromium specifically implements checks to detect the underlying CPU architecture, even when running under emulation or WOW64. This header was specifically designed to allow websites to serve native binaries on download pages.

delroth commented 1 year ago

In general I'm in favor of switching to using CH for this (as long as we fallback to the existing UA detection). It's not completely trivial since that also means moving the implementation from server side to client side. If you want to give it a shot please feel free to do so, I'll be busy in the next few weeks so I'm unlikely to do so myself.

On Sat, Jul 16, 2022, 19:18 John Tur @.***> wrote:

it's not that simple

The standard specifically says https://wicg.github.io/ua-client-hints/#http-ua-hints that the only values that Sec-CH-UA-Arch can have are:

  • x86
  • arm
  • empty string

You need to use Sec-CH-UA-Bitness to differentiate between e.g. 32- and 64-bit Arm.

It's not clear if the browser is required to expose the OS information or just information relating to the browser build itself

The hints specifically describe "the user agent's underlying CPU architecture." Chromium specifically implements https://github.com/chromium/chromium/blob/44fdbe2237e61b5c664290e2b9878098ae61a9aa/content/common/user_agent.cc#L109 checks to detect the underlying CPU architecture, even when running under emulation or WOW64.

— Reply to this email directly, view it on GitHub https://github.com/dolphin-emu/www/pull/145#issuecomment-1186244169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRQLXG35YPTXVA43D5O7LVULVGRANCNFSM5ZAGIXYQ . You are receiving this because you were mentioned.Message ID: @.***>