Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Fix #1471 - Replace hardcoded URLs with relative paths in API page - #1484

Open
MerwinJoshwa wants to merge 1 commit into
fossasia:developmentfrom
MerwinJoshwa:b2
Open

Fix #1471 - Replace hardcoded URLs with relative paths in API page#1484
MerwinJoshwa wants to merge 1 commit into
fossasia:developmentfrom
MerwinJoshwa:b2

Conversation

@MerwinJoshwa

@MerwinJoshwa MerwinJoshwa commented Feb 15, 2026

Copy link
Copy Markdown

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:

  • Remove hardcoded localhost and external domain URLs from api.html examples to prevent environment-specific breakage.

Enhancements:

  • Update API example links and configuration values to use relative paths so they work consistently across different deployments.

@sourcery-ai

sourcery-ai Bot commented Feb 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Replaces 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

Change Details Files
Update API documentation examples to use root-relative URLs instead of hardcoded absolute hosts.
  • Replace hardcoded http://localhost:9000/aaa and http://localhost:3000/3001 paths with /aaa-based root-relative URLs in configuration and request examples.
  • Replace hardcoded http://susi.ai/aaa and http://susi.ai/vis paths with corresponding /aaa and /vis root-relative URLs in example links.
  • Ensure both the href attributes and their visible link text are updated consistently to the new relative paths.
  • Preserve existing query parameters and example payloads while only modifying the URL base portion.
html/api.html

Assessment against linked issues

Issue Objective Addressed Explanation
#1471 Eliminate all dependencies on external CDNs, libraries, and fonts on the API page so that it can run completely offline (using only local assets/references). The PR only replaces hardcoded absolute API example URLs (http://localhost:... and http://susi.ai/...) with relative paths like /aaa/... in api.html. It does not modify any <script>, , font, or CDN references, nor does it ensure assets are served locally. Therefore it does not fulfill the requirement to remove external CDN/library/font dependencies so the page can run fully offline.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread html/api.html
</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]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Comment thread html/api.html
Comment on lines +1489 to +1495
<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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread html/api.html
<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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make all libraries and fonts run locally and delete external dependencies on API page

1 participant