Compare commits

..
Author SHA1 Message Date
deepend 0ad7b3c03e fix tls unsupported issue on windows 2026-09-30 13:34:46 -06:00
deepend 8db6e7569f test first start experience 2026-09-30 13:34:46 -06:00
deepend-tildeclub edf268dc0f Merge pull request #404 from ZoiteChat/run-as-root
Block root unless --run-as-root
2026-09-30 10:23:51 -07:00
deepend e03ea59f3c Block root unless --run-as-root 2026-09-30 10:42:28 -06:00
deepend f0b2840668 ensure fixes added to main site are reflected on docs site 2026-09-29 15:33:41 -06:00
14 changed files with 2977 additions and 21 deletions
+55
View File
@@ -78,6 +78,11 @@ a {
text-decoration: none;
}
::selection {
background: var(--accent);
color: #fff8ea;
}
button,
input,
textarea,
@@ -139,6 +144,7 @@ select {
z-index: 2000;
border-bottom: 3px solid var(--rule);
background: rgba(238, 229, 211, 0.94);
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}
@@ -231,6 +237,17 @@ select {
font-weight: 900;
}
.site-nav a[aria-current="page"] {
border-block-color: var(--rule);
background: var(--panel-dark);
color: var(--paper-warm);
box-shadow: inset 0 -0.3rem 0 var(--accent);
}
.site-nav a[aria-current="page"]::before {
color: #d19b25;
}
.site-nav a:hover,
.site-nav a:focus-visible {
border-block-color: var(--rule);
@@ -511,6 +528,7 @@ select {
font-weight: 900;
line-height: 1.18;
box-shadow: 4px 4px 0 var(--rule);
touch-action: manipulation;
transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
@@ -527,6 +545,11 @@ select {
outline: none;
}
.button:active {
transform: translate(3px, 3px);
box-shadow: none;
}
.button-primary {
background: var(--accent);
color: #fff8ea;
@@ -1176,6 +1199,11 @@ select {
color: rgba(255, 248, 234, 0.82);
}
.footer-links a {
width: fit-content;
border-bottom: 1px solid transparent;
}
.footer-links a::before {
color: #d19b25;
content: "↳ ";
@@ -1184,6 +1212,7 @@ select {
.footer-links a:hover,
.footer-links a:focus-visible {
color: #fff8ea;
border-bottom-color: currentColor;
outline: none;
}
@@ -1549,6 +1578,17 @@ body a {
font-weight: 900 !important;
}
#navbar-top .site-nav a[aria-current="page"] {
border-block-color: var(--rule) !important;
background: var(--panel-dark) !important;
color: var(--paper-warm) !important;
box-shadow: inset 0 -0.3rem 0 var(--accent) !important;
}
#navbar-top .site-nav a[aria-current="page"]::before {
color: #d19b25 !important;
}
#navbar-top .site-nav a:hover,
#navbar-top .site-nav a:focus-visible,
#navbar-top .site-nav summary:hover,
@@ -1735,6 +1775,7 @@ footer.site-footer-lite {
}
.document .body p {
max-width: 78ch;
margin: 0 0 1rem !important;
}
@@ -1780,6 +1821,7 @@ ul.search a:focus-visible {
.document .body ul,
.document .body ol {
max-width: 78ch;
margin: 0.75rem 0 1.4rem !important;
padding-left: 1.35rem !important;
}
@@ -1929,6 +1971,11 @@ ul.search a:focus-visible {
text-transform: uppercase !important;
}
.document .body table tbody tr:hover td,
.document .body table tbody tr:focus-within td {
background: var(--accent-soft) !important;
}
.admonition,
.note,
.warning,
@@ -2068,6 +2115,7 @@ input[type="submit"],
line-height: 1.18 !important;
text-shadow: none !important;
box-shadow: 4px 4px 0 var(--rule) !important;
touch-action: manipulation;
}
.btn:hover,
@@ -2083,6 +2131,13 @@ input[type="submit"]:focus-visible {
outline: none !important;
}
.btn:active,
button:active,
input[type="submit"]:active {
transform: translate(3px, 3px) !important;
box-shadow: none !important;
}
#navbar-related {
min-height: auto !important;
margin: 1rem 0 1.5rem !important;
+1 -1
View File
@@ -264,7 +264,7 @@
<a href="https://zoitechat.org/addons.php">Addons</a>
<a href="https://zoitechat.org/announcements.php">Announcements</a>
<a href="https://zoitechat.org/download.php">Download</a>
<a href="{{ pathto(master_doc) }}">Docs</a>
<a href="{{ pathto(master_doc) }}" aria-current="page">Docs</a>
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">GitHub</a>
<details class="nav-menu">
<summary>IRC Support</summary>
+2
View File
@@ -430,6 +430,8 @@ const struct prefs vars[] =
{"gui_lang", P_OFFINT (hex_gui_lang), TYPE_INT},
{"gui_mode_buttons", P_OFFINT (hex_gui_mode_buttons), TYPE_BOOL},
{"gui_mode_buttons_inline", P_OFFINT (hex_gui_mode_buttons_inline), TYPE_BOOL},
{"gui_onboarding_disable", P_OFFINT (hex_gui_onboarding_disable), TYPE_BOOL},
{"gui_onboarding_pending", P_OFFINT (hex_gui_onboarding_pending), TYPE_BOOL},
{"gui_pane_divider_position", P_OFFINT (hex_gui_pane_divider_position), TYPE_INT},
{"gui_pane_left_size", P_OFFINT (hex_gui_pane_left_size), TYPE_INT},
{"gui_pane_right_size", P_OFFINT (hex_gui_pane_right_size), TYPE_INT},
+3
View File
@@ -70,6 +70,9 @@ void fe_add_rawlog (struct server *serv, char *text, int len, int outbound);
#define FE_MSG_ERROR 8
#define FE_MSG_MARKUP 16
void fe_message (char *msg, int flags);
#ifdef __linux__
void fe_root_warning (void);
#endif
#define FIA_READ 1
#define FIA_WRITE 2
#define FIA_EX 4
+16 -1
View File
@@ -191,6 +191,8 @@ struct defaultserver
gboolean ssl;
};
static gboolean servlist_needs_onboarding_flag;
static const struct defaultserver def[] =
{
{"2600net", 0},
@@ -1181,7 +1183,10 @@ servlist_load (void)
fp = zoitechat_fopen_file ("servlist.conf", "r", 0);
if (!fp)
{
servlist_needs_onboarding_flag = TRUE;
return FALSE;
}
while (fgets (buf, sizeof (buf) - 2, fp))
{
@@ -1245,6 +1250,7 @@ servlist_load (void)
net = servlist_net_add (buf + 2, NULL, FALSE);
}
fclose (fp);
servlist_needs_onboarding_flag = (network_list == NULL);
return TRUE;
}
@@ -1253,9 +1259,17 @@ void
servlist_init (void)
{
if (!network_list)
if (!servlist_load ())
{
if (!servlist_load () || !network_list)
servlist_load_defaults ();
}
}
gboolean
servlist_needs_onboarding (void)
{
return servlist_needs_onboarding_flag;
}
/* check if a charset is known by Iconv */
int
@@ -1395,6 +1409,7 @@ servlist_save (void)
}
fclose (fp);
servlist_needs_onboarding_flag = FALSE;
return TRUE;
}
+1
View File
@@ -93,6 +93,7 @@ extern GSList *network_list;
#define IRC_DEFAULT_CHARSET "UTF-8 (Unicode)"
void servlist_init (void);
gboolean servlist_needs_onboarding (void);
int servlist_save (void);
int servlist_cycle (server *serv);
void servlist_connect (session *sess, ircnet *net, gboolean join);
+21 -1
View File
@@ -95,6 +95,7 @@ int zoitechat_is_quitting = FALSE;
/* command-line args */
int arg_dont_autoconnect = FALSE;
int arg_skip_plugins = FALSE;
gint arg_run_as_root = FALSE;
char *arg_url = NULL;
char **arg_urls = NULL;
char *arg_command = NULL;
@@ -1175,6 +1176,25 @@ main (int argc, char *argv[])
HRESULT coinit_result;
#endif
#ifdef __linux__
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--") == 0)
break;
if (strcmp (argv[i], "--run-as-root") == 0)
{
arg_run_as_root = TRUE;
break;
}
}
if (geteuid () == 0 && !arg_run_as_root)
{
fe_root_warning ();
return EXIT_FAILURE;
}
#endif
srand ((unsigned int) time (NULL)); /* CL: do this only once! */
/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
@@ -1263,7 +1283,7 @@ main (int argc, char *argv[])
#ifndef WIN32
#ifndef __EMX__
/* OS/2 uses UID 0 all the time */
if (getuid () == 0)
if (getuid () == 0 && !arg_run_as_root)
fe_message (_("* Running IRC as root is stupid! You should\n"
" create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT);
#endif
+2
View File
@@ -134,6 +134,8 @@ struct zoitechatprefs
unsigned int hex_gui_join_dialog;
unsigned int hex_gui_mode_buttons;
unsigned int hex_gui_mode_buttons_inline;
unsigned int hex_gui_onboarding_disable;
unsigned int hex_gui_onboarding_pending;
unsigned int hex_gui_quit_dialog;
/* unsigned int hex_gui_single; */
unsigned int hex_gui_slist_fav;
+1
View File
@@ -25,6 +25,7 @@ extern struct zoitechatprefs prefs;
extern int zoitechat_is_quitting;
extern gint arg_skip_plugins; /* command-line args */
extern gint arg_dont_autoconnect;
extern gint arg_run_as_root;
extern char *arg_url;
extern char **arg_urls;
extern char *arg_command;
+30
View File
@@ -90,6 +90,9 @@ static const GOptionEntry gopt_entries[] =
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
#ifdef __linux__
{"run-as-root", 0, 0, G_OPTION_ARG_NONE, &arg_run_as_root, N_("Allow ZoiteChat to run as root (unsafe)"), NULL},
#endif
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"},
@@ -103,6 +106,33 @@ static const GOptionEntry gopt_entries[] =
{NULL}
};
#ifdef __linux__
void
fe_root_warning (void)
{
const char *message =
"ZoiteChat refuses to run as root on Linux.\n\n"
"Run it as a normal user, or pass --run-as-root to override this protection.";
GtkWidget *dialog;
g_printerr ("%s\n", message);
/* A graphical session may not be accessible to root, particularly under
* Wayland. Keep stderr as the fallback if GTK cannot open the display. */
if (!gtk_init_check (NULL, NULL))
return;
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", message);
gtk_window_set_title (GTK_WINDOW (dialog), "ZoiteChat");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
#endif
#ifdef WIN32
static void
create_msg_dialog (gchar *title, gchar *message)
+1
View File
@@ -95,6 +95,7 @@ zoitechat_gtk_ldflags = []
if host_machine.system() == 'windows'
zoitechat_gtk_sources += 'notifications/notification-windows.c'
zoitechat_gtk_deps += cc.find_library('dwmapi', required: true)
zoitechat_gtk_deps += cc.find_library('winhttp', required: true)
zoitechat_theme_deps += cc.find_library('dwmapi', required: true)
else
+2828 -18
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -648,6 +648,9 @@ static const char *const proxyuse[] =
static const setting network_settings[] =
{
{ST_HEADER, N_("Startup"), 0, 0, 0, 0},
{ST_TOGGLE, N_("Disable first-run assistant"), P_OFFINTNL(hex_gui_onboarding_disable), 0, 0, 0},
{ST_HEADER, N_("Your Address"), 0, 0, 0, 0},
{ST_ENTRY, N_("Bind to:"), P_OFFSETNL(hex_net_bind_host), 0, 0, sizeof prefs.hex_net_bind_host},
{ST_LABEL, N_("Only useful for computers with multiple addresses.")},
+13
View File
@@ -467,6 +467,9 @@ static const GOptionEntry gopt_entries[] =
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
#ifdef __linux__
{"run-as-root", 0, 0, G_OPTION_ARG_NONE, &arg_run_as_root, N_("Allow ZoiteChat to run as root (unsafe)"), NULL},
#endif
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel URL"), "URL"},
@@ -475,6 +478,16 @@ static const GOptionEntry gopt_entries[] =
{NULL}
};
#ifdef __linux__
void
fe_root_warning (void)
{
fputs ("ZoiteChat refuses to run as root on Linux.\n"
"Run it as a normal user, or pass --run-as-root to override this protection.\n",
stderr);
}
#endif
int
fe_args (int argc, char *argv[])
{