From 6995136704af8633ee9dc22a6d7e7786353b5688 Mon Sep 17 00:00:00 2001 From: Ari Date: Wed, 13 Apr 2022 14:27:20 -0400 Subject: [PATCH] updated autmation api --- config.yaml | 3 +-- webapp/src/apiService/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 7359006..c123e92 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ name: Shortumation -version: 0.0.7 +version: 0.0.7g2 slug: shortumation url: "https://github.com/asosnovsky/Shortumation" description: "A homeassitant addon which provides better UI for automations & scripts." @@ -16,7 +16,6 @@ ingress_port: 8000 ingress_entry: "web/" panel_icon: mdi:home-automation hassio_role: manager -auth_api: true privileged: - SYS_RAWIO host_network: true diff --git a/webapp/src/apiService/index.ts b/webapp/src/apiService/index.ts index b375ab3..e42b290 100644 --- a/webapp/src/apiService/index.ts +++ b/webapp/src/apiService/index.ts @@ -4,8 +4,12 @@ import { makeRemoteAPI } from "./base"; import { useAPIService } from './core'; import {useMockAPI} from "./mock"; +const locationPrefixWeb = window.location.pathname.match(/(.+)\/web/i); + export const useConnectedApiService = () => useAPIService( - makeAutomationAPI(makeRemoteAPI("/automations")) + makeAutomationAPI(makeRemoteAPI( + (!locationPrefixWeb ? '' : locationPrefixWeb[1]) + "/automations" + )) ); export const useMockApiService = (initialAutos: AutomationData[]) => useAPIService( makeAutomationAPI(useMockAPI(initialAutos))