mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Add POST /api/teleporter to upload and install backed up configuration
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -35,6 +35,7 @@ enum http_method {
|
||||
|
||||
struct api_options {
|
||||
bool domains :1;
|
||||
bool parse_json :1;
|
||||
enum fifo_logs which;
|
||||
};
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
#include "../cJSON/cJSON.h"
|
||||
#include "cJSON/cJSON.h"
|
||||
// logging routines
|
||||
#include "../log.h"
|
||||
#include "log.h"
|
||||
|
||||
#define JSON_NEW_OBJECT() cJSON_CreateObject();
|
||||
#define JSON_NEW_ARRAY() cJSON_CreateArray();
|
||||
@@ -243,4 +243,4 @@
|
||||
free(additional_headers); \
|
||||
return code; \
|
||||
})
|
||||
*/
|
||||
*/
|
||||
|
||||
+7
-5
@@ -8,17 +8,19 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
// ArraySize()
|
||||
#include "FTL.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
// strncpy()
|
||||
#include <string.h>
|
||||
#include "../log.h"
|
||||
#include "../ph7/ph7.h"
|
||||
#include "../civetweb/civetweb.h"
|
||||
#include "log.h"
|
||||
#include "ph7/ph7.h"
|
||||
#include "civetweb/civetweb.h"
|
||||
#include "ph7.h"
|
||||
// struct config.http
|
||||
#include "../config/config.h"
|
||||
#include "config/config.h"
|
||||
// mmap
|
||||
#include <sys/mman.h>
|
||||
// stat
|
||||
@@ -130,7 +132,7 @@ int ph7_handler(struct mg_connection *conn, void *cbdata)
|
||||
ph7_vm_config(pVm, PH7_VM_CONFIG_IMPORT_PATH, webroot_with_home_and_scripts);
|
||||
|
||||
// Register Pi-hole's PH7 extensions (defined in subdirectory "ph7_ext/")
|
||||
for(unsigned int i = 0; i < sizeof(aFunc)/sizeof(aFunc[0]); i++ )
|
||||
for(unsigned int i = 0; i < ArraySize(aFunc); i++ )
|
||||
{
|
||||
rc = ph7_create_function(pVm, aFunc[i].zName, aFunc[i].xProc, NULL /* NULL: No private data */);
|
||||
if( rc != PH7_OK ){
|
||||
|
||||
@@ -159,11 +159,11 @@ void http_init(void)
|
||||
// Add access control list if configured (last two options)
|
||||
if(strlen(config.webserver.acl.v.s) > 0)
|
||||
{
|
||||
options[(sizeof(options)/sizeof(*options)) - 3] = "access_control_list";
|
||||
options[ArraySize(options) - 3] = "access_control_list";
|
||||
// Note: The string is duplicated by CivetWeb, so it doesn't matter if
|
||||
// the original string is freed (config changes) after mg_start()
|
||||
// returns below.
|
||||
options[(sizeof(options)/sizeof(*options)) - 2] = config.webserver.acl.v.s;
|
||||
options[ArraySize(options) - 2] = config.webserver.acl.v.s;
|
||||
}
|
||||
|
||||
// Configure logging handlers
|
||||
|
||||
Reference in New Issue
Block a user