Repository navigation
fix(#333): keep Disqus login when reopening comments - #339
Merged
Merged
Conversation
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>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After logging in to Disqus, the comments sheet kept asking for login again.
Root cause:
DisqusSheetloaded its local HTML withpage.load(html:), whosebaseURLdefaults toabout: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 inDisqusDataStore, 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: addsshortnameandpageURL; the embed script usesshortname.DisqusSheet.loadContent(): passespageURLasbaseURL.DisqusHTMLBuilderTests(Swift Testing).A separate commit refreshes
graphify-out/.Type of Change
fix: Bug fixtest: Adding or updating testsRelated Issue
Fixes #333
Screenshots/Videos
None.
Testing
-testPlan MacMagazine)--strict)Checklist
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