Files
voculinux/src/vocalinux/app_identity.py
T
soubarnak d08cacb0b4 fix(identity): share one model-download user agent definition
Both model-download call sites built the User-Agent string separately:
recognition_manager used a hardcoded literal while settings_dialog
interpolated APP_ID. Add app_identity.user_agent() and use it in both,
with a test pinning the shared definition.

Fixes #17
2026-11-06 09:01:15 +05:30

91 lines
3.0 KiB
Python

"""Central user-visible application identity for Voculinux.
Ticket #18 rename: every user-visible identity string that is hardcoded in
more than one place is driven from this single module. The fork takes its
own name everywhere a user can see it; the internal ``voculinux`` Python
package name is retained (see :data:`RETAINED_SURFACES`) and unrelated to
these values.
One-time legacy import of a previous Voculinux install lives in
:mod:`vocalinux.legacy_import` and keys off :data:`LEGACY_APP_DIR_NAME`.
"""
APP_NAME: str = "Voculinux"
APP_ID: str = "voculinux"
APP_DIR_NAME: str = "voculinux"
CLI_PROG: str = "voculinux"
BUS_NAME: str = "com.voculinux.Voculinux"
OBJECT_PATH: str = "/com/voculinux/Voculinux"
INTERFACE_NAME: str = "com.voculinux.Voculinux"
DESKTOP_FILENAME: str = "voculinux.desktop"
DESKTOP_ICON_NAME: str = "voculinux"
TRAY_TITLE: str = APP_NAME
ICON_DEFAULT: str = "voculinux-microphone-off"
ICON_ACTIVE: str = "voculinux-microphone"
ICON_PROCESSING: str = "voculinux-microphone-process"
ICON_BASE_NAMES: tuple[str, ...] = (
"voculinux",
ICON_ACTIVE,
ICON_DEFAULT,
ICON_PROCESSING,
)
ENGINE_NAME: str = "voculinux"
ENGINE_LONGNAME: str = "Voculinux"
ENGINE_DESCRIPTION: str = "Voculinux voice dictation (use as default input method)"
COMPONENT_NAME: str = "org.freedesktop.IBus.Voculinux"
IBUS_DIR_NAME: str = "voculinux-ibus"
IBUS_TEXTDOMAIN: str = "voculinux"
UPDATE_CHECKER_USER_AGENT: str = "Voculinux-UpdateChecker"
def user_agent(version: str) -> str:
"""Outbound HTTP User-Agent for model downloads."""
return f"{APP_ID}/{version}"
RESOURCE_DIR_NAME: str = "voculinux"
VERIFICATION_STAMP_NAME: str = ".voculinux_verified"
LOG_FILE_PREFIX: str = "voculinux_logs_"
PORTAL_TOKEN_PREFIX: str = "voculinux_"
ENV_FORCE_BACKEND: str = "VOCULINUX_FORCE_BACKEND"
ENV_INJECT_MODIFIER_WAIT: str = "VOCULINUX_INJECT_MODIFIER_WAIT"
ENV_YDOTOOL_KEY_DELAY: str = "VOCULINUX_YDOTOOL_KEY_DELAY"
SITE_URL: str = "https://voculinux.com"
#: Previous install locations read once by the legacy importer. Never written.
LEGACY_APP_DIR_NAME: str = "vocalinux"
LEGACY_BUS_NAME: str = "com.vocalinux.Vocalinux"
#: Files the rename ticket (#18) flipped. Checked by
#: ``tests/test_app_identity.py`` so the list cannot drift silently.
RENAME_SURFACES: tuple[str, ...] = (
"pyproject.toml",
"voculinux.desktop",
"snap/gui/voculinux.desktop",
"snap/snapcraft.yaml",
"packaging/flatpak/com.voculinux.Voculinux.desktop",
"packaging/flatpak/com.voculinux.Voculinux.metainfo.xml",
"packaging/flatpak/com.voculinux.Voculinux.yml",
"packaging/aur/voculinux-bin/voculinux.desktop",
"web/src/app/page.tsx",
"web/package.json",
"README.md",
"docs/INSTALL.md",
)
#: Surfaces deliberately never renamed (internal module name, upstream URLs,
#: history). Recorded here so the rename ticket does not touch them.
RETAINED_SURFACES: tuple[str, ...] = (
"src/vocalinux (Python import package name)",
"https://github.com/VocaHQ/vocalinux (upstream URLs and provenance)",
"CHANGELOG.md (historical changelog entries)",
)