mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-10-17 02:37:12 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d07b99fd6d | ||
|
|
eb093e07be | ||
|
|
16e69640e3 | ||
|
|
cd4863e773 | ||
|
|
edf268dc0f | ||
|
|
e03ea59f3c | ||
|
|
f0b2840668 |
@@ -35,7 +35,7 @@ jobs:
|
|||||||
libxkbcommon0 \
|
libxkbcommon0 \
|
||||||
libgtk-3-bin libglib2.0-bin glib-networking shared-mime-info gsettings-desktop-schemas \
|
libgtk-3-bin libglib2.0-bin glib-networking shared-mime-info gsettings-desktop-schemas \
|
||||||
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
||||||
perl python3 python3-minimal python3-dev python3-cffi mono-devel desktop-file-utils \
|
perl python3 python3-minimal python3-dev python3-cffi python3-sphinx mono-devel desktop-file-utils \
|
||||||
breeze-gtk-theme \
|
breeze-gtk-theme \
|
||||||
patchelf file curl
|
patchelf file curl
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install cffi
|
python -m pip install cffi
|
||||||
python -m pip install zstandard
|
python -m pip install zstandard
|
||||||
|
python -m pip install sphinx
|
||||||
|
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
function Download-WithRetry {
|
function Download-WithRetry {
|
||||||
|
|||||||
Vendored
+55
@@ -78,6 +78,11 @@ a {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff8ea;
|
||||||
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input,
|
input,
|
||||||
textarea,
|
textarea,
|
||||||
@@ -139,6 +144,7 @@ select {
|
|||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
border-bottom: 3px solid var(--rule);
|
border-bottom: 3px solid var(--rule);
|
||||||
background: rgba(238, 229, 211, 0.94);
|
background: rgba(238, 229, 211, 0.94);
|
||||||
|
-webkit-backdrop-filter: blur(8px);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,6 +237,17 @@ select {
|
|||||||
font-weight: 900;
|
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:hover,
|
||||||
.site-nav a:focus-visible {
|
.site-nav a:focus-visible {
|
||||||
border-block-color: var(--rule);
|
border-block-color: var(--rule);
|
||||||
@@ -511,6 +528,7 @@ select {
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
line-height: 1.18;
|
line-height: 1.18;
|
||||||
box-shadow: 4px 4px 0 var(--rule);
|
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;
|
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;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button:active {
|
||||||
|
transform: translate(3px, 3px);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
.button-primary {
|
.button-primary {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
color: #fff8ea;
|
color: #fff8ea;
|
||||||
@@ -1176,6 +1199,11 @@ select {
|
|||||||
color: rgba(255, 248, 234, 0.82);
|
color: rgba(255, 248, 234, 0.82);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-links a {
|
||||||
|
width: fit-content;
|
||||||
|
border-bottom: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.footer-links a::before {
|
.footer-links a::before {
|
||||||
color: #d19b25;
|
color: #d19b25;
|
||||||
content: "↳ ";
|
content: "↳ ";
|
||||||
@@ -1184,6 +1212,7 @@ select {
|
|||||||
.footer-links a:hover,
|
.footer-links a:hover,
|
||||||
.footer-links a:focus-visible {
|
.footer-links a:focus-visible {
|
||||||
color: #fff8ea;
|
color: #fff8ea;
|
||||||
|
border-bottom-color: currentColor;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1549,6 +1578,17 @@ body a {
|
|||||||
font-weight: 900 !important;
|
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:hover,
|
||||||
#navbar-top .site-nav a:focus-visible,
|
#navbar-top .site-nav a:focus-visible,
|
||||||
#navbar-top .site-nav summary:hover,
|
#navbar-top .site-nav summary:hover,
|
||||||
@@ -1735,6 +1775,7 @@ footer.site-footer-lite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.document .body p {
|
.document .body p {
|
||||||
|
max-width: 78ch;
|
||||||
margin: 0 0 1rem !important;
|
margin: 0 0 1rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1780,6 +1821,7 @@ ul.search a:focus-visible {
|
|||||||
|
|
||||||
.document .body ul,
|
.document .body ul,
|
||||||
.document .body ol {
|
.document .body ol {
|
||||||
|
max-width: 78ch;
|
||||||
margin: 0.75rem 0 1.4rem !important;
|
margin: 0.75rem 0 1.4rem !important;
|
||||||
padding-left: 1.35rem !important;
|
padding-left: 1.35rem !important;
|
||||||
}
|
}
|
||||||
@@ -1929,6 +1971,11 @@ ul.search a:focus-visible {
|
|||||||
text-transform: uppercase !important;
|
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,
|
.admonition,
|
||||||
.note,
|
.note,
|
||||||
.warning,
|
.warning,
|
||||||
@@ -2068,6 +2115,7 @@ input[type="submit"],
|
|||||||
line-height: 1.18 !important;
|
line-height: 1.18 !important;
|
||||||
text-shadow: none !important;
|
text-shadow: none !important;
|
||||||
box-shadow: 4px 4px 0 var(--rule) !important;
|
box-shadow: 4px 4px 0 var(--rule) !important;
|
||||||
|
touch-action: manipulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover,
|
.btn:hover,
|
||||||
@@ -2083,6 +2131,13 @@ input[type="submit"]:focus-visible {
|
|||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn:active,
|
||||||
|
button:active,
|
||||||
|
input[type="submit"]:active {
|
||||||
|
transform: translate(3px, 3px) !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
#navbar-related {
|
#navbar-related {
|
||||||
min-height: auto !important;
|
min-height: auto !important;
|
||||||
margin: 1rem 0 1.5rem !important;
|
margin: 1rem 0 1.5rem !important;
|
||||||
|
|||||||
Vendored
+3
-1
@@ -135,7 +135,9 @@
|
|||||||
{{ js_tag(scriptfile) }}
|
{{ js_tag(scriptfile) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
{%- if theme_theme_preview|tobool %}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/js/jquery.cookie.min.js', 1) }}"></script>
|
<script type="text/javascript" src="{{ pathto('_static/js/jquery.cookie.min.js', 1) }}"></script>
|
||||||
|
{%- endif %}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/js/basicstrap.js', 1) }}"></script>
|
<script type="text/javascript" src="{{ pathto('_static/js/basicstrap.js', 1) }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
DOCUMENTATION_OPTIONS.FILE_SUFFIX = DOCUMENTATION_OPTIONS.FILE_SUFFIX || '.html';
|
DOCUMENTATION_OPTIONS.FILE_SUFFIX = DOCUMENTATION_OPTIONS.FILE_SUFFIX || '.html';
|
||||||
@@ -264,7 +266,7 @@
|
|||||||
<a href="https://zoitechat.org/addons.php">Addons</a>
|
<a href="https://zoitechat.org/addons.php">Addons</a>
|
||||||
<a href="https://zoitechat.org/announcements.php">Announcements</a>
|
<a href="https://zoitechat.org/announcements.php">Announcements</a>
|
||||||
<a href="https://zoitechat.org/download.php">Download</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>
|
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">GitHub</a>
|
||||||
<details class="nav-menu">
|
<details class="nav-menu">
|
||||||
<summary>IRC Support</summary>
|
<summary>IRC Support</summary>
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def prune_unused_local_assets(output_dir):
|
||||||
|
index_path = os.path.join(output_dir, "index.html")
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(index_path, "r", encoding="utf-8") as index_file:
|
||||||
|
index_html = index_file.read()
|
||||||
|
except OSError:
|
||||||
|
return
|
||||||
|
|
||||||
|
if "bootswatch-" not in index_html:
|
||||||
|
for bootstrap_version in ("bootstrap2", "bootstrap3"):
|
||||||
|
css_dir = os.path.join(
|
||||||
|
output_dir, "_static", "css", bootstrap_version
|
||||||
|
)
|
||||||
|
if not os.path.isdir(css_dir):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for filename in os.listdir(css_dir):
|
||||||
|
if filename.startswith("bootswatch-") and filename.endswith(".css"):
|
||||||
|
os.remove(os.path.join(css_dir, filename))
|
||||||
|
|
||||||
|
if "jquery.cookie.min.js" not in index_html:
|
||||||
|
js_dir = os.path.join(output_dir, "_static", "js")
|
||||||
|
for filename in ("jquery.cookie.min.js", "jquery.cookie-1.4.1.min.js"):
|
||||||
|
path = os.path.join(js_dir, filename)
|
||||||
|
if os.path.isfile(path):
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
raise SystemExit("usage: build-docs.py SOURCE_DIR OUTPUT_DIR STAMP_FILE")
|
||||||
|
|
||||||
|
source_dir = os.path.abspath(sys.argv[1])
|
||||||
|
output_dir = os.path.abspath(sys.argv[2])
|
||||||
|
stamp_file = os.path.abspath(sys.argv[3])
|
||||||
|
doctree_dir = output_dir + ".doctrees"
|
||||||
|
|
||||||
|
shutil.rmtree(output_dir, ignore_errors=True)
|
||||||
|
shutil.rmtree(doctree_dir, ignore_errors=True)
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
sys.executable,
|
||||||
|
"-m",
|
||||||
|
"sphinx",
|
||||||
|
"-b",
|
||||||
|
"html",
|
||||||
|
"-d",
|
||||||
|
doctree_dir,
|
||||||
|
source_dir,
|
||||||
|
output_dir,
|
||||||
|
],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
prune_unused_local_assets(output_dir)
|
||||||
|
|
||||||
|
with open(stamp_file, "w", encoding="utf-8") as stamp:
|
||||||
|
stamp.write("built\n")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
raise SystemExit("usage: install-docs.py STAMP_FILE SOURCE_DIR DATADIR")
|
||||||
|
|
||||||
|
_, source_dir, datadir = sys.argv[1:]
|
||||||
|
source_dir = os.path.abspath(source_dir)
|
||||||
|
|
||||||
|
if not os.path.isfile(sys.argv[1]):
|
||||||
|
raise SystemExit("documentation build did not produce its stamp file")
|
||||||
|
if not os.path.isfile(os.path.join(source_dir, "index.html")):
|
||||||
|
raise SystemExit("documentation build did not produce index.html")
|
||||||
|
|
||||||
|
if os.path.isabs(datadir):
|
||||||
|
destdir = os.environ.get("DESTDIR", "")
|
||||||
|
if destdir:
|
||||||
|
data_root = os.path.join(destdir, datadir.lstrip("/\\"))
|
||||||
|
else:
|
||||||
|
data_root = datadir
|
||||||
|
else:
|
||||||
|
data_root = os.path.join(os.environ["MESON_INSTALL_DESTDIR_PREFIX"], datadir)
|
||||||
|
|
||||||
|
destination = os.path.join(data_root, "doc", "zoitechat", "html")
|
||||||
|
shutil.rmtree(destination, ignore_errors=True)
|
||||||
|
os.makedirs(os.path.dirname(destination), exist_ok=True)
|
||||||
|
shutil.copytree(source_dir, destination)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
],
|
],
|
||||||
"config-opts": [
|
"config-opts": [
|
||||||
"-Ddbus-service-use-appid=true",
|
"-Ddbus-service-use-appid=true",
|
||||||
|
"-Dinstall-docs=false",
|
||||||
"-Dwith-perl=perl",
|
"-Dwith-perl=perl",
|
||||||
"-Dwith-python=python3",
|
"-Dwith-python=python3",
|
||||||
"-Dwith-lua=lua"
|
"-Dwith-lua=lua"
|
||||||
|
|||||||
+38
@@ -35,6 +35,9 @@ config_h.set_quoted('PACKAGE_NAME', meson.project_name())
|
|||||||
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
||||||
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
||||||
get_option('datadir'), 'locale'))
|
get_option('datadir'), 'locale'))
|
||||||
|
config_h.set_quoted('ZOITECHAT_DOCDIR',
|
||||||
|
join_paths(get_option('prefix'), get_option('datadir'), 'doc', 'zoitechat', 'html')
|
||||||
|
)
|
||||||
config_h.set10('ENABLE_NLS', true)
|
config_h.set10('ENABLE_NLS', true)
|
||||||
config_h.set_quoted('ZOITECHAT_DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
|
config_h.set_quoted('ZOITECHAT_DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
|
||||||
|
|
||||||
@@ -161,6 +164,41 @@ foreach ldflag : test_ldflags
|
|||||||
endforeach
|
endforeach
|
||||||
add_project_link_arguments(global_ldflags, language: 'c')
|
add_project_link_arguments(global_ldflags, language: 'c')
|
||||||
|
|
||||||
|
if get_option('install-docs')
|
||||||
|
docs_python = find_program('python3', 'python')
|
||||||
|
docs_sphinx = run_command(docs_python, '-c', 'import sphinx', check: false)
|
||||||
|
if docs_sphinx.returncode() != 0
|
||||||
|
error('Sphinx is required to build the local HTML documentation. Install Sphinx or configure with -Dinstall-docs=false.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
docs_source_dir = join_paths(meson.source_root(), 'docs')
|
||||||
|
docs_output_dir = join_paths(meson.build_root(), 'docs-html')
|
||||||
|
docs_build_script = join_paths(docs_source_dir, 'build-docs.py')
|
||||||
|
docs_install_script = join_paths(docs_source_dir, 'install-docs.py')
|
||||||
|
|
||||||
|
docs_target = custom_target(
|
||||||
|
'html-documentation',
|
||||||
|
output: 'html-documentation.stamp',
|
||||||
|
command: [
|
||||||
|
docs_python,
|
||||||
|
docs_build_script,
|
||||||
|
docs_source_dir,
|
||||||
|
docs_output_dir,
|
||||||
|
'@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default: true,
|
||||||
|
build_always_stale: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.add_install_script(
|
||||||
|
docs_python,
|
||||||
|
docs_install_script,
|
||||||
|
docs_target,
|
||||||
|
docs_output_dir,
|
||||||
|
get_option('datadir'),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
if get_option('plugin')
|
if get_option('plugin')
|
||||||
subdir('plugins')
|
subdir('plugins')
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ option('install-appdata', type: 'boolean',
|
|||||||
option('install-plugin-metainfo', type: 'boolean', value: false,
|
option('install-plugin-metainfo', type: 'boolean', value: false,
|
||||||
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
|
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
|
||||||
)
|
)
|
||||||
|
option('install-docs', type: 'boolean', value: true,
|
||||||
|
description: 'Build and install the local HTML documentation'
|
||||||
|
)
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
option('with-checksum', type: 'boolean',
|
option('with-checksum', type: 'boolean',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ BuildRequires: perl
|
|||||||
BuildRequires: perl-devel
|
BuildRequires: perl-devel
|
||||||
BuildRequires: python3
|
BuildRequires: python3
|
||||||
BuildRequires: python3-cffi
|
BuildRequires: python3-cffi
|
||||||
|
BuildRequires: python3-sphinx
|
||||||
BuildRequires: publicsuffix-list
|
BuildRequires: publicsuffix-list
|
||||||
BuildRequires: xwayland-run
|
BuildRequires: xwayland-run
|
||||||
BuildRequires: weston
|
BuildRequires: weston
|
||||||
@@ -94,6 +95,7 @@ xwfb-run -- /usr/bin/meson test -C %{_vpath_builddir} --num-processes %{_smp_bui
|
|||||||
%{_datadir}/icons/hicolor/scalable/apps/net.zoite.Zoitechat.svg
|
%{_datadir}/icons/hicolor/scalable/apps/net.zoite.Zoitechat.svg
|
||||||
%{_datadir}/metainfo/net.zoite.Zoitechat.appdata.xml
|
%{_datadir}/metainfo/net.zoite.Zoitechat.appdata.xml
|
||||||
%{_datadir}/metainfo/net.zoite.Zoitechat*.metainfo.xml
|
%{_datadir}/metainfo/net.zoite.Zoitechat*.metainfo.xml
|
||||||
|
%{_datadir}/doc/zoitechat/html/
|
||||||
%dir %{_libdir}/zoitechat
|
%dir %{_libdir}/zoitechat
|
||||||
%dir %{_libdir}/zoitechat/plugins
|
%dir %{_libdir}/zoitechat/plugins
|
||||||
%dir %{_libdir}/zoitechat/python
|
%dir %{_libdir}/zoitechat/python
|
||||||
|
|||||||
@@ -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_ERROR 8
|
||||||
#define FE_MSG_MARKUP 16
|
#define FE_MSG_MARKUP 16
|
||||||
void fe_message (char *msg, int flags);
|
void fe_message (char *msg, int flags);
|
||||||
|
#ifdef __linux__
|
||||||
|
void fe_root_warning (void);
|
||||||
|
#endif
|
||||||
#define FIA_READ 1
|
#define FIA_READ 1
|
||||||
#define FIA_WRITE 2
|
#define FIA_WRITE 2
|
||||||
#define FIA_EX 4
|
#define FIA_EX 4
|
||||||
|
|||||||
+21
-1
@@ -95,6 +95,7 @@ int zoitechat_is_quitting = FALSE;
|
|||||||
/* command-line args */
|
/* command-line args */
|
||||||
int arg_dont_autoconnect = FALSE;
|
int arg_dont_autoconnect = FALSE;
|
||||||
int arg_skip_plugins = FALSE;
|
int arg_skip_plugins = FALSE;
|
||||||
|
gint arg_run_as_root = FALSE;
|
||||||
char *arg_url = NULL;
|
char *arg_url = NULL;
|
||||||
char **arg_urls = NULL;
|
char **arg_urls = NULL;
|
||||||
char *arg_command = NULL;
|
char *arg_command = NULL;
|
||||||
@@ -1175,6 +1176,25 @@ main (int argc, char *argv[])
|
|||||||
HRESULT coinit_result;
|
HRESULT coinit_result;
|
||||||
#endif
|
#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! */
|
srand ((unsigned int) time (NULL)); /* CL: do this only once! */
|
||||||
|
|
||||||
/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
|
/* 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 WIN32
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
/* OS/2 uses UID 0 all the time */
|
/* 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"
|
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);
|
" create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern struct zoitechatprefs prefs;
|
|||||||
extern int zoitechat_is_quitting;
|
extern int zoitechat_is_quitting;
|
||||||
extern gint arg_skip_plugins; /* command-line args */
|
extern gint arg_skip_plugins; /* command-line args */
|
||||||
extern gint arg_dont_autoconnect;
|
extern gint arg_dont_autoconnect;
|
||||||
|
extern gint arg_run_as_root;
|
||||||
extern char *arg_url;
|
extern char *arg_url;
|
||||||
extern char **arg_urls;
|
extern char **arg_urls;
|
||||||
extern char *arg_command;
|
extern char *arg_command;
|
||||||
|
|||||||
@@ -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},
|
{"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"},
|
{"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},
|
{"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},
|
{"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},
|
{"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"},
|
{"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}
|
{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
|
#ifdef WIN32
|
||||||
static void
|
static void
|
||||||
create_msg_dialog (gchar *title, gchar *message)
|
create_msg_dialog (gchar *title, gchar *message)
|
||||||
|
|||||||
@@ -1796,9 +1796,50 @@ menu_ctcpguiopen (void)
|
|||||||
editlist_gui_open (NULL, NULL, ctcp_list, buf, "ctcpreply", "ctcpreply.conf", ctcp_help);
|
editlist_gui_open (NULL, NULL, ctcp_list, buf, "ctcpreply", "ctcpreply.conf", ctcp_help);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
menu_find_local_docs (void)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
char *base_path;
|
||||||
|
|
||||||
|
base_path = g_win32_get_package_installation_directory_of_module (NULL);
|
||||||
|
if (!base_path)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
path = g_build_filename (base_path, "share", "doc", "zoitechat", "html", "index.html", NULL);
|
||||||
|
g_free (base_path);
|
||||||
|
#else
|
||||||
|
const char *appdir;
|
||||||
|
|
||||||
|
appdir = g_getenv ("APPDIR");
|
||||||
|
if (appdir && *appdir)
|
||||||
|
path = g_build_filename (appdir, "usr", "share", "doc", "zoitechat", "html", "index.html", NULL);
|
||||||
|
else
|
||||||
|
path = g_build_filename (ZOITECHAT_DOCDIR, "index.html", NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_docs (GtkWidget *wid, gpointer none)
|
menu_docs (GtkWidget *wid, gpointer none)
|
||||||
{
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
path = menu_find_local_docs ();
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
fe_open_url (path);
|
||||||
|
g_free (path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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},
|
{"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"},
|
{"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},
|
{"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},
|
{"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},
|
{"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"},
|
{"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}
|
{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
|
int
|
||||||
fe_args (int argc, char *argv[])
|
fe_args (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user