mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	preen
This commit is contained in:
		@@ -11,17 +11,15 @@ namespace captive_portal {
 | 
				
			|||||||
static const char *const TAG = "captive_portal";
 | 
					static const char *const TAG = "captive_portal";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CaptivePortal::handle_config(AsyncWebServerRequest *request) {
 | 
					void CaptivePortal::handle_config(AsyncWebServerRequest *request) {
 | 
				
			||||||
#ifdef USE_ESP8266
 | 
					 | 
				
			||||||
  AsyncResponseStream *stream = request->beginResponseStream(F("application/json"));
 | 
					  AsyncResponseStream *stream = request->beginResponseStream(F("application/json"));
 | 
				
			||||||
  stream->addHeader(F("cache-control"), F("public, max-age=0, must-revalidate"));
 | 
					  stream->addHeader(F("cache-control"), F("public, max-age=0, must-revalidate"));
 | 
				
			||||||
 | 
					#ifdef USE_ESP8266
 | 
				
			||||||
  stream->print(F("{\"mac\":\""));
 | 
					  stream->print(F("{\"mac\":\""));
 | 
				
			||||||
  stream->print(get_mac_address_pretty().c_str());
 | 
					  stream->print(get_mac_address_pretty().c_str());
 | 
				
			||||||
  stream->print(F("\",\"name\":\""));
 | 
					  stream->print(F("\",\"name\":\""));
 | 
				
			||||||
  stream->print(App.get_name().c_str());
 | 
					  stream->print(App.get_name().c_str());
 | 
				
			||||||
  stream->print(F("\",\"aps\":[{}"));
 | 
					  stream->print(F("\",\"aps\":[{}"));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  AsyncResponseStream *stream = request->beginResponseStream(F("application/json"));
 | 
					 | 
				
			||||||
  stream->addHeader(F("cache-control"), F("public, max-age=0, must-revalidate"));
 | 
					 | 
				
			||||||
  stream->printf(R"({"mac":"%s","name":"%s","aps":[{})", get_mac_address_pretty().c_str(), App.get_name().c_str());
 | 
					  stream->printf(R"({"mac":"%s","name":"%s","aps":[{})", get_mac_address_pretty().c_str(), App.get_name().c_str());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user