commit
3b4c872ea6
|
@ -154,6 +154,7 @@ void modesInitConfig(void) {
|
|||
Modes.net_fatsv_port = MODES_NET_OUTPUT_FA_TSV_PORT;
|
||||
Modes.interactive_rows = getTermRows();
|
||||
Modes.interactive_display_ttl = MODES_INTERACTIVE_DISPLAY_TTL;
|
||||
Modes.html_dir = HTMLPATH;
|
||||
Modes.json_interval = 1000;
|
||||
Modes.json_location_accuracy = 1;
|
||||
Modes.maxRange = 1852 * 300; // 300NM default max range
|
||||
|
@ -713,6 +714,7 @@ void showHelp(void) {
|
|||
"--quiet Disable output to stdout. Use for daemon applications\n"
|
||||
"--show-only <addr> Show only messages from the given ICAO on stdout\n"
|
||||
"--ppm <error> Set receiver error in parts per million (default 0)\n"
|
||||
"--html-dir <dir> Use <dir> as base directory for the internal HTTP server. Defaults to " HTMLPATH "\n"
|
||||
"--write-json <dir> Periodically write json output to <dir> (for serving by a separate webserver)\n"
|
||||
"--write-json-every <t> Write json output every t seconds (default 1)\n"
|
||||
"--json-location-accuracy <n> Accuracy of receiver location in json metadata: 0=no location, 1=approximate, 2=exact\n"
|
||||
|
@ -1060,6 +1062,8 @@ int main(int argc, char **argv) {
|
|||
Modes.interactive_rtl1090 = 1;
|
||||
} else if (!strcmp(argv[j],"--oversample")) {
|
||||
Modes.oversample = 1;
|
||||
} else if (!strcmp(argv[j], "--html-dir") && more) {
|
||||
Modes.html_dir = strdup(argv[++j]);
|
||||
#ifndef _WIN32
|
||||
} else if (!strcmp(argv[j], "--write-json") && more) {
|
||||
Modes.json_dir = strdup(argv[++j]);
|
||||
|
|
|
@ -325,6 +325,7 @@ struct { // Internal state
|
|||
int interactive_rtl1090; // flight table in interactive mode is formatted like RTL1090
|
||||
char *json_dir; // Path to json base directory, or NULL not to write json.
|
||||
uint64_t json_interval; // Interval between rewriting the json aircraft file, in milliseconds; also the advertised map refresh interval
|
||||
char *html_dir; // Path to www base directory.
|
||||
int json_location_accuracy; // Accuracy of location metadata: 0=none, 1=approx, 2=exact
|
||||
int throttle; // When reading from a file, throttle file playback to realtime?
|
||||
|
||||
|
|
10
net_io.c
10
net_io.c
|
@ -1315,15 +1315,15 @@ static int handleHTTPRequest(struct client *c, char *p) {
|
|||
char getFile[1024];
|
||||
|
||||
if (strlen(url) < 2) {
|
||||
snprintf(getFile, sizeof getFile, "%s/gmap.html", HTMLPATH); // Default file
|
||||
snprintf(getFile, sizeof getFile, "%s/gmap.html", Modes.html_dir); // Default file
|
||||
} else {
|
||||
snprintf(getFile, sizeof getFile, "%s/%s", HTMLPATH, url);
|
||||
snprintf(getFile, sizeof getFile, "%s/%s", Modes.html_dir, url);
|
||||
}
|
||||
|
||||
if (!realpath(getFile, rp))
|
||||
rp[0] = 0;
|
||||
if (!realpath(HTMLPATH, hrp))
|
||||
strcpy(hrp, HTMLPATH);
|
||||
if (!realpath(Modes.html_dir, hrp))
|
||||
strcpy(hrp, Modes.html_dir);
|
||||
|
||||
clen = -1;
|
||||
content = strdup("Server error occured");
|
||||
|
@ -1342,7 +1342,7 @@ static int handleHTTPRequest(struct client *c, char *p) {
|
|||
|
||||
if (clen < 0) {
|
||||
content = realloc(content, 128);
|
||||
clen = snprintf(content, 128,"Error opening HTML file: %s", strerror(errno));
|
||||
clen = snprintf(content, 128, "Error opening HTML file: %s", strerror(errno));
|
||||
statuscode = 404;
|
||||
statusmsg = "Not Found";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue