API CORS = *

This commit is contained in:
2022-11-24 02:00:20 +03:00
parent c70a4eaac9
commit 724eabc22f
12 changed files with 32 additions and 14 deletions

View File

@@ -3,4 +3,5 @@
-DWiz5100 -DWiz5100
#-DPID_DISABLE #-DPID_DISABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"

View File

@@ -10,7 +10,8 @@
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
-DMDNS_ENABLE -DMDNS_ENABLE
-DMCP23017 -DMCP23017
-DCORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DTIMER_INT -DTIMER_INT
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS

View File

@@ -46,5 +46,10 @@
-DFS_PREPARE -DFS_PREPARE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" #-D CORS=\"http://lazyhome.ru\"
-DOTA_PORT=80 -DOTA_PORT=80
-DMQTT_KEEPALIVE=10
-DMQTT_SOCKET_TIMEOUT=20
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"

View File

@@ -17,7 +17,8 @@
-DFS_PREPARE -DFS_PREPARE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
#-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80
#oct22 - violation in Publish/OnMQTTConnect while publish homie info #oct22 - violation in Publish/OnMQTTConnect while publish homie info

View File

@@ -34,5 +34,7 @@
#-DdebugSerialPort=Serial #-DdebugSerialPort=Serial
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" #-D CORS=\"http://lazyhome.ru\"
-DOTA_PORT=80 -DOTA_PORT=80
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"

View File

@@ -19,5 +19,6 @@
-DOTA -DOTA
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80

View File

@@ -7,5 +7,6 @@
-DMDNS_ENABLE -DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80

View File

@@ -7,5 +7,6 @@
-DMDNS_ENABLE -DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80

View File

@@ -20,7 +20,8 @@
-DMDNS_ENABLE -DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
# Example of UARTBRIDGE configuration # Example of UARTBRIDGE configuration
#-DUARTBRIDGE_ENABLE #-DUARTBRIDGE_ENABLE

View File

@@ -19,7 +19,8 @@
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
#-DMDNS_ENABLE #-DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80
-DHSV_DISABLE -DHSV_DISABLE
-DMULTIVENT_DISABLE -DMULTIVENT_DISABLE

View File

@@ -14,3 +14,5 @@
-DPID_DISABLE -DPID_DISABLE
#-DMCP23017 #-DMCP23017
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"

View File

@@ -247,9 +247,9 @@ uint16_t httpHandler(Client& client, String request, uint8_t method, long conten
ArduinoOTA.sendHttpResponse(client,301,false); // Send only HTTP header, no close socket ArduinoOTA.sendHttpResponse(client,301,false); // Send only HTTP header, no close socket
client.println( client.println(
#ifdef CORS #ifdef REDIRECTION_URL
//Redirect to cloud PWA application //Redirect to cloud PWA application
String(F("Location: " CORS "/pwa")) String(F("Location: " REDIRECTION_URL))
#else #else
String(F("Location: /index.html")) String(F("Location: /index.html"))
#endif #endif
@@ -924,6 +924,7 @@ void ip_ready_config_loaded_connecting_to_broker() {
if (mqttClient.connected()) if (mqttClient.connected())
{ {
//mqttClient.setKeepAlive(10);
lanStatus = RETAINING_COLLECTING; lanStatus = RETAINING_COLLECTING;
return; return;
} }