Skip to content

Commit

Permalink
Merge pull request #287 from nodogsplash/tmpl_vars
Browse files Browse the repository at this point in the history
rename uploadbytes/downloadbytes to clientupload/clientdownload
  • Loading branch information
mwarning committed Sep 3, 2018
2 parents c94d22b + ab884eb commit e1f7fb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions resources/splash.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
authtarget: $authtarget
clientip: $clientip
clientmac: $clientmac
clientupload: $clientupload
clientdownload: $clientdownload
gatewaymac: $gatewaymac
nclients: $nclients
maxclients: $maxclients
uptime: $uptime
imagesdir: $imagesdir
pagesdir: $pagesdir
uploadbytes: $uploadbytes
downloadbytes: $downloadbytes
Additional Variables that can also be passed back via HTTP get.
Or just append them to the authentication link:
Expand Down
15 changes: 7 additions & 8 deletions src/http_microhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,8 @@ static int show_templated_page(struct MHD_Connection *connection, t_client *clie
int size = 0, bytes = 0;
char nclients[12];
char maxclients[12];
char upload_bytes[20];
char download_bytes[20];
char clientupload[20];
char clientdownload[20];
int page_fd;
char *page_result;
char *page_tmpl;
Expand Down Expand Up @@ -944,8 +944,8 @@ static int show_templated_page(struct MHD_Connection *connection, t_client *clie
char *imagesdir = NULL;
char *pagesdir = NULL;

sprintf(upload_bytes, "%llu", client->counters.outgoing);
sprintf(download_bytes, "%llu", client->counters.incoming);
sprintf(clientupload, "%llu", client->counters.outgoing);
sprintf(clientdownload, "%llu", client->counters.incoming);

uptime = get_uptime_string();
redirect_url = get_redirect_url(connection);
Expand All @@ -961,20 +961,19 @@ static int show_templated_page(struct MHD_Connection *connection, t_client *clie

tmpl_init_templor(&templor);
tmpl_set_variable(&templor, "authaction", authaction);
tmpl_set_variable(&templor, "denyaction", denyaction);
tmpl_set_variable(&templor, "authtarget", authtarget);
tmpl_set_variable(&templor, "clientip", client->ip);
tmpl_set_variable(&templor, "clientmac", client->mac);
tmpl_set_variable(&templor, "denyaction", denyaction);
tmpl_set_variable(&templor, "clientupload", clientupload);
tmpl_set_variable(&templor, "clientdownload", clientdownload);

tmpl_set_variable(&templor, "gatewaymac", config->gw_mac);
tmpl_set_variable(&templor, "gatewayname", config->gw_name);

tmpl_set_variable(&templor, "imagesdir", imagesdir);
tmpl_set_variable(&templor, "pagesdir", pagesdir);

tmpl_set_variable(&templor, "uploadbytes", upload_bytes);
tmpl_set_variable(&templor, "downloadbytes", download_bytes);

tmpl_set_variable(&templor, "maxclients", maxclients);
tmpl_set_variable(&templor, "nclients", nclients);

Expand Down

0 comments on commit e1f7fb7

Please sign in to comment.