summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-30 23:10:53 +0300
committerPaul Buetow <paul@buetow.org>2026-06-30 23:10:53 +0300
commit6c3a65b577f002f3219d03498c66205434765179 (patch)
treec2d0b1219c7b23d43019bc3c6222a857652160ef
parent6cac7b461c8ffed5c995b86367ce67665aa95ee5 (diff)
No-DB build: hide/remove the Options menu (build-aware)
The Options menu (options.html + yc_options) manages the user's email and password - account settings that only persist with a database. Without one the menu is non-persistent and misleading (a guest who sets a password can't log back in after being garbage-collected, since the recycled-user login checks the password). Make it build-aware (#ifdef DATABASE): - html/input.html: the Options link is now %%OPTIONS_LINK%%. - src/reqp.cpp: set map_params[OPTIONS_LINK] to the link (built with the session tmpid) under #ifdef DATABASE, else empty. So a DB build keeps the Options link; the no-DB build hides it. - Dockerfile (no-DB build): drop options.html and yc_options.so from the image (the popup form and the options module are gone; an on-demand get_module for the options event fails gracefully -> no-op). Verified (no-DB): the input frame no longer shows an Options link (Colors, Help, Users, Logout remain); options.html -> 'Page not found'; yc_options.so absent; normal chat still works.
-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") )
{