Skip to content

fix(#333): keep Disqus login when reopening comments - #339

Merged
cassio-rossi merged 2 commits into
release/v5from
fix/333-disqus-login
Nov 12, 2026
Merged

cassio-rossi merged 2 commits into
release/v5from
fix/333-disqus-login

Conversation

@cassio-rossi

Copy link
Copy Markdown
Collaborator

Description

After logging in to Disqus, the comments sheet kept asking for login again.

Root cause: DisqusSheet loaded its local HTML with page.load(html:), whose baseURL defaults to about:blank. The Disqus embed iframe (disqus.com) then runs in a third-party context, and WKWebView blocks third-party cookies. The login sheet opens disqus.com top-level, so the session cookie is stored in DisqusDataStore, but the comments iframe was never allowed to read it.

Fix: load the same HTML under the forum's own origin, https://macmagazinecombr.disqus.com/, so the page and the iframe are same-site and the session cookie is sent.

  • DisqusHTMLBuilder: adds shortname and pageURL; the embed script uses shortname.
  • DisqusSheet.loadContent(): passes pageURL as baseURL.
  • New DisqusHTMLBuilderTests (Swift Testing).

A separate commit refreshes graphify-out/.

Type of Change

  • 🐛 fix: Bug fix
  • ✅ test: Adding or updating tests

Related Issue

Fixes #333

Screenshots/Videos

None.

Testing

  • Tested on iPhone (specify model/iOS version): iPhone 18 Pro simulator, iOS 27.2. Login carries over to the comments sheet (verified manually by the author).
  • Tested on iPad (specify model/iOS version):
  • All unit tests pass (-testPlan MacMagazine)
  • No SwiftLint warnings/errors (--strict)

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • I have updated the documentation (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • My branch is up-to-date with the base branch

Additional Notes

Disqus checks which sites may embed it. It renders fine under the disqus.com origin in manual testing, but keep this in mind if a "We were unable to load Disqus" error ever shows up.

🤖 Generated with Claude Code

cassio-rossi and others added 2 commits November 12, 2026 19:13
The comments HTML was loaded with the default about:blank base URL, so
the disqus.com iframe ran in a third-party context and WebKit blocked the
session cookies written by the login sheet. Load the page under the
forum's disqus.com origin so the iframe is same-site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cassio-rossi
cassio-rossi merged commit 4b85b97 into release/v5 Nov 12, 2026
2 checks passed
@cassio-rossi
cassio-rossi deleted the fix/333-disqus-login branch November 12, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disqus quebrou no app?

1 participant