Skip to content

Commit

Permalink
remove unused pagesdir and imagesdir (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarning committed Jul 2, 2019
1 parent 320a444 commit 28541e7
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 42 deletions.
2 changes: 1 addition & 1 deletion openwrt/nodogsplash/files/etc/init.d/nodogsplash
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ generate_uci_config() {

for option in preauth binauth fasport fasremoteip faspath fas_secure_enabled \
daemon debuglevel maxclients gatewayname gatewayinterface gatewayiprange \
gatewayaddress gatewayport webroot splashpage statuspage imagesdir pagesdir \
gatewayaddress gatewayport webroot splashpage statuspage \
redirecturl sessiontimeout preauthidletimeout authidletimeout checkinterval \
setmss mssvalue trafficcontrol downloadlimit uploadlimit \
syslogfacility ndsctlsocket fw_mark_authenticated \
Expand Down
8 changes: 0 additions & 8 deletions resources/nodogsplash.conf
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,6 @@ FirewallRuleSet users-to-router {
#
# GatewayIPRange 0.0.0.0/0

# Parameter: ImagesDir
# Default: images
#
# Set the directory from which images are served.
# Use $imagesdir in HTML files to reference this directory.
#
# ImagesDir images

# Parameter: DebugLevel
# Default: 5
#
Expand Down
9 changes: 2 additions & 7 deletions resources/splash.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="shortcut icon" href="/$imagesdir/splash.jpg" type="image/x-icon">
<link rel="shortcut icon" href="/images/splash.jpg" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="/splash.css">

<title>$gatewayname Hotspot Gateway.</title>
Expand All @@ -29,9 +29,6 @@
(including .css and .js).
Prohibit the execution of javascript.
Also, note that any images you reference should reside in the
subdirectory that is defined by $imagesdir (default: "images").
Authentication:
A client is authenticated on submitting an HTTP form, method=get,
passing $authaction, $tok and $redir.
Expand All @@ -57,8 +54,6 @@
nclients: $nclients
maxclients: $maxclients
uptime: $uptime
imagesdir: $imagesdir
pagesdir: $pagesdir
Additional Variables that can be passed back via the HTTP get,
or appended to the query string of the authtarget link:
Expand All @@ -73,7 +68,7 @@
<med-blue>$gatewayname Hotspot Gateway.</med-blue>
<div class="insert">
<br>
<img src="$imagesdir/splash.jpg" alt="Splash Page: For access to the Internet, please click Continue.">
<img src="/images/splash.jpg" alt="Splash Page: For access to the Internet, please click Continue.">
<hr>
<big-red>Welcome!</big-red>
<hr>
Expand Down
4 changes: 2 additions & 2 deletions resources/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="shortcut icon" href="/$imagesdir/splash.jpg" type="image/x-icon">
<link rel="shortcut icon" href="/images/splash.jpg" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="/splash.css">

<title>$gatewayname Hotspot Gateway Status</title>
Expand All @@ -29,7 +29,7 @@
<med-blue>$gatewayname Hotspot Gateway.</med-blue>
<div class="insert">
<br>
<img src="$imagesdir/splash.jpg" alt="You are already logged in and have access to the Internet.">
<img src="/images/splash.jpg" alt="You are already logged in and have access to the Internet.">
<hr>
<p><big-red>You are already logged in and have access to the Internet.</big-red></p>
<hr>
Expand Down
12 changes: 0 additions & 12 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ typedef enum {
oWebRoot,
oSplashPage,
oStatusPage,
oImagesDir,
oPagesDir,
oRedirectURL,
oPreauthIdleTimeout,
oAuthIdleTimeout,
Expand Down Expand Up @@ -136,8 +134,6 @@ static const struct {
{ "webroot", oWebRoot },
{ "splashpage", oSplashPage },
{ "statuspage", oStatusPage },
{ "imagesdir", oImagesDir },
{ "pagesdir", oPagesDir },
{ "redirectURL", oRedirectURL },
{ "preauthidletimeout", oPreauthIdleTimeout },
{ "authidletimeout", oAuthIdleTimeout },
Expand Down Expand Up @@ -211,8 +207,6 @@ config_init(void)
config.webroot = safe_strdup(DEFAULT_WEBROOT);
config.splashpage = safe_strdup(DEFAULT_SPLASHPAGE);
config.statuspage = safe_strdup(DEFAULT_STATUSPAGE);
config.imagesdir = safe_strdup(DEFAULT_IMAGESDIR);
config.pagesdir = safe_strdup(DEFAULT_PAGESDIR);
config.authdir = safe_strdup(DEFAULT_AUTHDIR);
config.denydir = safe_strdup(DEFAULT_DENYDIR);
config.preauthdir = safe_strdup(DEFAULT_PREAUTHDIR);
Expand Down Expand Up @@ -837,12 +831,6 @@ config_read(const char *filename)
case oStatusPage:
config.statuspage = safe_strdup(p1);
break;
case oImagesDir:
config.imagesdir = safe_strdup(p1);
break;
case oPagesDir:
config.pagesdir = safe_strdup(p1);
break;
case oRedirectURL:
config.redirectURL = safe_strdup(p1);
break;
Expand Down
4 changes: 0 additions & 4 deletions src/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
#define DEFAULT_WEBROOT "/etc/nodogsplash/htdocs"
#define DEFAULT_SPLASHPAGE "splash.html"
#define DEFAULT_STATUSPAGE "status.html"
#define DEFAULT_IMAGESDIR "images"
#define DEFAULT_PAGESDIR "pages"
#define DEFAULT_AUTHDIR "nodogsplash_auth"
#define DEFAULT_DENYDIR "nodogsplash_deny"
#define DEFAULT_PREAUTHDIR "nodogsplash_preauth"
Expand Down Expand Up @@ -161,8 +159,6 @@ typedef struct {
char *webroot; /**< @brief Directory containing splash pages, etc. */
char *splashpage; /**< @brief Name of main splash page */
char *statuspage; /**< @brief Name of info status page */
char *imagesdir; /**< @brief Subdir of webroot containing .png .gif files etc */
char *pagesdir; /**< @brief Subdir of webroot containing other .html files */
char *redirectURL; /**< @brief URL to direct client to after authentication */
char *authdir; /**< @brief Notional relative dir for authentication URL */
char *denydir; /**< @brief Notional relative dir for denial URL */
Expand Down
8 changes: 0 additions & 8 deletions src/http_microhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,6 @@ static void replace_variables(
char *denyaction = NULL;
char *authaction = NULL;
char *authtarget = NULL;
char *imagesdir = NULL;
char *pagesdir = NULL;

sprintf(clientupload, "%llu", client->counters.outgoing);
sprintf(clientdownload, "%llu", client->counters.incoming);
Expand All @@ -1041,8 +1039,6 @@ static void replace_variables(
safe_asprintf(&authaction, "http://%s/%s/", config->gw_address, config->authdir);
safe_asprintf(&authtarget, "http://%s/%s/?tok=%s&amp;redir=%s",
config->gw_address, config->authdir, client->token, redirect_url);
safe_asprintf(&pagesdir, "/%s", config->pagesdir);
safe_asprintf(&imagesdir, "/%s", config->imagesdir);

struct template vars[] = {
{"authaction", authaction},
Expand All @@ -1054,8 +1050,6 @@ static void replace_variables(
{"clientdownload", clientdownload},
{"gatewaymac", config->gw_mac},
{"gatewayname", config->gw_name},
{"imagesdir", imagesdir},
{"pagesdir", pagesdir},
{"maxclients", maxclients},
{"nclients", nclients},
{"redir", redirect_url},
Expand All @@ -1071,8 +1065,6 @@ static void replace_variables(
free(denyaction);
free(authaction);
free(authtarget);
free(pagesdir);
free(imagesdir);
}

static int show_templated_page(struct MHD_Connection *connection, t_client *client, const char *page)
Expand Down

0 comments on commit 28541e7

Please sign in to comment.