diff options
| author | xengineering <me@xengineering.eu> | 2025-04-15 21:30:26 +0200 | 
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-04-15 21:34:34 +0200 | 
| commit | d25c8e08ce6a977977e38365ace9af16acf09195 (patch) | |
| tree | c97b1ebaa2a742c4393117a1ac062ccf4baa6575 /fw/app/src | |
| parent | 11967efab73c43bc5b0c6da33c140dbab7baefa7 (diff) | |
| download | iot-contact-d25c8e08ce6a977977e38365ace9af16acf09195.tar iot-contact-d25c8e08ce6a977977e38365ace9af16acf09195.tar.zst iot-contact-d25c8e08ce6a977977e38365ace9af16acf09195.zip  | |
fw: app: http: Add dummy GET /settings.json
Diffstat (limited to 'fw/app/src')
| -rw-r--r-- | fw/app/src/http.c | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/fw/app/src/http.c b/fw/app/src/http.c index 08b59c1..081629b 100644 --- a/fw/app/src/http.c +++ b/fw/app/src/http.c @@ -91,6 +91,31 @@ static struct http_resource_detail_dynamic favicon_resource_detail = {  	.user_data = NULL,  }; +static int settings_handler( +	struct http_client_ctx *client, +	enum http_data_status status, +	const struct http_request_ctx *request_ctx, +	struct http_response_ctx *response_ctx, +	void *user_data +) { +	static const char dummy[] = "{\"syslog\":{\"target\":{\"ip\":\"fe80::1\"}}}\n"; +	response_ctx->body = (const uint8_t *)dummy; +	response_ctx->body_len = sizeof(dummy) - 1; +	response_ctx->final_chunk = true; +	response_ctx->status = HTTP_200_OK; + +	return 0; +} + +static struct http_resource_detail_dynamic settings_resource_detail = { +	.common = { +			.type = HTTP_RESOURCE_TYPE_DYNAMIC, +			.bitmask_of_supported_http_methods = BIT(HTTP_GET), +		}, +	.cb = settings_handler, +	.user_data = NULL, +}; +  static uint8_t websocket_read_buffer[1024];  struct http_resource_detail_websocket websocket_resource_detail = { @@ -112,6 +137,7 @@ HTTP_RESOURCE_DEFINE(websocket_resource, http_service, "/", &websocket_resource_  HTTP_RESOURCE_DEFINE(favicon_resource, http_service, "/favicon.ico", &favicon_resource_detail);  HTTP_RESOURCE_DEFINE(css_resource, http_service, "/simple.css", &css_resource_detail);  HTTP_RESOURCE_DEFINE(js_resource, http_service, "/iot-contact.js", &js_resource_detail); +HTTP_RESOURCE_DEFINE(settings_resource, http_service, "/settings.json", &settings_resource_detail);  int init_http_server(void) {  	LOG_DBG("Starting HTTP server");  | 
