heymoosh_ticktick-quick-add.../callback.html
Claude 23eba63ff7
Enable mobile compatibility with seamless OAuth deep-link
- Flip isDesktopOnly to false in manifest.json; the runtime code uses
  only platform-safe APIs (requestUrl, crypto.subtle, URLSearchParams).
- Register obsidian://ticktick-callback protocol handler so the OAuth
  redirect returns directly into Obsidian on desktop and mobile,
  removing the manual copy-paste step.
- Verify state parameter against tempState to mitigate CSRF, and clear
  tempCodeVerifier/tempState after a successful exchange.
- Update Vercel callback pages (callback.html, index.html) to redirect
  to the obsidian:// deep link instead of displaying the code as text.
  Note: the deployed Vercel page must be redeployed for users to see
  the new behavior.
- Drop the now-vestigial "Authorization code" paste field from the
  settings UI.
2026-05-10 23:41:32 +00:00

35 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TickTick OAuth Callback</title>
</head>
<body>
<h1>Authorization Complete</h1>
<p id="message">Processing...</p>
<p id="fallback" style="display:none">
If Obsidian did not open automatically,
<a id="deeplink" href="#">tap here to return to Obsidian</a>.
</p>
<script>
const params = new URLSearchParams(window.location.search);
const code = params.get('code');
const state = params.get('state');
const messageEl = document.getElementById('message');
if (code && state) {
const target = 'obsidian://ticktick-callback'
+ '?code=' + encodeURIComponent(code)
+ '&state=' + encodeURIComponent(state);
messageEl.innerText = 'Returning you to Obsidian…';
const fallback = document.getElementById('fallback');
const link = document.getElementById('deeplink');
link.href = target;
fallback.style.display = 'block';
window.location.replace(target);
} else {
messageEl.innerText = 'Authorization failed or was canceled. Please try again.';
}
</script>
</body>
</html>