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

todesk: update livecheck #172925

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

todesk: update livecheck #172925

wants to merge 4 commits into from

Conversation

samford
Copy link
Member

@samford samford commented May 4, 2024

Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

In the following questions <cask> is the token of the cask you're submitting.

After making any changes to a cask, existing or new, verify:

Additionally, if adding a new cask:

  • Named the cask according to the token reference.
  • Checked the cask was not already refused.
  • Checked the cask is submitted to the correct repo.
  • brew audit --cask --new <cask> worked successfully.
  • HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask <cask> worked successfully.
  • brew uninstall --cask <cask> worked successfully.

The existing livecheck block for todesk checks an upstream release notes page but the response body only contains a <script> element when checked with curl, so it gives an Unable to get versions error. This seems to be true regardless of headers (e.g., user agent, etc.).

This updates the livecheck block to check the download page and match the version from the pkg URL (found in some JavaScript code).

The existing `livecheck` block for `todesk` checks an upstream release
notes page but the response body only contains a `<script>` element
when checked with curl, so it gives an `Unable to get versions` error.
This seems to be true regardless of headers (e.g., user agent, etc.).

This updates the `livecheck` block to check the download page and
match the version from the pkg URL (found in some JavaScript code).
@samford samford added the livecheck Issues or PRs related to livecheck label May 4, 2024
@samford
Copy link
Member Author

samford commented May 4, 2024

Looks like the SHA256 changed since this was last updated:

==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
Warning: Cask reports different sha256: cba50ad3b10523f71175953d4606d3daf122d344dd1e5f130fd190a93ba509e8
SHA256: dbc167b9f720430990fcc0e3d035f99a0f649017b0a81f21ca8be61ed5d3266e

@miccal
Copy link
Member

miccal commented May 4, 2024

SHA256 keeps changing:

==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: d9c262bd5863847186ad844b8e893882b8cddf8c88a14bce6ac1e459b3273a45
==> Retrying download in 2s... (4 tries left)
==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: f56784698bc6a94d4b0f55ef49d544f8ce870c5c78874fb738178540a81bf47e
==> Retrying download in 4s... (3 tries left)
==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: 99e1ebdd5d9d3de6ff4c36be8c52d8f63acaeab9d2eaa5bf267793c5776a331d
==> Retrying download in 8s... (2 tries left)
==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: aca5daf2e671c03cd21ce979d27f470d4ffcf62b9bb234a1e0fc4d6cacd5cc25
==> Retrying download in 16s... (1 try left)
==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
Downloaded to: /Users/runner/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: a8a451b3da052ab7bdb101adb4f9ed925db73e7c0ce6b15f9a6b24a482be3033
Warning: Cask reports different sha256: dbc167b9f720430990fcc0e3d035f99a0f649017b0a81f21ca8be61ed5d3266e

@bevanjkay
Copy link
Member

@razvanazamfirei we shouldn't use :no_check here, it's not getting updated in place. The download is returning a different response on subsequent retries.

@krehel krehel closed this May 14, 2024
@krehel krehel deleted the todesk-update-livecheck branch May 14, 2024 18:19
@krehel krehel restored the todesk-update-livecheck branch May 14, 2024 18:19
@krehel krehel reopened this May 14, 2024
@krehel
Copy link
Member

krehel commented May 14, 2024

Sorry, accidentally deleted the branch!

@Aaron-212
Copy link
Contributor

Seems that Todesk is blocking users from downloading with Homebrew.

$ brew fetch todesk --verbose --force
==> Downloading https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.0-40-g1fac683\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --fail --retry 3 --remote-time --output /Users/aaron212/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg.incomplete --location https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1010  100  1010    0     0   1005      0  0:00:01  0:00:01 --:--:--  1005
Downloaded to: /Users/aaron212/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
SHA256: 7cd79d1489cd20d8b3868f2253e6226306302d1d8e9513a3de2d135b0c01d27c
==> Verifying checksum for 'cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg'
Warning: Cask reports different sha256: cba50ad3b10523f71175953d4606d3daf122d344dd1e5f130fd190a93ba509e8


$ cat /Users/aaron212/Library/Caches/Homebrew/downloads/cd1dd993fe8cf89307cc0bafc24612ac8d1a6b903152d72d19a6fe512662176b--ToDesk_4.7.2.1.pkg
<script>var _0x49a6=['wyeCN','4|2|0|3|1','wQzOV','split','iTyzs','pCQRM','cookie','location.href=location.href.replace(/[?|&]tads/,\x20\x27\x27)','WTKkN','bOYDu','dtzqS'];(function(a,c){var b=function(b){while(--b){a['push'](a['shift']());}};b(++c);}(_0x49a6,0x147));var _0x649a=function(a,c){a=a-0x0;var b=_0x49a6[a];return b;};function a(){var a={'WTKkN':1065911934,'bOYDu':71984353,'dtzqS':function d(a,b){return a+b;},'wyeCN':260039576,'pCQRM':function e(a){return a();}};var b=0x0;b+=a[_0x649a('0x0')];b+=a[_0x649a('0x1')];b=a[_0x649a('0x2')](b,a[_0x649a('0x3')]);function c(){var b={'wQzOV':_0x649a('0x4'),'iTyzs':function e(a,b){return a+b;}};var c=b[_0x649a('0x5')][_0x649a('0x6')]('|'),d=0x0;while(!![]){switch(c[d++]){case'0':a+=0xd9;continue;case'1':return a;continue;case'2':a+=0xa4;continue;case'3':a=b[_0x649a('0x7')](a,0x1c0);continue;case'4':var a=0x0;continue;}break;}}return a[_0x649a('0x8')](c),b;}document[_0x649a('0x9')]='__tst_status='+a()+'#;';setTimeout(_0x649a('0xa'),0x4b0);</script>

The obfuscated JS code keeps changing so the SHA256 also keeps changing.

Also, I tested a few times. The only way to download Todesk from command line is using a proper browser UA and a Chinese internet environment.

$ curl https://dl.todesk.com/macos/ToDesk_4.7.2.1.pkg -A "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.14"

Missing any of these, the url will only return garbage.

@krehel
Copy link
Member

krehel commented May 16, 2024

Thanks @Aaron-212 for looking into this. Unfortunately, that may require removing this software the repository if we can't get a stable download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
livecheck Issues or PRs related to livecheck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants