-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add [homarr_base]
replacement for external urls
#2024
Conversation
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.
Hi 👋. Thank you for making your first contribution to Homarr. Please ensure that you've completed all the points in the TODO checklist. We'll review your changes shortly.
Thanks for this PR @j3lte ! I'm looking at it 👀 Edit: Nevermind I didn't properly understand the code at first sight 🤣 |
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.
Looks good to me ! Didn't get the time to test it on my own domain tho
Browser compatibility looks good too 👍🏼
https://developer.mozilla.org/en-US/docs/Web/API/Location/hostname#browser_compatibility
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.
There may be cases where the internal is http while the outside is https, so maybe this should also be an option?
[homarr_protocol]://[homarr_domain]
or directly [homarr_baseUrl]
@@ -26,6 +26,15 @@ export const AppTile = ({ className, app }: AppTileProps) => { | |||
.join(': '); | |||
|
|||
const isRow = app.appearance.positionAppName.includes('row'); | |||
const externalUrl = useMemo(() => { | |||
if (app.behaviour.externalUrl.length > 0) { | |||
if (app.behaviour.externalUrl.includes('://[homarr_domain]') && window.location.hostname) { |
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.
Doesn't work with subdomains if I read that correctly.
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.
Can you give me an example?
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.
Example homarr install on a subdomain would be homarr.domain.com
are you able to test that ? @j3lte
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.
Well, let's imagine homarr has "https://homarr.domain.com" and "https://homarr.localdomain.com", and sonarr is on "https://sonarr.domain.com" and "https://sonarr.localdomain.com", each being there depending if you're home or external.
You would then do "https://sonarr.[homarr_domain]" in the config.
They share domain but not the subdomain, and the subdomain is separating the domain from the "://", so testing for it means subdomains won't work. At least that's how I interpret it.
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.
Fair enough, unfortunately subdomain
is not part of window.location
. So in the case of "homar.domain.com", window.location.host
and window.location.hostname
are both "homar.domain.com", not "domain.com". Your proposal with both protocol and domain separated would work if homarr is at "domain.com" and sonar at "sonar.domain.com"
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.
[homarr_hostname] -> returns homarr's full base url including it's current subdomain
[homarr_domain] -> returns homarr's domain with subdomain filtered out
[homarr_protocol] -> return homarr's protocol (http/s)
[homarr_baseUrl] -> full address excluding port and path
You could manually filter out subdomains, but I agree it could be a bit of a pain.
I found this package that does it for you, and quite well at that: https://www.npmjs.com/package/tldts
It adds a new dependency but frankly we could use it to better format our URL's in integrations so it's fine.
I'm sorry if it may feel like I'm nagging for contributions, I just feel like your idea has that much potential and should be implemented to it's fullest.
If you want you can come by our discord to make things easier.
@SeDemal I don't think the internal one changes based on the external? As far as I know the only URL that is exposed is the external url.
Edit: @SeDemal you are absolutely right, I didn't think about that.... This should include the protocol. |
://[homarr_domain]
replacement for external urls[homarr_base]
replacement for external urls
Great! Can you make a PR on the docs repository so that people can learn about this ? We'd probably want to include it in the releases notes as well. you could also add a little [i] tip component, it should be easy to find how to do it in the code |
@ajnart will add a tooltip first, then the docs :) 👍 |
Not a tooltip, a tip is a component we made to display tips about advanced functionality someone wouldn't normally know about |
@ajnart something like this? |
Perfect position 🤩 |
Edit: added the translations |
My mistake, I said internal but wasn't talking about the internal address. I was talking about the address the user uses at home VS outside.
[homarr_base] is good, but you don't have to limit to one of them. |
Sorry you already took the time to do it, But never ever add another language than english, it breaks the system. |
Sorry, how does this break the system? The keys are there per language, I just added them to each of them... |
It doesn't break homarr, it breaks with the translation platform. |
This reverts commit a38770b.
@SeDemal done. It might be a good idea to document it somewhere (for example in the contribution guide) that you can't add translations. |
That's a fair point. |
Updated the functionality based on feedback from @SeDemal. I'm not completely satisfied with the tooltip (it contains a lot of text), but it does work as expected. Here's the updated functionality: |
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.
Can you revert your changes to .vscode/settings.json
and data/configs/default.json
?
Beside this this looks awesome ❤️🔥, thanks for your contribution 😃
@Meierschlumpf didn't notice I committed those changes as well... I reverted these 👍 |
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.
lgtm, @SeDemal for you as well?
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.
Comments are not that important, so you can disregard them if you really want.
Everything looks good now otherwise, great work.
Co-authored-by: SeDemal <Tagaishi@hotmail.ch>
Maybe we should also add the url parsing to the Category
|
@Meierschlumpf this probably needs a bit more testing. Currently it's using the internal |
Yes I saw there was an issue today about the internal / external url stuff. Maybe we could add a hook |
@Meierschlumpf see last commit, I rewrote the hook a little bit and added this to |
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.
Thanks for all the hard work, it's a great feature :)
…c270b55 by renovate (#21754) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/ajnart/homarr](https://github.com/ajnart/homarr) | patch | `0.15.2` -> `0.15.3` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>ajnart/homarr (ghcr.io/ajnart/homarr)</summary> ### [`v0.15.3`](https://github.com/ajnart/homarr/releases/tag/v0.15.3) [Compare Source](https://github.com/ajnart/homarr/compare/v0.15.2...v0.15.3) > \[!NOTE]\ > We've been working actively on working torwards version 1.0 which will include many improvements to performance, security and the overall look & feel of Homarr. It will greatly overhaul the technical architecture of Homarr. This work is done by volunteers. Please consider supporting our work via donations at https://opencollective.com/homarr #### Support for generic Home Assistant switches (lights, fans, ...) Want to toggle your kitchen lights or shut off the music? Using the brand new support for generic switches you can toggle now almost anything: ![homeassistant-lights](https://github.com/ajnart/homarr/assets/30572287/2cd79222-ca7d-4773-95e8-845cb382468c) #### Promox integration Homarr now features a Promox widget that can display CPU, RAM and more information directly on your dashboard: ![305290159-b6ed7b8a-335b-41d0-b5c8-8edb736db3ee](https://github.com/ajnart/homarr/assets/30572287/cfc6f949-16f8-4add-a4eb-668c258c3305) #### Tdarr widget Homarr now also integrates with Tdarr to display the status of your workers and the queue: ![Untitled](https://github.com/ajnart/homarr/assets/30572287/b368c4ae-7b6e-42d7-9bfc-58a110646dbe) #### Add placeholder for dynamic URLs When using advanced reverse proxy setups, sometimes the hostname is not known yet. We have added a new feature that enables you to replace certain placeholders: <img width="598" alt="326171056-a55c3e49-9cd6-4523-90cf-16e91b2c7502" src="https://github.com/ajnart/homarr/assets/30572287/53cf7469-586a-4fda-9dbf-3651cf3e2189"> #### Usability improvements to the torrent widget The torrent widget has received a major upgrade and should scale now better on most devices with improved customizability: ![image](https://github.com/ajnart/homarr/assets/30572287/8dbcd786-03ed-49da-b4ef-8a7b5b5bdd46) ![image](https://github.com/ajnart/homarr/assets/26098587/325ec664-c0cc-4cfa-bfb5-717d3674bda4) #### Other bugfixes - Fixed overlapping of the grid elements and the navbar - Fixed video playback for iOS and Apple devices - Fixed issues with the certificates for the avatars (this will also resolve issues with the page being shown as "not secure") #### What's Changed - fix: health monitoring hotfix by [@​hillaliy](https://github.com/hillaliy) in [ajnart/homarr#1970 - fix: change media request TV poster and movie name by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#1983 - fix: weather widget does not refresh automatically by [@​hillaliy](https://github.com/hillaliy) in [ajnart/homarr#1981 - fix: [#​1976](https://github.com/ajnart/homarr/issues/1976) lower debounce time by [@​manuel-rw](https://github.com/manuel-rw) in [ajnart/homarr#1979 - chore: new Crowdin updates by [@​ajnart](https://github.com/ajnart) in [ajnart/homarr#1968 - feat: add Proxmox integration/widget by [@​dslatt](https://github.com/dslatt) in [ajnart/homarr#1903 - feat: columns customize by [@​hillaliy](https://github.com/hillaliy) in [ajnart/homarr#1975 - feat: added playsInline to VideoBackground by [@​spkesDE](https://github.com/spkesDE) in [ajnart/homarr#1996 - fix: ping indicators floating above header in board customization page by [@​krishnamuppaneni](https://github.com/krishnamuppaneni) in [ajnart/homarr#1998 - fix: OIDC Timeout by [@​catrielmuller](https://github.com/catrielmuller) in [ajnart/homarr#2002 - fix: Pass axios error into log call for proxmox. Please include in v0.15.3 by [@​dslatt](https://github.com/dslatt) in [ajnart/homarr#2012 - feat: add romanian language support by [@​Meierschlumpf](https://github.com/Meierschlumpf) in [ajnart/homarr#2017 - fix: missing romanian language in next-i18next.config.js by [@​Meierschlumpf](https://github.com/Meierschlumpf) in [ajnart/homarr#2018 - feat: add Tdarr integration and widget by [@​jbruell](https://github.com/jbruell) in [ajnart/homarr#1882 - feat: torrent widget: polishing UI and improve popover interactions by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#2016 - fix: Modals titles nested headers and edit mode nested buttons errors by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#2019 - fix: Avatar host by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#2027 - feat: Home Assistant entity generic toggle by [@​tuggan](https://github.com/tuggan) in [ajnart/homarr#2015 - feat: add logout callback URL and session expiration environment variables by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#2023 - fix: ldap filters by [@​SeDemal](https://github.com/SeDemal) in [ajnart/homarr#2033 - chore: new Crowdin updates by [@​ajnart](https://github.com/ajnart) in [ajnart/homarr#1984 - feat: add `[homarr_base]` replacement for external urls by [@​j3lte](https://github.com/j3lte) in [ajnart/homarr#2024 - core: increase version to 0.15.3 by [@​Meierschlumpf](https://github.com/Meierschlumpf) in [ajnart/homarr#2007 #### New Contributors - [@​dslatt](https://github.com/dslatt) made their first contribution in [ajnart/homarr#1903 - [@​krishnamuppaneni](https://github.com/krishnamuppaneni) made their first contribution in [ajnart/homarr#1998 - [@​catrielmuller](https://github.com/catrielmuller) made their first contribution in [ajnart/homarr#2002 - [@​jbruell](https://github.com/jbruell) made their first contribution in [ajnart/homarr#1882 - [@​j3lte](https://github.com/j3lte) made their first contribution in [ajnart/homarr#2024 **Full Changelog**: ajnart/homarr@v0.15.2...v0.15.3 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNDkuMyIsInVwZGF0ZWRJblZlciI6IjM3LjM0OS4zIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImF1dG9tZXJnZSIsInVwZGF0ZS9kb2NrZXIvZ2VuZXJhbC9ub24tbWFqb3IiXX0=-->
It's a great feature. But it doesn't seem powerful enough. I use homarr. home-hub.pub/private.example.com as homarr domain name, use *.home-hub.pub/private.example.com as other services domain name. This cannot be done with existing variables. I think that Jinja is a better choice. Or simple string manipulation. Thanks! |
If you have a better solution, please provide a PR and maybe send this suggestion as a separate issue, instead of commenting on an old PR 😄 |
Thank you and sorry. It's my mistake. |
Category
Overview
Why?
I am using Homarr myself as a dashboard for my home server.
http://home-server-remote
(through Tailscale), where all other services are running on different ports.http://home-server
.Screenshot