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

Different URLs based on where you open homer #726

Open
Cyberbeni opened this issue Dec 5, 2023 · 2 comments
Open

Different URLs based on where you open homer #726

Cyberbeni opened this issue Dec 5, 2023 · 2 comments

Comments

@Cyberbeni
Copy link

Is your feature request related to a problem? Please describe.

I'm accessing my homer dashboard from both my computer and my iOS/iPadOS devices from both my home network and through tailscale. It would be nice to have different urls based on those conditions.

Describe the solution you'd like

Links with same host and different port, so if I want to open HomeAssistant on port 8123, it uses either 192.168.x.y or myserver.tailscale.net as the host (whichever I'm using to access the page) and gets the rest of the url from the config. (relevant SO question I've found)

It would be also nice if iOS could have the deeplink to the iOS app for HomeAssistant ( https://home-assistant.io/ios/ ) and everywhere else would have the url for my local server. (And probably another configuration for Android)

Describe alternatives you've considered-

Additional context

@glebkrapivin
Copy link

+1

I have exactly the same request

@glebkrapivin
Copy link

glebkrapivin commented Jan 19, 2024

@Cyberbeni

Hey!

I am by no means a js coder, but didn't wanna wait.

If you navigate to /src/components/Service.vue and add three lines (shown below), then docker build... - it would work :)

<template>
  <component :is="component" :item="item" :proxy="proxy"></component>
</template>

<script>
import {defineAsyncComponent} from "vue";
import Generic from "./services/Generic.vue";

export default {
  name: "Service",
  props: {
    item: Object,
    proxy: Object,
  },
  computed: {
    component() {

      const type = this.item.type || "Generic";
      if (type === "Generic") {
# -------------------------------- start here ------------------------------------
        if (this.item.url.startsWith('/') || this.item.url.startsWith(':')) {
          this.item.url = window.location.protocol + '//' + window.location.hostname + this.item.url
       }
# -------------------------------- end here -------------------------------------
        return Generic;
      }
      return defineAsyncComponent(() => import(`./services/${type}.vue`));
    },
  },
};
</script>

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

No branches or pull requests

2 participants