summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ychat/Dockerfile4
-rw-r--r--ychat/html/input.html2
-rw-r--r--ychat/src/reqp.cpp15
3 files changed, 20 insertions, 1 deletions
diff --git a/ychat/Dockerfile b/ychat/Dockerfile
index 9b5eb48..8403ad3 100644
--- a/ychat/Dockerfile
+++ b/ychat/Dockerfile
@@ -64,7 +64,11 @@ RUN rm -f /app/mods/commands/yc_exec.so
# (yc_register's body is #ifdef DATABASE), so drop the dead register form and
# the register module from the image, and serve the guest login page
# (index_guest.html - no password field, no register link) as the start page.
+# The Options menu (options.html + yc_options) is likewise DB-only account
+# management (email/password), so drop it too; the Options link in the input
+# frame is hidden via the #ifndef DATABASE %%OPTIONS_LINK%% substitution.
RUN rm -f /app/html/register.html /app/mods/html/yc_register.so
+RUN rm -f /app/html/options.html /app/mods/html/yc_options.so
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
COPY etc/ychat.conf /app/etc/ychat.conf
diff --git a/ychat/html/input.html b/ychat/html/input.html
index 9f56d5c..14caca2 100644
--- a/ychat/html/input.html
+++ b/ychat/html/input.html
@@ -43,7 +43,7 @@
</div>
<div style="position: absolute; top: 29px;">
<a href='#' class="fancy" onclick="javascript:popup('colors.html?event=colors&tmpid=%%tmpid%%', 600, 480)">Colors</a>
- <a href='#' class="fancy" onclick="javascript:popup('options.html?event=options&tmpid=%%tmpid%%', 600, 480)">Options</a>
+ %%OPTIONS_LINK%%
<a href='#' class="fancy" onclick="javascript:popup('help.html?event=help&tmpid=%%tmpid%%', 600, 480)">Help</a>
<a href='#' class="fancy" onclick="javascript:popup('loggedin.html?event=loggedin&tmpid=%%tmpid%%', 600, 480)">Users</a>
<a href='#' class="fancy" onclick="javascript:popup('admin.html?event=admin&tmpid=%%tmpid%%', 600, 480)">Admin</a>
diff --git a/ychat/src/reqp.cpp b/ychat/src/reqp.cpp
index 907161d..ab815b4 100644
--- a/ychat/src/reqp.cpp
+++ b/ychat/src/reqp.cpp
@@ -139,6 +139,21 @@ reqp::parse(context *p_context)
}
}
+ // Build-aware account-options link. The Options menu (options.html +
+ // yc_options) only makes sense with a database (it sets the user's
+ // email/password); without one it is non-persistent and misleading (a guest
+ // who sets a password can't log back in after being garbage-collected), so
+ // the no-DB build omits the link entirely (and the Dockerfile drops
+ // options.html + yc_options.so from the image). input.html renders
+ // %%OPTIONS_LINK%%.
+#ifdef DATABASE
+ map_params["OPTIONS_LINK"] =
+ "<a href='#' class='fancy' onclick=\"javascript:popup('options.html?"
+ "event=options&tmpid=" + map_params["tmpid"] + "', 600, 480)\">Options</a>";
+#else
+ map_params["OPTIONS_LINK"] = "";
+#endif
+
if ( wrap::CONF->get_elem("httpd.enablecgi").compare("true") == 0 &&
string::npos != map_params["request"].find(".cgi") )
{