Skip to content

Commit f07030c

Browse files
committed
setting http api
1 parent 8c0d7f3 commit f07030c

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

src/views/GeneralConfig.vue

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,75 @@
109109
</openwb-base-alert>
110110
</div>
111111
</div>
112+
<div v-if="!installAssistantActive">
113+
<openwb-base-button-group-input
114+
title="HTTP-API"
115+
:buttons="[
116+
{
117+
buttonValue: false,
118+
text: 'Aus',
119+
class: 'btn-outline-danger',
120+
},
121+
{
122+
buttonValue: true,
123+
text: 'An',
124+
class: 'btn-outline-success',
125+
},
126+
]"
127+
:model-value="
128+
$store.state.mqtt['openWB/general/http_api']
129+
"
130+
@update:model-value="
131+
updateState('openWB/general/http_api', $event)
132+
"
133+
>
134+
<template #help>
135+
Mit der HTTP-API kann man den Wert eines MQTT-Topics
136+
per HTTP GET oder POST abfragen. Ein Zugriff ist nur
137+
lesend möglich, nicht schreibend.<br />
138+
GET-Request:
139+
<a
140+
:href="`http://${getIpAddress()}:8080/?topic=openWB/system/time`"
141+
target="_blank"
142+
rel="noopener noreferrer"
143+
>
144+
http://{{
145+
getIpAddress()
146+
}}:8080/?topic=openWB/system/time </a
147+
><br />
148+
Verschlüsselter GET-Request:
149+
<a
150+
:href="`https://${getIpAddress()}:8443/?topic=openWB/system/time`"
151+
target="_blank"
152+
rel="noopener noreferrer"
153+
>
154+
https://{{
155+
getIpAddress()
156+
}}:8443/?topic=openWB/system/time
157+
</a>
158+
<br />
159+
POST-Request mit curl:
160+
<openwb-base-copy-to-clipboard
161+
class="text-info"
162+
tooltip="Topic kopieren"
163+
>curl -X POST --data "topic=openWB/system/time"
164+
http://{{
165+
getIpAddress()
166+
}}:8080/</openwb-base-copy-to-clipboard
167+
>
168+
Verschlüsselter POST-Request über curl mit privatem
169+
SSL-Zertifikat:
170+
<openwb-base-copy-to-clipboard
171+
class="text-info"
172+
tooltip="Topic kopieren"
173+
>curl -k -X POST --data
174+
"topic=openWB/system/time" https://{{
175+
getIpAddress()
176+
}}:8080/</openwb-base-copy-to-clipboard
177+
><br />
178+
</template>
179+
</openwb-base-button-group-input>
180+
</div>
112181
</openwb-base-card>
113182
<openwb-base-card title="Hardware">
114183
<div v-if="$store.state.mqtt['openWB/general/extern'] === true">
@@ -594,6 +663,7 @@ export default {
594663
"openWB/general/extern",
595664
"openWB/general/control_interval",
596665
"openWB/general/grid_protection_configured",
666+
"openWB/general/http_api",
597667
"openWB/general/external_buttons_hw",
598668
"openWB/general/modbus_control",
599669
"openWB/general/notifications/selected",
@@ -608,6 +678,7 @@ export default {
608678
"openWB/general/web_theme",
609679
"openWB/system/configurable/ripple_control_receivers",
610680
"openWB/system/configurable/web_themes",
681+
"openWB/system/ip_address",
611682
],
612683
};
613684
},
@@ -642,6 +713,9 @@ export default {
642713
},
643714
},
644715
methods: {
716+
getIpAddress() {
717+
return this.$store.state.mqtt["openWB/system/ip_address"];
718+
},
645719
getWebThemeDefaults(webThemeType) {
646720
const webThemeDefaults = this.webThemeList.find(
647721
(element) => element.value == webThemeType,

0 commit comments

Comments
 (0)