Add Google Calendar Failed: v2.19.2 Pro

Using Pro v2.19.2, I cannot add Google calendars

Steps to reproduce:

  1. Environment: Windows 8.1 Pro
  2. Connection check: on Chrome, I can access calendar.google.com. (Under proxy, using Rule/Global mode of Clash)
  3. launch rainlendar exe
  4. following doc instrctions (options → calendar → new calendar → Google v3)
  5. on the opened browser page, Google-provided authentication is shown.
  6. grant rainlendar with the priviledge
  7. a localhost page telling “you may close the page” shows up
  8. close page & return to the rainlendar app
  9. click “select calendar”
  10. error raised after a long period of time, saying
[some_time] Google Calendar Error (Dummy)!
Unable to authenticate to Google.
Server returned result: (28) 0 The timeout was reached.

Key Debug Logs:

23:02:03: [0:00:48.579] DEBUG: Window Calendar was activated
23:02:07: [0:00:52.824] DEBUG: Window Calendar was activated
23:02:07: [0:00:52.825] DEBUG: Window Calendar got focus
23:02:09: [0:00:54.357] DEBUG: Window Calendar was activated
23:02:15: [0:01:00.527] Dummy: CURLINFO_TEXT: connect to 2404:6800:4012:4::200d port 443 failed: Timed out
23:02:15: [0:01:00.728] Dummy: CURLINFO_TEXT: connect to 172.217.160.109 port 443 failed: Timed out
23:02:15: [0:01:00.750] DEBUG: Action thread finished properly.
23:02:15: [0:01:00.728] Dummy: CURLINFO_TEXT: Failed to connect to accounts.google.com port 443 after 21387 ms: Couldn't connect to server
23:02:15: [0:01:00.728] Dummy: CURLINFO_TEXT: Closing connection 0
23:02:15: [0:01:00.728] Dummy: Result: (28) 0 The timeout time was reached.
23:02:15: [0:01:00.728] 
23:02:15: [0:01:00.728] DEBUG: Curl error: Failed to connect to accounts.google.com port 443 after 21387 ms: Couldn't connect to server
23:02:15: [0:01:00.730] DEBUG: Stopped the action thread.
23:02:17: [0:01:02.150] DEBUG: Redrawing window Today took 32 ms (0, 0)
23:03:17: [0:02:02.146] DEBUG: Redrawing window Today took 26 ms (0, 0)
23:04:17: [0:03:02.146] DEBUG: Redrawing window Today took 27 ms (0, 0)
23:05:17: [0:04:02.146] DEBUG: Redrawing window Today took 27 ms (0, 0)

Further note:

  1. It seems that it is the connection error, as the app fails to access accounts.google.com
  2. However, when opening accounts.google.com (or any other Google sites), proxy can be handled correctly (i.e., connection is successful)
  3. Probably, rainlendar cannot handle Clash proxies? Or special settings are required?

I’m not familiar with Clash but if it’s a transparent proxy I would expect that all https traffic goes through it automatically so I’m not sure why this happens. Have you tried e.g. using just the curl command line tool to connect to account.google.com or calendar.google.com? Does that go through the proxy?

Yeah, I do share the same understanding of Clash “as proxy” as yours.

By further checking docs & issues (e.g. github), I find that Clash is an application-layer
service, which does NOT handle ping (ICMP), or curl. To tackle the problem, one ought to set environment variables http_proxy and https_proxy (e.g. default as 127.0.0.1:7890).

After applying the above settings, the described issue is solved,

with both the following curl working:

curl accounts.google.com returns

<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="https://accounts.google.com/">here</A>.
</BODY>
</HTML>

and curl calendar.google.com returns

<!doctype html><html lang="en" dir="ltr"><head><base href="https://calendar.google.com/"><link rel="
canonical" href="https://calendar.google.com/"><meta name="referrer" content="origin-when-cross-orig
in"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="shortcut icon"
href="https://workspace.google.com/lp/static/images/favicon.ico?fingerprint=913d48cd5d48ba34313131f2
46f99d6b"><title>Google Calendar - Easier Time Management, Appointments & Scheduling</title><meta na......

Special note:

  1. BUG: when setting env vars wrongly & then correctedly, Rainlendar will ignore the updated value. For instance, setting envs http(s)_proxy=172.0.0.1:7890 (wrong) and then correcting to http(s)_proxy=127.0.0.1:7890, debug logs indicate that requests are proxied to 172.***.
  2. NOT checked, whether proxy settings in rainlendar settings work (i.e., set proxy in rainlendar to 127.0.0.1:7890)
  3. You are free to use my inputs as documentation materials.

Thanks for the timely response. Nice day~



futher update: rainlendar built-in proxy works, no need to set system environment variable.

work-around:

  1. rainlendar → settings → advanced → network → proxy server, set as the static host of Clash (Clash → settings → system proxy - > static host).
  2. (CRITICAL) click OK to apply changes, and the app restarts
  3. add Google-related subscriptions


Meanwhile, in thrist for API-available Google Keep support, I post a ticket (19014) in the suggestion section,

about which, similar feature requests were brought up before long before.

Hopefully, the moderator might take it into consideration. If any assistance is needed, please feel free to contact me.