mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-06-09 09:51:45 +00:00
feat(config): add configuration options for warning on stranger links and messages sidebar position
This commit is contained in:
@@ -11316,6 +11316,11 @@ class ReticulumMeshChat:
|
||||
self._parse_bool(data["show_unknown_contact_banner"]),
|
||||
)
|
||||
|
||||
if "warn_on_stranger_links" in data:
|
||||
self.config.warn_on_stranger_links.set(
|
||||
self._parse_bool(data["warn_on_stranger_links"]),
|
||||
)
|
||||
|
||||
# update banishment settings
|
||||
if "banished_effect_enabled" in data:
|
||||
self.config.banished_effect_enabled.set(
|
||||
@@ -11336,6 +11341,13 @@ class ReticulumMeshChat:
|
||||
if value is not None:
|
||||
self.config.message_font_size.set(value)
|
||||
|
||||
if "messages_sidebar_position" in data:
|
||||
raw = data["messages_sidebar_position"]
|
||||
if raw is not None:
|
||||
s = str(raw).strip().lower()
|
||||
if s in ("left", "right"):
|
||||
self.config.messages_sidebar_position.set(s)
|
||||
|
||||
if "message_icon_size" in data:
|
||||
try:
|
||||
value = int(data["message_icon_size"])
|
||||
@@ -12542,10 +12554,12 @@ class ReticulumMeshChat:
|
||||
"block_attachments_from_strangers": ctx.config.block_attachments_from_strangers.get(),
|
||||
"block_all_from_strangers": ctx.config.block_all_from_strangers.get(),
|
||||
"show_unknown_contact_banner": ctx.config.show_unknown_contact_banner.get(),
|
||||
"warn_on_stranger_links": ctx.config.warn_on_stranger_links.get(),
|
||||
"banished_effect_enabled": ctx.config.banished_effect_enabled.get(),
|
||||
"banished_text": ctx.config.banished_text.get(),
|
||||
"banished_color": ctx.config.banished_color.get(),
|
||||
"message_font_size": ctx.config.message_font_size.get(),
|
||||
"messages_sidebar_position": ctx.config.messages_sidebar_position.get(),
|
||||
"message_icon_size": ctx.config.message_icon_size.get(),
|
||||
"ui_transparency": ctx.config.ui_transparency.get(),
|
||||
"ui_glass_enabled": ctx.config.ui_glass_enabled.get(),
|
||||
|
||||
@@ -157,7 +157,9 @@ class BotHandler:
|
||||
):
|
||||
with contextlib.suppress(Exception):
|
||||
lh = instance.bot.local.hash
|
||||
address_full = lh.hex() if isinstance(lh, (bytes, bytearray)) else None
|
||||
address_full = (
|
||||
lh.hex() if isinstance(lh, (bytes, bytearray)) else None
|
||||
)
|
||||
if address_full:
|
||||
address_full = self._normalize_lxmf_hash_hex(address_full)
|
||||
if address_full:
|
||||
@@ -171,7 +173,9 @@ class BotHandler:
|
||||
destination = RNS.Destination(identity, "lxmf", "delivery")
|
||||
address_full = self._normalize_lxmf_hash_hex(destination.hash)
|
||||
if address_full:
|
||||
address_pretty = RNS.prettyhexrep(bytes.fromhex(address_full))
|
||||
address_pretty = RNS.prettyhexrep(
|
||||
bytes.fromhex(address_full)
|
||||
)
|
||||
|
||||
if address_full is None:
|
||||
address_full = self._read_lxmf_address_sidecar(entry.get("storage_dir"))
|
||||
|
||||
@@ -296,6 +296,11 @@ class ConfigManager:
|
||||
"show_unknown_contact_banner",
|
||||
True,
|
||||
)
|
||||
self.warn_on_stranger_links = self.BoolConfig(
|
||||
self,
|
||||
"warn_on_stranger_links",
|
||||
True,
|
||||
)
|
||||
|
||||
# banishment config
|
||||
self.banished_effect_enabled = self.BoolConfig(
|
||||
@@ -314,6 +319,11 @@ class ConfigManager:
|
||||
"#dc2626",
|
||||
)
|
||||
self.message_font_size = self.IntConfig(self, "message_font_size", 14)
|
||||
self.messages_sidebar_position = self.StringConfig(
|
||||
self,
|
||||
"messages_sidebar_position",
|
||||
"left",
|
||||
)
|
||||
self.message_icon_size = self.IntConfig(self, "message_icon_size", 28)
|
||||
self.ui_transparency = self.IntConfig(self, "ui_transparency", 0)
|
||||
self.ui_glass_enabled = self.BoolConfig(self, "ui_glass_enabled", True)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# SPDX-License-Identifier: 0BSD
|
||||
|
||||
"""Version string synced from package.json.
|
||||
|
||||
Do not edit by hand. Run: pnpm run version:sync.
|
||||
|
||||
@@ -7,6 +7,8 @@ import pytest
|
||||
from aiohttp import web
|
||||
from aiohttp.test_utils import TestClient, TestServer
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("require_loopback_tcp")
|
||||
|
||||
|
||||
def _build_aio_app(app):
|
||||
routes = web.RouteTableDef()
|
||||
|
||||
Reference in New Issue
Block a user