Fix #1471 - Replace hardcoded URLs with relative paths in API page - #1484
Fix #1471 - Replace hardcoded URLs with relative paths in API page#1484MerwinJoshwa wants to merge 1 commit into
Conversation
Reviewer's GuideReplaces hardcoded absolute localhost and susi.ai URLs in the API documentation page with root-relative paths so the page works correctly across different deployment environments without external host assumptions. File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues, and left some high level feedback:
- Several anchors now have relative hrefs but still display the old absolute URLs as link text (e.g., the geocode examples), which is confusing; consider updating the visible text to match the new relative paths or clearly marking them as sample host-based URLs.
- The threaddump link
hrefwas changed to/aaa/threaddump.txt.(with a trailing dot) while the text is/aaa/threaddump.txt; the extra dot in the href is likely unintended and will break the link. - In the configuration list,
client.domainremains set tohttp://localhost:3001while other localhost URLs are now relative; clarify whether this should also become relative or remain a concrete example.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Several anchors now have relative hrefs but still display the old absolute URLs as link text (e.g., the geocode examples), which is confusing; consider updating the visible text to match the new relative paths or clearly marking them as sample host-based URLs.
- The threaddump link `href` was changed to `/aaa/threaddump.txt.` (with a trailing dot) while the text is `/aaa/threaddump.txt`; the extra dot in the href is likely unintended and will break the link.
- In the configuration list, `client.domain` remains set to `http://localhost:3001` while other localhost URLs are now relative; clarify whether this should also become relative or remain a concrete example.
## Individual Comments
### Comment 1
<location> `html/api.html:1025` </location>
<code_context>
</p>
<ul class="request">
-<li><a href="http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}
+<li><a href="/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}
</a></li>
-<li> Other languages: <br> <a href="http://susi.ai/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}" target="_blank">http://susi.ai/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}</a></li>
</code_context>
<issue_to_address>
**suggestion:** Link text and href are inconsistent (absolute vs relative URL).
Please update the anchor text to show the new root-relative URL (e.g. `/aaa/...`) instead of the old absolute `http://susi.ai/...` so the displayed URL matches the actual href.
Suggested implementation:
```
<li><a href="/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}
</a></li>
```
```
<li> Other languages: <br> <a href="/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}" target="_blank">/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}</a></li>
```
</issue_to_address>
### Comment 2
<location> `html/api.html:1489-1495` </location>
<code_context>
+ <li><a href="/aaa/account.json?action=update&data={%22screen_name%22:%22test%22,%22oauth_token%22:%22abc%22,%22oauth_token_secret%22:%22def%22}">http://localhost:9000/aaa/account.json?action=update&data={"screen_name":"test","oauth_token":"abc","oauth_token_secret":"def"}</a></li>
</code_context>
<issue_to_address>
**suggestion:** Account API examples mix relative hrefs with localhost link text.
These examples now use `/aaa/...` in the `href` but still display `http://localhost:9000/...` as the link text, which can mislead users who copy the text instead of the actual link. Please update the visible text to match the relative URL, consistent with the later account example.
</issue_to_address>
### Comment 3
<location> `html/api.html:1739` </location>
<code_context>
-<p>Simply download <a href="http://localhost:9000/aaa/threaddump.txt">http://localhost:9000/aaa/threaddump.txt</a> file. Either <strong>GET</strong> or <strong>POST</strong> request is valid for thread dump api. <strong>No parameter is needed in this api</strong>.</p>
-<p><a href="http://localhost:9000/aaa/threaddump.txt.">http://localhost:9000/aaa/threaddump.txt</a> contains the real-time information about loklak in JVM, including:</p>
+<p>Simply download <a href="/aaa/threaddump.txt">/aaa/threaddump.txt</a> file. Either <strong>GET</strong> or <strong>POST</strong> request is valid for thread dump api. <strong>No parameter is needed in this api</strong>.</p>
+<p><a href="/aaa/threaddump.txt.">/aaa/threaddump.txt</a> contains the real-time information about loklak in JVM, including:</p>
<ul>
<li>Memory usage</li>
</code_context>
<issue_to_address>
**issue (bug_risk):** Extra dot in threaddump endpoint href likely breaks the link.
The href ends with a trailing dot (`/aaa/threaddump.txt.`) while the displayed text and previous example use `/aaa/threaddump.txt` without it. Unless the endpoint name really includes the period, this link will 404. Please remove the trailing `.` from the href.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| </p> | ||
| <ul class="request"> | ||
| <li><a href="http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]} | ||
| <li><a href="/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">http://susi.ai/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]} |
There was a problem hiding this comment.
suggestion: Link text and href are inconsistent (absolute vs relative URL).
Please update the anchor text to show the new root-relative URL (e.g. /aaa/...) instead of the old absolute http://susi.ai/... so the displayed URL matches the actual href.
Suggested implementation:
<li><a href="/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}" target="_blank">/aaa/geocode.json?data={%22places%22:[%22Frankfurt%20am%20Main%22,%22New%20York%22,%22Singapore%22]}
</a></li>
<li> Other languages: <br> <a href="/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}" target="_blank">/aaa/geocode.json?data={%22places%22:[%22%E5%9C%A3%E8%83%A1%E5%88%A9%E5%A8%85%20%E5%BE%B7%E6%B4%9B%E9%87%8C%E4%BA%9A%22]}</a></li>
| <li><a href="/aaa/account.json?action=update&data={%22screen_name%22:%22test%22,%22oauth_token%22:%22abc%22,%22oauth_token_secret%22:%22def%22}">http://localhost:9000/aaa/account.json?action=update&data={"screen_name":"test","oauth_token":"abc","oauth_token_secret":"def"}</a></li> | ||
| </ul><br/> | ||
| </p> | ||
|
|
||
| <p>It can then be retrieved again with | ||
| <ul class="request"> | ||
| <li><a href="http://localhost:9000/aaa/account.json?screen_name=test">http://localhost:9000/aaa/account.json?screen_name=test</a></li> | ||
| <li><a href="/aaa/account.json?screen_name=test">http://localhost:9000/aaa/account.json?screen_name=test</a></li> |
There was a problem hiding this comment.
suggestion: Account API examples mix relative hrefs with localhost link text.
These examples now use /aaa/... in the href but still display http://localhost:9000/... as the link text, which can mislead users who copy the text instead of the actual link. Please update the visible text to match the relative URL, consistent with the later account example.
| <p>Simply download <a href="http://localhost:9000/aaa/threaddump.txt">http://localhost:9000/aaa/threaddump.txt</a> file. Either <strong>GET</strong> or <strong>POST</strong> request is valid for thread dump api. <strong>No parameter is needed in this api</strong>.</p> | ||
| <p><a href="http://localhost:9000/aaa/threaddump.txt.">http://localhost:9000/aaa/threaddump.txt</a> contains the real-time information about loklak in JVM, including:</p> | ||
| <p>Simply download <a href="/aaa/threaddump.txt">/aaa/threaddump.txt</a> file. Either <strong>GET</strong> or <strong>POST</strong> request is valid for thread dump api. <strong>No parameter is needed in this api</strong>.</p> | ||
| <p><a href="/aaa/threaddump.txt.">/aaa/threaddump.txt</a> contains the real-time information about loklak in JVM, including:</p> |
There was a problem hiding this comment.
issue (bug_risk): Extra dot in threaddump endpoint href likely breaks the link.
The href ends with a trailing dot (/aaa/threaddump.txt.) while the displayed text and previous example use /aaa/threaddump.txt without it. Unless the endpoint name really includes the period, this link will 404. Please remove the trailing . from the href.
Fix #1471-This PR removes hardcoded absolute URLs (localhost and susi.ai)
from api.html and replaces them with relative paths.
This makes the API page environment independent
and removes external dependency assumptions.
Summary by Sourcery
Make the API documentation page environment-agnostic by replacing hardcoded absolute URLs with root-relative paths.
Bug Fixes:
Enhancements: