-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a79b04
commit ce41072
Showing
5 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "Hakit", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"slug": "hakit", | ||
"init": false, | ||
"ingress": true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { Request, Response } from 'express'; | ||
import axios from 'axios'; | ||
import { translateError } from 'server/helpers/index.js'; | ||
|
||
interface Data { | ||
name?: string; | ||
slug?: string; | ||
hostname?: string; | ||
dns?: string[]; | ||
description?: string; | ||
long_description?: string; | ||
advanced?: boolean; | ||
stage?: string; | ||
repository?: string; | ||
version_latest?: string; | ||
protected?: boolean; | ||
rating?: number; | ||
boot?: string; | ||
options?: { | ||
html_file_path?: string; | ||
spa_mode?: boolean; | ||
custom_dashboard?: boolean; | ||
}; | ||
schema?: Array<{ | ||
name?: string; | ||
required?: boolean; | ||
type?: string; | ||
}>; | ||
arch?: string[]; | ||
machine?: any[]; | ||
homeassistant?: any; | ||
url?: string | null; | ||
detached?: boolean; | ||
available?: boolean; | ||
build?: boolean; | ||
network?: any; | ||
network_description?: any; | ||
host_network?: boolean; | ||
host_pid?: boolean; | ||
host_ipc?: boolean; | ||
host_uts?: boolean; | ||
host_dbus?: boolean; | ||
privileged?: any[]; | ||
full_access?: boolean; | ||
apparmor?: string; | ||
icon?: boolean; | ||
logo?: boolean; | ||
changelog?: boolean; | ||
documentation?: boolean; | ||
stdin?: boolean; | ||
hassio_api?: boolean; | ||
hassio_role?: string; | ||
auth_api?: boolean; | ||
homeassistant_api?: boolean; | ||
gpio?: boolean; | ||
usb?: boolean; | ||
uart?: boolean; | ||
kernel_modules?: boolean; | ||
devicetree?: boolean; | ||
udev?: boolean; | ||
docker_api?: boolean; | ||
video?: boolean; | ||
audio?: boolean; | ||
startup?: string; | ||
services?: any[]; | ||
discovery?: any[]; | ||
translations?: Record<string, any>; | ||
ingress?: boolean; | ||
signed?: boolean; | ||
state?: string; | ||
webui?: any; | ||
ingress_entry?: string; | ||
ingress_url?: string; | ||
ingress_port?: number; | ||
ingress_panel?: boolean; | ||
audio_input?: any; | ||
audio_output?: any; | ||
auto_update?: boolean; | ||
ip_address?: string; | ||
version?: string; | ||
update_available?: boolean; | ||
watchdog?: boolean; | ||
devices?: any[]; | ||
} | ||
|
||
|
||
export async function getAddonInfo(_req: Request, res: Response) { | ||
// Function to get the ingress URL from Home Assistant API | ||
try { | ||
const response = await axios.get<{ | ||
data: Data; | ||
}>('http://hassio/addons/self/info', { | ||
headers: { | ||
'Authorization': `Bearer ${process.env.SUPERVISOR_TOKEN}` | ||
} | ||
}); | ||
return res.send({ | ||
status: typeof response?.data?.data !== 'undefined' ? 'success' : 'error', | ||
data: response?.data?.data | ||
}); | ||
} catch (error) { | ||
console.error('Error fetching ingress URL:', translateError(error)); | ||
} | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters