-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix imagine hostnames 2 #10937
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
Fix imagine hostnames 2 #10937
Conversation
📝 WalkthroughWalkthroughThis pull request renames platform config keys and shifts domain handling to a unified hostnames list. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (5)
🧰 Additional context used🧬 Code graph analysis (3)src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php (3)
src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php (3)
app/controllers/general.php (3)
🪛 PHPMD (2.15.0)app/controllers/general.php62-62: Avoid unused parameters such as '$utopia'. (undefined) (UnusedFormalParameter) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
🔇 Additional comments (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e9e788d to
6c6c2a8
Compare
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
6c6c2a8 to
7efe840
Compare
7efe840 to
c6ffa18
Compare
✨ Benchmark results
⚡ Benchmark Comparison
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
app/config/platform.php(1 hunks)app/config/templates/site.php(1 hunks)app/controllers/api/account.php(3 hunks)app/controllers/api/vcs.php(3 hunks)app/controllers/general.php(12 hunks)app/init/resources.php(2 hunks)app/views/general/error.phtml(1 hunks)src/Appwrite/Vcs/Comment.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/init/resources.php (1)
src/Appwrite/Event/Build.php (1)
setResource(43-48)
🪛 PHPMD (2.15.0)
app/controllers/general.php
62-62: Avoid unused parameters such as '$utopia'. (undefined)
(UnusedFormalParameter)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Benchmark
- GitHub Check: E2E Service Test (Databases/Legacy)
- GitHub Check: E2E Service Test (Databases/TablesDB)
🔇 Additional comments (15)
app/config/templates/site.php (1)
10-15: UseconsoleHostnamefor templates base URLSwitching
$hostnameto$platform['consoleHostname']aligns this file with the new platform config key and keeps URL construction behavior intact (protocol + console host). No further issues here.app/views/general/error.phtml (1)
18-26: Console error view now keyed offconsoleHostnameUsing
$platform['consoleHostname']for$hostnameis consistent with the config rename and with other files in this PR; the devlocalhostoverride remains unchanged. Looks good.src/Appwrite/Vcs/Comment.php (1)
119-123: VCS comment URLs now correctly useconsoleHostnameBoth the PR comment body (
generateComment) and image helper (generatImage) now derive the base host from$this->platform['consoleHostname'], matching the new platform contract without changing URL shapes or paths. As long asconsoleHostnameis configured, this remains behaviorally equivalent to the previousconsoleDomainusage.Also applies to: 233-239
app/controllers/api/account.php (3)
1328-1342: OAuth2 session redirects now based onconsoleHostnameUsing
$platform['consoleHostname']for$redirectBasekeeps defaultsuccess/failureURLs pointing at the console while aligning with the new config naming. Callback handling still uses the API host, so the flow remains consistent.
1981-1997: OAuth2 token flow redirect base updated toconsoleHostnameThe token-oriented OAuth2 endpoint now also builds its default success/failure redirects from
$platform['consoleHostname'], mirroring the session endpoint. This keeps console redirects consistent across both flows.
2154-2165: Magic URL default redirect now usesconsoleHostnameWhen
urlis omitted, the magic URL token flow now composes/console/auth/magic-urlusing$platform['consoleHostname']plus protocol/port. This is a direct key rename fromconsoleDomainand should behave identically assumingconsoleHostnameis set in the platform config.app/controllers/api/vcs.php (1)
135-135: LGTM! Consistent key rename fromconsoleDomaintoconsoleHostname.All three occurrences correctly use the new
consoleHostnamekey with appropriate fallback handling via?? ''.Also applies to: 558-558, 617-617
app/init/resources.php (2)
178-178: LGTM! Endpoint construction updated to useapiHostname.The endpoint URL is correctly built using the renamed
apiHostnamekey.
186-208: LGTM! Resource refactoring fromdomainstoplatform['hostnames'].The
allowedHostnamesresource correctly:
- Updated signature to accept
$platforminstead of$domains- Uses
$platform['hostnames'] ?? []with appropriate fallback- Updated dependency array to reference
'platform'instead of'domains'app/controllers/general.php (6)
62-84: LGTM! Router function updated to use platform-derived hostnames.The
router()function signature correctly:
- Removed the
$domainsparameter- Now receives the full
$platformarray- Derives
consoleHostnameandplatformHostnamesfrom the platform configuration
1033-1058: LGTM! Certificate generation uses platform hostnames consistently.The SSL certificate generation logic correctly:
- Injects
platforminstead ofdomains- Uses
$platform['hostnames']for hostname validation- Updated the cache parameter key from
'domains'to'hostnames'
862-873: LGTM! App::init action updated for platform-based hostname checks.The routing decision correctly uses
$platform['hostnames']to determine whether to invoke the router.
1144-1154: LGTM! Options handler updated for platform-based hostname checks.Consistent with other handlers in using
$platform['hostnames']for routing decisions.
1453-1462: LGTM! robots.txt handler updated for platform-based hostname checks.The logic correctly checks against
$platform['hostnames']to determine whether to serve the default robots.txt or delegate to the router.
1485-1495: LGTM! humans.txt handler updated for platform-based hostname checks.Consistent with the robots.txt handler pattern.
No description provided.