Skip to content
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

Base URL for "Whats new in x.x.x" incorrect and points to local homebridge server #90

Closed
jsiegenthaler opened this issue Feb 16, 2021 · 23 comments
Assignees
Labels

Comments

@jsiegenthaler
Copy link

Describe The Bug:

The ChangeLog lists the changes with hyperlinks all pointing to my local Homebridge instance, example:

http://192.168.0.171:8581/#whats-new-in-312
http://192.168.0.171:8581/#whats-new-in-311
http://192.168.0.171:8581/#whats-new-in-310

http://192.168.0.171:8581 is my local homebridge server
I'm guessing the base URL for the links is missing

To Reproduce:

  1. Install a prior version
  2. Wait for homebridge to say it can be updated
  3. Install the new version
  4. View the changelog screen
  5. Try and follow a hyperlink

Expected Behaviour:

The link should take the user to the following base url:
https://github.com/ztalbot2000/homebridge-cmd4/blob/master/CHANGELOG.md

eg
https://github.com/ztalbot2000/homebridge-cmd4/blob/master/CHANGELOG.md#whats-new-in-312

Link to Logs:

Paste of Logs:


Cmd4 Config:

Screenshots:

Environment:

  • Node.js Version: v14.15.5
  • NPM Version: v6.14.11
  • Homebridge Version: v1.2.5
  • homebridge-cmd4 Version: v3.1.2
  • Operating System: Raspbian GNU/Linux Buster (10)
  • Process Supervisor: hb-service
@ztalbot2000
Copy link
Owner

ztalbot2000 commented Feb 16, 2021 via email

@ztalbot2000
Copy link
Owner

Why do I not see what your seeing?

The CHANGELOG.md file contains:
* [**Whats new in 3.1.2**](#whats-new-in-312)

Which points to the record:
* A bit better answer to [#89](https://github.com/ztalbot2000/homebridge-cmd4/pull/89), with testcases to prove it ([569018b5](https://github.com/ztalbot2000/homebridge-cmd4/commit/569018b5a0f6bfc76b045d70acead590fa267de2))

There is nothing with a reference to 192.168 anywhere. What am I missing?

@jsiegenthaler
Copy link
Author

You must have a base url configured somewhere, that gets lost when it is installed on my machine. If the base url is missing, the browser inserts the current site: which is my homebridge (192.168...)

@ztalbot2000
Copy link
Owner

Well that helps a little. I will dig further. I had done a grep -r 192.168 on my repo and came up empty.
May I ask then what browser you are using? Mine is Safari.

@ztalbot2000
Copy link
Owner

the format of the internal link is exactly the same as the format of the internal link in the README.md. Do you see it there as well?

* [**Whats new in 3.1.2**](#whats-new-in-312)
* [**About the Cmd4 Plugin**](#about-the-cmd4-plugin)

The W3 specification states when resolving the URI

`12.4.1 Resolving relative URIs

User agents must calculate the base URI for resolving relative URIs according to [RFC1808], section 3. The following describes how [RFC1808] applies specifically to HTML.

User agents must calculate the base URI according to the following precedences (highest priority to lowest):

The base URI is set by the BASE element.
The base URI is given by meta data discovered during a protocol interaction, such as an HTTP header (see [RFC2616]).
By default, the base URI is that of the current document. Not all HTML documents have a base URI (e.g., a valid HTML document may appear in an email and may not be designated by a URI). Such HTML documents are considered erroneous if they contain relative URIs and rely on a default base URI.`

So I do not include a base URI in either documents. Which might fix your issue, but it seems this is really a browser issue. I am curious if you see the same problem in the README.md file as well.

@jsiegenthaler
Copy link
Author

jsiegenthaler commented Feb 17, 2021

I'm using google Chrome on Win10
When viewing the Readme.md and the Changelog.md from
https://github.com/ztalbot2000/homebridge-cmd4/blob/master/
then everything works well, as the browser currently has the https://github.com/ztalbot2000/homebridge-cmd4/blob/master/ website loaded.

The links in the documents are relative links, always relative to the currently loaded page.

You have the links stored in the changelog and readme files as:
* [**Whats new in 3.1.3**](#whats-new-in-313)

When viewing the changelog file on homebridge, the currently open page is the Homebridge server, which for me is http://192.168.0.171:8581
Thus the relative page is http://192.168.0.171:8581 plus your url of #whats-new-in-313, giving
http://192.168.0.171:8581/#whats-new-in-313
And that page does not exist.

To solve this problem, you must hardcode your website into the file, so that the file has an absolute url stored, ie:
* [**Whats new in 3.1.3**](https://github.com/ztalbot2000/homebridge-cmd4/blob/master/CHANGELOG.md#whats-new-in-313)

@ztalbot2000
Copy link
Owner

Why does GitHub then say otherwise?https://gist.github.com/rachelhyman/b1f109155c9dafffe618

You say you are seeing my README.md from your homebridge server. Do you have another copy on your web server that I should go to in order to replicate this? I know this is a pain going back and forth, but I really try to understand the underlying architecture instead of just changing things to make them work.

ttfn,
John Talbot

@jsiegenthaler
Copy link
Author

Hi John
Here are the Steps to Reproduce:

  1. Open Homebridge UI in a Google Chrome (or any) browser. On my PC, my Homebridge is at http://192.168.0.171:8581/
  2. Go to the Plugins tab
  3. Select Homebridge Cmd4 and select Install Previous Version. Anything above v3.0.0 is fine, in my example I installed v3.1.2
  4. Wait for the install to complete
  5. Observe the popup screen titled "Update: homebridge-cmd4". You see the Change Log with a list of Whats new in x.x.x hyperlinks (Side Issue: Observe the spelling mistake: "Whats new" instead of What's new". "Whats" is an abbreviation of "What is" and as the i is removed, an apostrophe must be inserted)
  6. Hover the mouse over Whats new in 3.1.2, and read the URL showing in the bottom left hand corner of the Chrome browser window
  7. Observe that the displayed URL is "http://192.168.0.171:8581/#whats-new-in-312". This is because the current loaded page is http://192.168.0.171:8581/ and the hyperlink is stored as #whats-new-in-312, relative to the current page
  8. Click on the hyperlink to follow the URL to "Whats new in 3.1.2"
  9. As the URL is a relative URL, it takes you to http://192.168.0.171:8581/#whats-new-in-312, which is a page that does not exist on my Homebridge UI

As you can see, when following the Change Log popup in Homebridge, the relative URL is using Homebridge as the base, and thus the link to the Change Log entry fails.

To resolve this issue, you must store absolute URLs in the Change Log, so that they can be navigated to from the Homebridge UI

@jsiegenthaler
Copy link
Author

jsiegenthaler commented Feb 22, 2021

Here's another possibly related issue:
The popup when upgrading to a new version is very general and uninformative. It contains no information about the new version.

Steps to Reproduce:

  1. Open Homebridge UI in a Google Chrome (or any) browser. On my PC, my Homebridge is at http://192.168.0.171:8581/
  2. Go to the Plugins tab
  3. Click UPDATE on Homebridge Cmd4
  4. Observe that a popup appears with the following generic text:

Update: homebridge-cmd4
Release Notes
IOS 14 updated
Brought about by IOS 14 and the latest Homebridge changes, Cmd4 now follows the Homebridge Dynamic Plugin Template, with support for many new devices and characteristics too. Along with hopefully more concise documentation and some interesting new features, I hope you enjoy Cmd4 for years to come.

John Talbot


The above text is a generalized text and says nothing about any features in the version to be installed.
It appears every time a new version is released, but actually says nothing about what the new version will contain.

@ztalbot2000
Copy link
Owner

ztalbot2000 commented Feb 23, 2021 via email

@jsiegenthaler
Copy link
Author

jsiegenthaler commented Feb 23, 2021

Hi,

Homebridge is a webpage in the web browser, just like any other webpage.
You need to understand that the document being presented in Homebridge is shown on a website that is not the cmd4 home page, and thus relative links cannot work.
All you have to do is publish the correct absolute webpage address to go from the current Homebridge page to your page....

PS: Other plugins manage to do this perfectly well.

@ztalbot2000
Copy link
Owner

ztalbot2000 commented Feb 23, 2021 via email

@jsiegenthaler
Copy link
Author

Hi John

Please, this is not personal.
I make no decisions whatsoever about how your plugin works and what is displayed in Homebridge.
I am not responsible for Homebridge in any way, shape or form.
I never have been, and have no plans to be involved in the strategy of Homebridge.

I am not Mr Homebridge.

I am just a user of Homebridge, reporting something to the plugin developer that doesn't work properly with the plugin.
I understand how URLs and hyperlinks work, so I can point out that a hyperlink is broken because it is a relative hyperlink, and not an absolute hyperlink.
That's all.

To help you understand, here are my observations for other plugins that I use.
All these change logs all appear when the user clicks UPDATE but before he executes the actual update.

  • homebridge-airport-express-playing shows a change log in Homebridge, including valid absolute hyperlinks that point to the plugin's github page. All hyperlinks work as expected.

  • homebridge-camera-ffmpeg shows the a section of the change log in Homebridge, including valid absolute hyperlinks that point to the plugin's github page. All hyperlinks work as expected.

  • homebridge-cmd4 shows a change log in Homebridge, but all the hyperlinks are relative and not absolute, and thus all the hyperlinks lead nowhere. The hyperlinks are broken.

I observe identical behaviour on Homebridge in Chrome on Win10, on Safari on an Apple iPad.

@ztalbot2000
Copy link
Owner

ztalbot2000 commented Feb 23, 2021 via email

@ztalbot2000
Copy link
Owner

Am working on it. The examples you gave me are relative, but not to its own file, thus need a base url. Just saying.

@ztalbot2000
Copy link
Owner

I opened up issue #1098 in Homebridge-config-ui-x. Only because when I fix mine, they still have issues with theirs. It is also not fair that placing a full URL inside my Changelog, that includes a "#" anchor may cause their browser to go off of the page to GitHub for the document they already have in front of them. We shall see.

@ztalbot2000
Copy link
Owner

Odd, maybe auto closed as I submitted the fix to Cmd4 under commit cb8cfef. I have to figure out how to test this in UI-X without actually submitting, either way it will get picked up in a release coming soon.
Also submitted to Cmd4 is markDown-link-checker that the changelog passed before, but passes again with HTML relative URL's containing base HRefs instead of markdown relative links.

@ztalbot2000
Copy link
Owner

If you haven't already noticed, Homebridge-UI-x does not support inline relative links during upgrade. All the work I did was for nothing. I just tried this with 3.2.1. Essentially they do not handle a table of contents. As I put in a problem report with them. This is where it will stand.

Take care,
John Talbot

@ztalbot2000
Copy link
Owner

I'm added to a test git repo of mine a mark-down with
<base target="_self">
it appears to not alter the behaviour in GitHub, so I will try this on my next release of Cmd4.

ttfn,
John

@jsiegenthaler
Copy link
Author

FYI:
The issue also occurs on the GitHub app on an iPad

  1. Load the main homebridge-cmd4 home page
  2. Go to the Table of Contents
  3. Click the ChangeLog hyperlink, the document CHANGELOG.md opens
  4. Click any Whats new in x.x.x link
  5. Nothing happens. No document is opened, no url following occurs.

@ztalbot2000
Copy link
Owner

ztalbot2000 commented Feb 25, 2021 via email

@jsiegenthaler
Copy link
Author

jsiegenthaler commented Feb 25, 2021

Hello John

In the GitHub app, the internal relative references on the README.md page work.
Example: The hyperlinks in the Table of Contents that take you to a section within the same document work

So this Table of Contents link to Installation Details works:
https://github.com/ztalbot2000/homebridge-cmd4#installation-details

And the ChangeLog opens the CHANGELOG.md:
https://github.com/ztalbot2000/homebridge-cmd4/blob/master/CHANGELOG.md

However, once https://github.com/ztalbot2000/homebridge-cmd4/blob/master/CHANGELOG.md is opened, the relative links within CHANGELOG.md do nothing in the GitHub app

I don't know if this is a GitHub app limitation or not...

@ztalbot2000
Copy link
Owner

Try #2 failed. Let's face it, they don't support anything unless it takes you off the page. Maybe I'll put a disclaimer at the top to say if you are using HomeBridge-UI. Click here instead.

take care,
John Talbot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants