0 /*
1 * ISC License
2 * Copyright (c) 2023 RMF <rawmonk@firemail.cc>
3 */
4 #define CONFIG_STRING_LENGTH 1024
5 struct config {
6 unsigned int maximumBodyLength;
7 unsigned int maximumDisplayLength;
8 int certificateLifespan;
9 int certificateBits;
10 int maximumRedirects;
11 int maximumCachedPages;
12 int maximumHistorySize;
13 int imageParserScratchPad;
14 int enableHistory;
15 int enableSandbox;
16 int enableImage;
17 int enableHexViewer;
18 int enableXdg;
19 char searchEngineURL[CONFIG_STRING_LENGTH];
20 };
21 extern struct config config;
22
23 #ifdef CONFIG_INTERNAL
24 enum {
25 VALUE_STRING,
26 VALUE_INT
27 };
28
29 struct field {
30 char name[128];
31 int type;
32 void *ptr;
33 int restart;
34 };
35
36 static struct field fields[] = {
37 {"hexviewer.enabled", VALUE_INT, &config.enableHexViewer, 0},
38 {"image.enabled", VALUE_INT, &config.enableImage, 1},
39 #ifdef STATIC_ALLOC
40 {"image.scratchpad", VALUE_INT, &config.imageParserScratchPad, 1},
41 #endif
42 {"sandbox.enabled", VALUE_INT, &config.enableSandbox, 1},
43 {"xdg.enabled", VALUE_INT, &config.enableXdg, 1},
44 {"history.enabled", VALUE_INT, &config.enableHistory, 0},
45 {"certificate.bits", VALUE_INT, &config.certificateBits, 0},
46 {"certificate.expiration", VALUE_INT, &config.certificateLifespan, 0},
47 {"request.maxbody", VALUE_INT, &config.maximumBodyLength, 0},
48 {"request.maxdisplay", VALUE_INT, &config.maximumDisplayLength, 0},
49 {"request.maxredirects", VALUE_INT, &config.maximumRedirects, 0},
50 {"request.cachedpages", VALUE_INT, &config.maximumCachedPages, 0},
51 {"history.maxentries", VALUE_INT, &config.maximumHistorySize, 0},
52 {"search.url", VALUE_STRING, &config.searchEngineURL, 0},
53 };
54 #endif
55
56 int config_load();
57 int config_save();
58 int config_set_field(int id, const char *value);
59 int config_correction();
60