diff --git a/debian/changelog b/debian/changelog index d17075408..bd18b8eca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,31 @@ +freedombox (26.14) unstable; urgency=medium + + [ Oğuz Ersen ] + * Translated using Weblate (Turkish) + + [ James Valleroy ] + * backups: Run compact in cleanup + * homeassistant: Minor spelling fix + * doc: Fetch latest manual + + [ Sunil Mohan Adapa ] + * homeassistant: Migrate to new HTTP configuration approach + * homeassistant: Enable app properly on first install + + [ Jiří Podhorecký ] + * Translated using Weblate (Czech) + + [ bittin1ddc447d824349b2 ] + * Translated using Weblate (Swedish) + + [ Hosted Weblate user 54392 ] + * Translated using Weblate (Chinese (Simplified Han script)) + + [ Dietmar ] + * Translated using Weblate (German) + + -- James Valleroy Thu, 15 Oct 2026 22:29:56 -0400 + freedombox (26.13~bpo13+1) trixie-backports; urgency=medium * Rebuild for trixie-backports. diff --git a/doc/manual/en/ReleaseNotes.raw.wiki b/doc/manual/en/ReleaseNotes.raw.wiki index fb25d7a68..867c03270 100644 --- a/doc/manual/en/ReleaseNotes.raw.wiki +++ b/doc/manual/en/ReleaseNotes.raw.wiki @@ -8,6 +8,13 @@ For more technical details, see the [[https://salsa.debian.org/freedombox-team/f The following are the release notes for each !FreedomBox version. +== FreedomBox 26.14 (2026-10-15) == + + * backups: Run compact in cleanup + * homeassistant: Enable app properly on first install + * homeassistant: Migrate to new HTTP configuration approach + * locale: Update translations for Chinese (Simplified Han script), Czech, German, Swedish, Turkish + == FreedomBox 26.13 (2026-10-06) == === Highlights === diff --git a/doc/manual/es/ReleaseNotes.raw.wiki b/doc/manual/es/ReleaseNotes.raw.wiki index fb25d7a68..867c03270 100644 --- a/doc/manual/es/ReleaseNotes.raw.wiki +++ b/doc/manual/es/ReleaseNotes.raw.wiki @@ -8,6 +8,13 @@ For more technical details, see the [[https://salsa.debian.org/freedombox-team/f The following are the release notes for each !FreedomBox version. +== FreedomBox 26.14 (2026-10-15) == + + * backups: Run compact in cleanup + * homeassistant: Enable app properly on first install + * homeassistant: Migrate to new HTTP configuration approach + * locale: Update translations for Chinese (Simplified Han script), Czech, German, Swedish, Turkish + == FreedomBox 26.13 (2026-10-06) == === Highlights === diff --git a/doc/manual/es/WireGuard.raw.wiki b/doc/manual/es/WireGuard.raw.wiki index 4dab80365..f244fed15 100644 --- a/doc/manual/es/WireGuard.raw.wiki +++ b/doc/manual/es/WireGuard.raw.wiki @@ -14,53 +14,162 @@ !WireGuard es red privada virtual (VPN) extremadamente sencilla aunque rápida y moderna que emplea cifrado de última generación.Puede ser un reemplazo útil para IPSec u [[es/FreedomBox/Manual/OpenVPN|OpenVPN]]. +=== Uso === + +En !FreedomBox, al app !WireGuard se puede usar para dos propósitos diferentes. + +==== Como servidor ==== + +El primer propósito es que !FreedomBox haga de servidor VPN. + +Imagina que estás en una cafetería conectado a su red Wi-Fi con tu móvil o portátil. +No quieres que los operadores de la red o sus proveedores de Internet sepan qué sitios web visitas. +Puedes cifrar todo tu tráfico de Internet incluyendo búsquedas de nombre de dominio y enviarlo a tu !FreedomBox para que lo saque a Internet desde tu casa. +Esto tiene dos efectos: Por un lado, la cafetería solo verá tráfico cifrado hacia tu !FreedomBox, y por otro, los sitios web que visites pensarán que navegas desde casa, no desde la cafetería. + +==== Como cliente ==== + +El segundo propósito es convertir tu !FreedomBox en un cliente VPN. + +Imagina que no quieres que tu proveedor de Internet vea el tráfico que sale de tu !FreedomBox u otros dispositivos de tu hogar. +Puedes contratar una cuenta en una red VPN en uno de los proveedores de !WireGuard VPN (o pedir a un amigo con !FreedomBox que te deje ser cliente de su servidor !WireGuard). +Entonces puedes configurar la app !WireGuard en !FreedomBox's como cliente VPN. Todo el tráfico que salga de tu !FreedomBox (incluyendo tráfico !BitTorrent) se cifrará y enviará por tu servidor VPN. +Allí se descifrará y reenviará hacia Internet. Esto, de nuevo, tiene dos efectos: Tu proveedor de Internet sólo verá tráfico cifrado yendo hacia tu proveedor de VPN y +los sitios web que visites desde !FreedomBox te verán navegando desde el servidor VPN. Muchos proveedores de VPN reparten sus servidores en países diferentes y te permiten elegir por cual sales. +Los sitios web que visites desde !FreedomBox te verán navegando desde el país que elegiste. + +Además puedes configurar los dispositivos de tu hogar para que usen esta VPN. Para ello tienes que situar a tu router Wi-Fi "detrás" de tu !FreedomBox. +Tu router Wi-Fi se cableará al puerto "LAN" de tu !FreedomBox y se configurará en modo "repetidor" +(necesitará instalar !FreedomBox en un dispositivo con dos puertos Ethernet, como la [[FreedomBox/Hardware/LibreCrafts|FreedomBox de Libre Crafts]]). +Después, el tráfico de red de todos los dispositivos conectados al router Wi-Fi pasarán por la !FreedomBox. +Si el cliente VPN !WireGuard está configurado en la !FreedomBox, todo el tráfico de esos dispositivos usará la VPN automáticamente. + === Instalación === Puedes instalar !WireGuard desde la sección ''Apps'' de la interfaz de !FreedomBox. -=== Configuración - Debian Peers === +=== Configurar FreedomBox como servidor de VPN === -Nota: !FreedomBox trata estos pasos automáticamente. Así que solo necesitas seguirlos en clientes Debian que se conecten a !FreedomBox, O en servidores Debian a los que !FreedomBox se conecte. +Para configurar !FreedomBox como servidor, pulsa el botón "Arrancar un Servidor !WireGuard" si lo ves junto al mensaje "Servidor !WireGuard apagado" en la sección "Como Servidor". +Esto sólo se necesita hacer una vez y después se muestra información del servidor como su clave pública, URLs, y dirección IP. - * [[WireGuard#Step_1_-_Generating_Keypairs|Paso 1 - Generar los pares de claves]] - * [[WireGuard#Step_2_-_Configuration|Paso 2 - Alternativa A - Configuración Manual]] +Si tu !FreedomBox está detrás de un router, necesitas configurarlo para que reenvíe el tráfico que entre por el puerto UDP 51820 al mismo puerto de tu !FreedomBox. +=== Configurar la App móvil para usar el servidor de VPN === -=== Uso === +La app recomendada para Android e iOS es la app oficial "!WireGuard" disponible en sus tiendas. Actualmente la app no está disponible en la tienda de F-Droid, así que usa el APK. +Hay enlaces Links en la sección "Apps Cliente" de la página !WireGuard. - * Tunel punto a punto - * Cliente VPN con ruta por omisión +==== Usando el código QR ==== -=== Configuración - Clientes móviles === +Esta es la forma más simple, y la recomendada, para configurar la app móvil de !WireGuard. -!WireGuard tiene una implementación en espacio de usuario para dispositivos móviles disponible en la propia app. Funciona en Android e iOS. [[https://www.wireguard.com/install/|Aquí]] hay una lista completa de sistemas operativos compatibles. + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Luego haz clic en "Mostrar Código QR". !FreedomBox mostrará un código QR. + 1. En la app móvil de !WireGuard, haz clic en el botón "+" de la página principal para crear un túnel nuevo. Desde el menú que se muestra, selecciona la opción "Escanear desde código QR". + Se mostrará un diálogo pidiendo permiso para que la app de !WireGuard use la cámara. Permíteselo. + 1. A continuación, muéstrale a la cámara el código QR que generó la !FreedomBox en el primer paso. + 1. Si falla al escanear el código, la app preguntará por el nombre del túnel. Nombra el nuevo túnel y tu configuración estará completa. + 1. Habilita el túnel usando el botón deslizante cuando quieras conectar con el servidor VPN de tu !FreedomBox. + 1. Mira la sección de Resolución de Problemas para verificar si tu instalación funciona. -El cliente se puede configurar de varias maneras: +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app.png |App de WireGuard |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-add-tunnel.png |Menú de añadir túnel |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-after-qr-code.png|Tras escanear el código QR|height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-tunnel-added.png |Túnel Añadido |height=400}} -==== Alternativa A - Crear una configuración a mano ==== +==== Usando un fichero de configuración ==== -Esta es autoexplicativa: te creas la configuración en el dispositivo móvil y transfieres las claves apropiadas a la configuración del servidor. +Si por algún motivo no es posible escanear, prueba esto. -==== Alternativa B - Crear una configuración a partir de un archivo ==== + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Luego haz clic en la opción "Descargar fichero de configuración". + Se descarga un fichero a tu dispositivo. Si se descarga en un dispositivo que no es el que quieres configurar, transfiérelo al dispositivo correcto (o a la persona que quiere conectar con tu servidor VPN). + 1. En la app móvil de !WireGuard, haz clic en el botón "+" de la página principal para crear un túnel nuevo. Desde el menú que se muestra, selecciona la opción "Importar desde fichero o archivo". + 1. A continuación, selecciona el fichero que se descargó desde el interfaz web de !FreedomBox (o se transfirió al dispositivo). + 1. Si falla al importar, verás el mensaje "Cliente wg importado" y un nuevo túnel con el nombre "wg-client". Puedes renombrarlo. + 1. Habilita el túnel usando el botón deslizante cuando quieras conectar con el servidor VPN de tu !FreedomBox. + 1. Mira la sección de Resolución de Problemas para verificar si tu instalación funciona. -Aquí tienes que comprimir a .zip el archivo de configuración del cliente, transferirlo al dispositivo, e importarlo a la app. +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app.png |App de WireGuard |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-add-tunnel.png |Menú de añadir túnel |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-imported.png |Fichero de configuración importado|height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-tunnel-added.png|Túnel Añadido |height=400}} -==== Alternativa C - Importarla leyendo un código QR (el método másseguro) ==== +==== Usando configuración manual ==== -La versión 0.0.20180724 del cliente móvil soporta lectura de código QR. +Si por algún motivo no es posible ni escanear ni importar, prueba esto. -Se puede emplear DebianPackage:qrencode para generar códigos QR incluso desde el terminal/la consola usando carácteres UTF-8. + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Anota la Clave Privada y todos los otros detalles de la página. + 1. En la app móvil de !WireGuard, haz clic en el botón "+" de la página principal para crear un túnel nuevo. Desde el menú que se muestra, selecciona la opción "Crear desde cero". + 1. En la sección Interfaz nombra el nuevo túnel. En "Clave Privada", pon la clave privada que generó tu !FreedomBox en el primer paso. + La app rellena la clave pública por sí sola (porque la clave pública se deduce de la privada. + Pon como Dirección la dirección IP del primer paso. Y como "Servidores DNS" pon "10.84.0.1". + 1. Tras completar la sección Interfaz, haz clic en "Añadir pareja" al final de la página. + En "Clave Pública", pon la "Clave pública del servidor" mostrada en la sección "Como servidor" de la página de la app !WireGuard en !FreedomBox. + Pon en el campo Endpoint una de las URLs mostradas en el primer paso. Y "0.0.0.0/0,::0/0" como "IPs permitidas". + 1. Dále a Grabar. Deberías ver el nuevo túnel. + 1. Habilita el túnel usando el botón deslizante cuando quieras conectar con el servidor VPN de tu !FreedomBox. + 1. Mira la sección de Resolución de Problemas para verificar si tu instalación funciona. -La syntaxis es: +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app.png |App de WireGuard |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-add-tunnel.png |Menú de añadir túnel |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-manual-add-1.png|Rellenar sección de interfaz |height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-manual-add-2.png|Rellenar sección de emparejamiento|height=400}} +{{attachment:FreedomBox/Manual/WireGuard/wireguard-app-tunnel-added.png|Túnel Añadido |height=400}} -{{{ -# qrencode -t ansiutf8 < client.conf -}}} +=== Configurar la app de escritorio (GNU/Linux) para usar el servidor VPN === -Esto generará un código QR legible desde el cliente móvil. +En un escritorio GNU/Linux como Debian, instala el paquete de software {{{wireguard}}} o {{{wireguard-tools}}}. Más detalles en la página de [[https://www.wireguard.com/install/|instalación]]. -La ventaja de este enfoque es que no hay necesidad de software adicional ni de transferir información sensible a través de canales de datos que podrían estar comprometidos. + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Luego haz clic en la opción "Descargar fichero de configuración". + Se descarga un fichero a tu dispositivo. Si se descarga en un dispositivo que no es el que quieres configurar, transfiérelo al dispositivo correcto (o a la persona que quiere conectar con tu servidor VPN). + 1. Para activar el túnel ejecuta la órden {{{sudo wg-quick up /ruta/a/tu/wg-client.conf}}}. Para desactivar el túnel, ejecuta {{{sudo wg-quick down /ruta/a/tu/wg-client.conf}}}. + 1. Mira la sección de Resolución de Problemas para verificar si tu instalación funciona. +=== Configurar la app de escritorio (Windows) para usar el servidor VPN === + +Descarga e instala el cliente !WireGuard oficial para Windows. Más detalles en la página de [[https://www.wireguard.com/install/|instalación]]. + + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Luego haz clic en la opción "Descargar fichero de configuración". + Se descarga un fichero a tu dispositivo. Si se descarga en un dispositivo que no es el que quieres configurar, transfiérelo al dispositivo correcto (o a la persona que quiere conectar con tu servidor VPN). + 1. Importa el fichero de configuración a la app Windows de !WireGuard. Después deberías poder activar y desactivar el túnel. + 1. Mira la sección de Resolución de Problemas para verificar si el túnel funciona. + +=== Configurar la app de escritorio (MacOS) para usar el servidor VPN === + +Descarga e instala el cliente !WireGuard oficial para MacOS. Más detalles en la página de [[https://www.wireguard.com/install/|instalación]]. + + 1. En !FreedomBox, en la página de la app de !WireGuard, haz clic en "Añadir Cliente Automáticamente". Luego haz clic en la opción "Descargar fichero de configuración". + Se descarga un fichero a tu dispositivo. Si se descarga en un dispositivo que no es el que quieres configurar, transfiérelo al dispositivo correcto (o a la persona que quiere conectar con tu servidor VPN). + 1. Importa el fichero de configuración a la app MacOS de !WireGuard. Después deberías poder activar y desactivar el túnel. + 1. Mira la sección de Resolución de Problemas para verificar si el túnel funciona. + +=== Resolución de problemas === + +Tras activar el túnel, todo el tráfico del sistema viajará por la VPN que has configurado. Si hay algún error en la configuración, activar el túnel no fallará porque no hay conexión que valga. +Nada te avisará de que tu tráfico no llega al servidor. Para asegurarte: + + 1. Activa el túnel. + 1. Abre un navegador y accede a un sitio web como https://www.wikipedia.org. Debería funcionar. + 1. Abre un navegador y accede a https://10.84.0.1 (tu !FreedomBox). Esto debería mostrarte la interfaz web de tu !FreedomBox (tras un aviso de seguridad). + 1. En !FreedomBox, en la página de la app !WireGuard, en la sección "Como Servidor", en la tabla "Parejas", haz clic en la clave pública del cliente. + Esto muestra la página de Clientes Permitidos, que debería mostrarte algún valor para "Última conexión" y un valor mayor que cero para Datos recibidos. + 1. En la página de Clientes Permitidos de !FreedomBox debería mostrarte algún valor para "Última conexión" y un valor mayor que cero para Datos recibidos. + 1. Si tienes {{{ping}}} instalado en tu máquina cliente, ejecutar {{{ping 9.9.9.9}}} debería recibir respuestas. + 1. Si tienes {{{traceroute}}} instalado en tu máquina, ejecutar {{{traceroute 9.9.9.9"}}} debería mostrar "10.84.0.1" como primer paso en la entrega de paquetes de red. + +Si lo anterior no funciona, verifica lo siguiente: + + 1. En la sección "Como Servidor" de la app !WireGuard en !FreedomBox debe mostrarse en la lista de Parejas la clave pública del cliente. Y debe coincidir exáctamente. + 1. En la app cliente el valor de la dirección IP debe coincidir con la IP Permitida asociada a la clave pública en !FreedomBox. + 1. La clave pública del servidor mostrada en la sección "Como Servidor" de la app de !WireGuard del interfaz de !FreedomBox debe coincidir con la clave pública establecida en la sección de emparejamiento de la app cliente. Y debe coincidir exáctamente. + 1. En la sección de emparejamiento de la configuración del túnel en la app cliente, las IPs permitidas deben ser "0.0.0.0/0,::0/0". + 1. La URL de endpoint de la pareja en la app cliente debería ser el nombre de dominio o la dirección IP del servidor !FreedomBox seguidos de {{{:51820}}}. + Tu !FreedomBox también debe ser alcanzable desde esa dirección IP o nombre de dominio. Desactiva el túnel y escribe esa dirección (sin el puerto) en un navegador de la máquina cliente. + Debería aparecer la interfaz web de !FreedomBox + +=== Problemas conocidos === + + * La versión 26.12 de !FreedomBox tiene rotas las funciones de Mostrar Códgo QR y Descargar Configuración. La version 26.13 las arreglará. === Enlaces externos === @@ -77,4 +186,4 @@ Volver a la [[es/FreedomBox/Features|descripción de Funcionalidades]] o a las p <> ---- -CategoryFreedomBox +CategoryFreedomBox CategoryAntiSpam diff --git a/doc/manual/es/images/wireguard-app-add-tunnel.png b/doc/manual/es/images/wireguard-app-add-tunnel.png new file mode 100644 index 000000000..3fac4caa9 Binary files /dev/null and b/doc/manual/es/images/wireguard-app-add-tunnel.png differ diff --git a/doc/manual/es/images/wireguard-app-after-qr-code.png b/doc/manual/es/images/wireguard-app-after-qr-code.png new file mode 100644 index 000000000..fd58d97de Binary files /dev/null and b/doc/manual/es/images/wireguard-app-after-qr-code.png differ diff --git a/doc/manual/es/images/wireguard-app-imported.png b/doc/manual/es/images/wireguard-app-imported.png new file mode 100644 index 000000000..a6e67f594 Binary files /dev/null and b/doc/manual/es/images/wireguard-app-imported.png differ diff --git a/doc/manual/es/images/wireguard-app-manual-add-1.png b/doc/manual/es/images/wireguard-app-manual-add-1.png new file mode 100644 index 000000000..b5a07fc57 Binary files /dev/null and b/doc/manual/es/images/wireguard-app-manual-add-1.png differ diff --git a/doc/manual/es/images/wireguard-app-manual-add-2.png b/doc/manual/es/images/wireguard-app-manual-add-2.png new file mode 100644 index 000000000..b0ed57d7a Binary files /dev/null and b/doc/manual/es/images/wireguard-app-manual-add-2.png differ diff --git a/doc/manual/es/images/wireguard-app-tunnel-added.png b/doc/manual/es/images/wireguard-app-tunnel-added.png new file mode 100644 index 000000000..0693eab4b Binary files /dev/null and b/doc/manual/es/images/wireguard-app-tunnel-added.png differ diff --git a/doc/manual/es/images/wireguard-app.png b/doc/manual/es/images/wireguard-app.png new file mode 100644 index 000000000..6115c8502 Binary files /dev/null and b/doc/manual/es/images/wireguard-app.png differ diff --git a/freedombox/locale/cs/LC_MESSAGES/django.po b/freedombox/locale/cs/LC_MESSAGES/django.po index 42f3f4dca..cb70a4138 100644 --- a/freedombox/locale/cs/LC_MESSAGES/django.po +++ b/freedombox/locale/cs/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-07 02:24+0000\n" -"PO-Revision-Date: 2026-08-22 20:51+0000\n" +"PO-Revision-Date: 2026-10-11 17:51+0000\n" "Last-Translator: Jiří Podhorecký \n" "Language-Team: Czech \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n" -"X-Generator: Weblate 2026.9.dev0\n" +"X-Generator: Weblate 2026.10.1.dev0\n" #: freedombox/config.py:103 #, python-brace-format @@ -10364,10 +10364,8 @@ msgid "Add Client" msgstr "Přidat klienta" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:15 -#, fuzzy -#| msgid "Client public key:" msgid "New client added with public key:" -msgstr "Veřejný klíč klienta:" +msgstr "Nový klient doplněný veřejným klíčem:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:19 msgid "" @@ -10376,70 +10374,55 @@ msgid "" "This information can't be shown again. Be sure to get it before navigating " "away from this page. Keep this information confidential." msgstr "" +"Chcete-li nakonfigurovat klientskou aplikaci, stáhněte si konfigurační " +"soubor (.conf) k importu, naskenujte QR kód nebo použijte parametry k " +"nastavení od začátku. Tyto informace již nelze znovu zobrazit. Nezapomeňte " +"si je zapsat, než tuto stránku opustíte. Zachovejte tyto informace v " +"tajnosti." #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:28 -#, fuzzy -#| msgid "Serving Domains" msgid "Using domain:" -msgstr "Obsluhované domény" +msgstr "Použití domény:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:33 msgid "Download config file" msgstr "Stáhnout konfigurační soubor" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:39 -#, fuzzy -#| msgid "Show QR Code" msgid "Show QR code" msgstr "Zobrazit QR kód" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:45 -#, fuzzy -#| msgid "Postfix TLS parameters" msgid "Show config parameters" -msgstr "Parametry Postfix TLS" +msgstr "Zobrazit parametry konfigurace" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:55 -#, fuzzy -#| msgid "Client public key:" msgid "Client Public Key" -msgstr "Veřejný klíč klienta:" +msgstr "Veřejný klíč klienta" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:59 -#, fuzzy -#| msgid "Private Key" msgid "Client Private Key" -msgstr "Soukromý klíč" +msgstr "Soukromý klíč klienta" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:63 -#, fuzzy -#| msgid "IP Address" msgid "Client IP Address" -msgstr "IP adresa" +msgstr "IP adresa klienta" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:67 -#, fuzzy -#| msgid "Current DNS Server" msgid "Client DNS Server" -msgstr "Aktuální server DNS" +msgstr "DNS Server klienta" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:71 -#, fuzzy -#| msgid "Server public key:" msgid "Server/Peer Public Key" -msgstr "Veřejný klíč serveru:" +msgstr "Veřejný klíč serveru/protistrany" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:75 -#, fuzzy -#| msgid "Server endpoint:" msgid "Server/Peer Endpoint" -msgstr "Koncový bod serveru:" +msgstr "Koncový bod serveru/protistrany" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:79 -#, fuzzy -#| msgid "Allowed IPs" msgid "Server/Peer Allowed IPs" -msgstr "Povolené IP adresy" +msgstr "Povolené IP adresy serveru/protistrany" #: freedombox/modules/wireguard/templates/wireguard_delete_client.html:14 msgid "Are you sure that you want to delete this client?" @@ -10544,10 +10527,8 @@ msgid "Client with public key already exists" msgstr "Klient s veřejným klíčem již existuje" #: freedombox/modules/wireguard/views.py:137 -#, fuzzy -#| msgid "Client deleted." msgid "Client Added" -msgstr "Klient smazán." +msgstr "Klient přidán" #: freedombox/modules/wireguard/views.py:153 msgid "Allowed Client" diff --git a/freedombox/locale/de/LC_MESSAGES/django.po b/freedombox/locale/de/LC_MESSAGES/django.po index 7651d1e49..a8429d8bf 100644 --- a/freedombox/locale/de/LC_MESSAGES/django.po +++ b/freedombox/locale/de/LC_MESSAGES/django.po @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: FreedomBox UI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-07 02:24+0000\n" -"PO-Revision-Date: 2026-08-20 00:46+0000\n" -"Last-Translator: Dietmar \n" +"PO-Revision-Date: 2026-10-15 17:51+0000\n" +"Last-Translator: Dietmar \n" "Language-Team: German \n" "Language: de\n" @@ -19,7 +19,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 2026.9.dev0\n" +"X-Generator: Weblate 2026.11.dev0\n" #: freedombox/config.py:103 #, python-brace-format @@ -10591,10 +10591,8 @@ msgid "Add Client" msgstr "Client hinzufügen" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:15 -#, fuzzy -#| msgid "Client public key:" msgid "New client added with public key:" -msgstr "Öffentlicher Clientschlüssel:" +msgstr "Neuer Client mit öffentlichem Schlüssel hinzugefügt:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:19 msgid "" @@ -10603,70 +10601,55 @@ msgid "" "This information can't be shown again. Be sure to get it before navigating " "away from this page. Keep this information confidential." msgstr "" +"Um die Client-App zu konfigurieren, laden Sie die Konfigurationsdatei " +"(.conf) zum Importieren herunter, scannen den QR-Code oder verwenden die " +"Parameter, um die Konfiguration völlig neu vorzunehmen. Diese Informationen " +"können nicht erneut angezeigt werden. Notieren Sie sie sich unbedingt, bevor " +"Sie diese Seite verlassen. Behandeln Sie diese Informationen vertraulich." #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:28 -#, fuzzy -#| msgid "Serving Domains" msgid "Using domain:" -msgstr "Domains bedienen" +msgstr "Verwendung der Domain:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:33 msgid "Download config file" msgstr "Konfigurationsdatei herunterladen" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:39 -#, fuzzy -#| msgid "Show QR Code" msgid "Show QR code" msgstr "QR Code anzeigen" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:45 -#, fuzzy -#| msgid "Postfix TLS parameters" msgid "Show config parameters" -msgstr "Postfix TLS-Parameter" +msgstr "Konfigurationsparameter anzeigen" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:55 -#, fuzzy -#| msgid "Client public key:" msgid "Client Public Key" -msgstr "Öffentlicher Clientschlüssel:" +msgstr "Öffentlicher Clientschlüssel" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:59 -#, fuzzy -#| msgid "Private Key" msgid "Client Private Key" -msgstr "Private Key" +msgstr "Privater Schlüssel des Clients" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:63 -#, fuzzy -#| msgid "IP Address" msgid "Client IP Address" -msgstr "IP-Adresse" +msgstr "IP-Adresse des Clients" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:67 -#, fuzzy -#| msgid "Current DNS Server" msgid "Client DNS Server" -msgstr "Aktueller DNS-Server" +msgstr "Client-DNS-Server" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:71 -#, fuzzy -#| msgid "Server public key:" msgid "Server/Peer Public Key" -msgstr "Öffentlicher Schlüssel des Servers:" +msgstr "Öffentlicher Schlüssel des Servers/Peers" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:75 -#, fuzzy -#| msgid "Server endpoint:" msgid "Server/Peer Endpoint" -msgstr "Serverendpunkt:" +msgstr "Server/Peer Endpunkt" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:79 -#, fuzzy -#| msgid "Allowed IPs" msgid "Server/Peer Allowed IPs" -msgstr "Zulässige IPs" +msgstr "Zulässige IPs Server/Peer" #: freedombox/modules/wireguard/templates/wireguard_delete_client.html:14 msgid "Are you sure that you want to delete this client?" @@ -10773,10 +10756,8 @@ msgid "Client with public key already exists" msgstr "Client mit öffentlichem Schlüssel ist bereits vorhanden" #: freedombox/modules/wireguard/views.py:137 -#, fuzzy -#| msgid "Client deleted." msgid "Client Added" -msgstr "Client gelöscht." +msgstr "Client hinzugefügt" #: freedombox/modules/wireguard/views.py:153 msgid "Allowed Client" diff --git a/freedombox/locale/sv/LC_MESSAGES/django.po b/freedombox/locale/sv/LC_MESSAGES/django.po index b21b67892..28f752961 100644 --- a/freedombox/locale/sv/LC_MESSAGES/django.po +++ b/freedombox/locale/sv/LC_MESSAGES/django.po @@ -8,8 +8,9 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-07 02:24+0000\n" -"PO-Revision-Date: 2026-09-09 16:47+0000\n" -"Last-Translator: Daniel Nylander \n" +"PO-Revision-Date: 2026-10-13 09:51+0000\n" +"Last-Translator: bittin1ddc447d824349b2 " +"\n" "Language-Team: Swedish \n" "Language: sv\n" @@ -17,7 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 2026.9.1\n" +"X-Generator: Weblate 2026.11.dev0\n" #: freedombox/config.py:103 #, python-brace-format @@ -10390,10 +10391,8 @@ msgid "Add Client" msgstr "Lägg till klient" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:15 -#, fuzzy -#| msgid "Client public key:" msgid "New client added with public key:" -msgstr "Offentlig klientnyckel:" +msgstr "Ny klient tillagd med publik nyckel:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:19 msgid "" @@ -10402,70 +10401,54 @@ msgid "" "This information can't be shown again. Be sure to get it before navigating " "away from this page. Keep this information confidential." msgstr "" +"För att konfigurera klientappen, ladda ned konfigurationsfilen (.conf) för " +"import, skanna QR-koden eller använd parametrarna för att konfigurera från " +"grunden. Denna information kan inte visas igen. Se till att spara den innan " +"du lämnar sidan. Hantera informationen konfidentiellt." #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:28 -#, fuzzy -#| msgid "Serving Domains" msgid "Using domain:" -msgstr "Betjäna domäner" +msgstr "Använder domän:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:33 msgid "Download config file" msgstr "Ladda ner konfigurationsfil" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:39 -#, fuzzy -#| msgid "Show QR Code" msgid "Show QR code" msgstr "Visa QR-kod" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:45 -#, fuzzy -#| msgid "Postfix TLS parameters" msgid "Show config parameters" -msgstr "Postfix TLS-parametrar" +msgstr "Visa konfigurationsparametrar" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:55 -#, fuzzy -#| msgid "Client public key:" msgid "Client Public Key" -msgstr "Offentlig klientnyckel:" +msgstr "Klient publik nyckel" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:59 -#, fuzzy -#| msgid "Private Key" msgid "Client Private Key" -msgstr "Privat nyckel" +msgstr "Klient privat nyckel" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:63 -#, fuzzy -#| msgid "IP Address" msgid "Client IP Address" -msgstr "IP Adress" +msgstr "Klient IP Adress" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:67 -#, fuzzy -#| msgid "Current DNS Server" msgid "Client DNS Server" -msgstr "Nuvarande DNS-server" +msgstr "Klient DNS-server" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:71 -#, fuzzy -#| msgid "Server public key:" msgid "Server/Peer Public Key" -msgstr "Serverns offentliga nyckel:" +msgstr "Server/peer publik nyckel" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:75 -#, fuzzy -#| msgid "Server endpoint:" msgid "Server/Peer Endpoint" -msgstr "Serverändpunkt:" +msgstr "Server/peer ändpunkt" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:79 -#, fuzzy -#| msgid "Allowed IPs" msgid "Server/Peer Allowed IPs" -msgstr "Tillåtna IPs" +msgstr "Server/peer tillåtna IPs" #: freedombox/modules/wireguard/templates/wireguard_delete_client.html:14 msgid "Are you sure that you want to delete this client?" @@ -10570,10 +10553,8 @@ msgid "Client with public key already exists" msgstr "Klient med offentlig nyckel finns redan" #: freedombox/modules/wireguard/views.py:137 -#, fuzzy -#| msgid "Client deleted." msgid "Client Added" -msgstr "Klienten har tagits bort." +msgstr "Klient tillagd" #: freedombox/modules/wireguard/views.py:153 msgid "Allowed Client" diff --git a/freedombox/locale/tr/LC_MESSAGES/django.po b/freedombox/locale/tr/LC_MESSAGES/django.po index d41cf1d65..3b758e9fc 100644 --- a/freedombox/locale/tr/LC_MESSAGES/django.po +++ b/freedombox/locale/tr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-07 02:24+0000\n" -"PO-Revision-Date: 2026-08-19 02:51+0000\n" +"PO-Revision-Date: 2026-10-08 05:51+0000\n" "Last-Translator: Oğuz Ersen \n" "Language-Team: Turkish \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 2026.9.dev0\n" +"X-Generator: Weblate 2026.10.1.dev0\n" #: freedombox/config.py:103 #, python-brace-format @@ -10419,10 +10419,8 @@ msgid "Add Client" msgstr "İstemci Ekle" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:15 -#, fuzzy -#| msgid "Client public key:" msgid "New client added with public key:" -msgstr "İstemci ortak anahtarı:" +msgstr "Yeni istemci ortak anahtarla eklendi:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:19 msgid "" @@ -10431,70 +10429,54 @@ msgid "" "This information can't be shown again. Be sure to get it before navigating " "away from this page. Keep this information confidential." msgstr "" +"İstemci uygulamasını yapılandırmak için, içe aktarmak üzere yapılandırma " +"dosyasını (.conf) indirin, QR kodunu tarayın veya parametreleri kullanarak " +"sıfırdan yapılandırın. Bu bilgiler bir daha görüntülenemez. Bu sayfadan " +"ayrılmadan önce bu bilgileri mutlaka kaydedin. Bu bilgileri gizli tutun." #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:28 -#, fuzzy -#| msgid "Serving Domains" msgid "Using domain:" -msgstr "Hizmet Veren Etki Alanları" +msgstr "Kullanılan etki alanı:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:33 msgid "Download config file" msgstr "Yapılandırma dosyasını indir" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:39 -#, fuzzy -#| msgid "Show QR Code" msgid "Show QR code" -msgstr "QR Kodunu Göster" +msgstr "QR kodunu göster" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:45 -#, fuzzy -#| msgid "Postfix TLS parameters" msgid "Show config parameters" -msgstr "Postfix TLS parametreleri" +msgstr "Yapılandırma parametrelerini göster" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:55 -#, fuzzy -#| msgid "Client public key:" msgid "Client Public Key" -msgstr "İstemci ortak anahtarı:" +msgstr "İstemci Ortak Anahtarı" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:59 -#, fuzzy -#| msgid "Private Key" msgid "Client Private Key" -msgstr "Özel Anahtar" +msgstr "İstemci Özel Anahtarı" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:63 -#, fuzzy -#| msgid "IP Address" msgid "Client IP Address" -msgstr "IP Adresi" +msgstr "İstemci IP Adresi" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:67 -#, fuzzy -#| msgid "Current DNS Server" msgid "Client DNS Server" -msgstr "Şu Anki DNS Sunucusu" +msgstr "İstemci DNS Sunucusu" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:71 -#, fuzzy -#| msgid "Server public key:" msgid "Server/Peer Public Key" -msgstr "Sunucu ortak anahtarı:" +msgstr "Sunucu/Kişi Ortak Anahtarı" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:75 -#, fuzzy -#| msgid "Server endpoint:" msgid "Server/Peer Endpoint" -msgstr "Sunucu uç noktası:" +msgstr "Sunucu/Kişi Uç Noktası" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:79 -#, fuzzy -#| msgid "Allowed IPs" msgid "Server/Peer Allowed IPs" -msgstr "İzin verilen IP'ler" +msgstr "Sunucu/Kişi İzin Verilen IP Adresleri" #: freedombox/modules/wireguard/templates/wireguard_delete_client.html:14 msgid "Are you sure that you want to delete this client?" @@ -10599,10 +10581,8 @@ msgid "Client with public key already exists" msgstr "Ortak anahtara sahip istemci zaten var" #: freedombox/modules/wireguard/views.py:137 -#, fuzzy -#| msgid "Client deleted." msgid "Client Added" -msgstr "İstemci silindi." +msgstr "İstemci Eklendi" #: freedombox/modules/wireguard/views.py:153 msgid "Allowed Client" diff --git a/freedombox/locale/zh_Hans/LC_MESSAGES/django.po b/freedombox/locale/zh_Hans/LC_MESSAGES/django.po index 5f05a66e9..6b1c22951 100644 --- a/freedombox/locale/zh_Hans/LC_MESSAGES/django.po +++ b/freedombox/locale/zh_Hans/LC_MESSAGES/django.po @@ -8,9 +8,9 @@ msgstr "" "Project-Id-Version: Plinth\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-07 02:24+0000\n" -"PO-Revision-Date: 2026-09-21 11:51+0000\n" -"Last-Translator: QuietCedar47 " -"\n" +"PO-Revision-Date: 2026-10-11 17:51+0000\n" +"Last-Translator: Hosted Weblate user 54392 " +"\n" "Language-Team: Chinese (Simplified Han script) \n" "Language: zh_Hans\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 2026.10.dev0\n" +"X-Generator: Weblate 2026.10.1.dev0\n" #: freedombox/config.py:103 #, python-brace-format @@ -9375,10 +9375,8 @@ msgid "Add Client" msgstr "添加客户端" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:15 -#, fuzzy -#| msgid "Select verified SSH public key" msgid "New client added with public key:" -msgstr "选择经过验证的 SSH 公钥" +msgstr "添加了以下公钥的新客户端:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:19 msgid "" @@ -9389,62 +9387,44 @@ msgid "" msgstr "" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:28 -#, fuzzy -#| msgid "Serving Domains" msgid "Using domain:" -msgstr "服务域" +msgstr "使用域名:" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:33 msgid "Download config file" msgstr "下载配置文件" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:39 -#, fuzzy -#| msgid "Show QR Code" msgid "Show QR code" msgstr "显示二维码" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:45 -#, fuzzy -#| msgid "Show connection %(name)s" msgid "Show config parameters" -msgstr "显示连接 %(name)s" +msgstr "显示配置参数" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:55 -#, fuzzy -#| msgid "Public Key" msgid "Client Public Key" -msgstr "公钥" +msgstr "客户端公钥" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:59 -#, fuzzy -#| msgid "Private Key" msgid "Client Private Key" -msgstr "私钥" +msgstr "客户端私钥" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:63 -#, fuzzy -#| msgid "IP Address" msgid "Client IP Address" -msgstr "IP 地址" +msgstr "客户端 IP 地址" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:67 -#, fuzzy -#| msgid "Current DNS Server" msgid "Client DNS Server" -msgstr "当前 DNS 服务器" +msgstr "客户端 DNS 服务器" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:71 -#, fuzzy -#| msgid "Server public key:" msgid "Server/Peer Public Key" -msgstr "服务器公钥:" +msgstr "服务器/对端公钥" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:75 -#, fuzzy -#| msgid "Server endpoint:" msgid "Server/Peer Endpoint" -msgstr "服务器端点:" +msgstr "服务器/对端端点" #: freedombox/modules/wireguard/templates/wireguard_auto_add_client.html:79 msgid "Server/Peer Allowed IPs" @@ -9548,10 +9528,8 @@ msgid "Client with public key already exists" msgstr "已存在有公钥的客户端" #: freedombox/modules/wireguard/views.py:137 -#, fuzzy -#| msgid "Client deleted." msgid "Client Added" -msgstr "客户端已删除。" +msgstr "已添加客户端" #: freedombox/modules/wireguard/views.py:153 msgid "Allowed Client" diff --git a/freedombox/modules/backups/privileged.py b/freedombox/modules/backups/privileged.py index 516e3da54..aec330a2d 100644 --- a/freedombox/modules/backups/privileged.py +++ b/freedombox/modules/backups/privileged.py @@ -316,6 +316,12 @@ def delete_archive(path: str, encryption_passphrase: secret_str | None = None): _run(['borg', 'delete', path], encryption_passphrase) +@privileged +def compact(path: str): + """Compact segments and free repo disk space.""" + _run(['borg', 'compact', path]) + + def _extract(archive_path, destination, encryption_passphrase, locations=None): """Extract archive contents.""" prev_dir = os.getcwd() diff --git a/freedombox/modules/backups/repository.py b/freedombox/modules/backups/repository.py index bb1c1a25d..c065f7031 100644 --- a/freedombox/modules/backups/repository.py +++ b/freedombox/modules/backups/repository.py @@ -81,9 +81,9 @@ class BaseBorgRepository(abc.ABC): def prepare(): """Prepare the repository for operations.""" - @staticmethod - def cleanup(): + def cleanup(self): """Cleanup the repository after operations.""" + privileged.compact(self.borg_path) def get_info(self): """Return Borg information about a repository.""" @@ -317,6 +317,7 @@ class SshBorgRepository(BaseBorgRepository): def cleanup(self): """Cleanup the repository after operations by unmounting.""" + super().cleanup() self._umount_ignore_errors() @property diff --git a/freedombox/modules/homeassistant/__init__.py b/freedombox/modules/homeassistant/__init__.py index 1ea2a1917..45689ecc5 100644 --- a/freedombox/modules/homeassistant/__init__.py +++ b/freedombox/modules/homeassistant/__init__.py @@ -48,12 +48,12 @@ _description = [ ] -class HomeAssistnatApp(app_module.App): +class HomeAssistantApp(app_module.App): """FreedomBox app for Home Assistant.""" app_id = 'homeassistant' - _version = 1 + _version = 2 def __init__(self): """Create components for the app.""" @@ -97,7 +97,8 @@ class HomeAssistnatApp(app_module.App): self.add(firewall_local_protection) webserver = WebserverRoot('webserverroot-homeassistant', - 'home-assistant-freedombox') + 'home-assistant-freedombox', + last_updated_version=2) self.add(webserver) image_name = 'registry.freedombox.org/' \ @@ -133,8 +134,11 @@ class HomeAssistnatApp(app_module.App): self.get_component('shortcut-homeassistant').url = url self.info.clients[0]['platforms'][0]['url'] = url - def setup(self, old_version): + def setup(self, old_version: int): """Install and configure the app.""" super().setup(old_version) - privileged.setup() + privileged.setup(old_version) + + if not old_version: + self.enable() diff --git a/freedombox/modules/homeassistant/privileged.py b/freedombox/modules/homeassistant/privileged.py index 5295614a2..f6271a287 100644 --- a/freedombox/modules/homeassistant/privileged.py +++ b/freedombox/modules/homeassistant/privileged.py @@ -1,7 +1,9 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Configure Home Assistant.""" +import contextlib import functools +import json import pathlib import time import traceback @@ -9,10 +11,13 @@ from dataclasses import dataclass import yaml +from freedombox import action_utils from freedombox.actions import privileged -_settings_file = pathlib.Path( +_old_settings_file = pathlib.Path( '/var/lib/home-assistant-freedombox/config/configuration.yaml') +_settings_file = pathlib.Path( + '/var/lib/home-assistant-freedombox/config/.storage/http') @dataclass @@ -61,44 +66,93 @@ yaml_add_handlers() @privileged -def setup() -> None: +def setup(old_version: int) -> None: """Setup basic Home Assistant configuration.""" pathlib.Path('/var/lib/home-assistant-freedombox/').chmod(0o700) - try: - _wait_for_configuration_file() + if old_version == 1: + _migrate_old_configuration() - settings = _read_settings() - if 'http' not in settings: - settings['http'] = {} + _wait_for_configuration_file(_settings_file) - settings['http']['server_host'] = '127.0.0.1' - settings['http']['use_x_forwarded_for'] = True - settings['http']['trusted_proxies'] = '127.0.0.1' - _write_settings(settings) - except Exception as exception: - raise Exception( - traceback.format_tb(exception.__traceback__) + - [_settings_file.read_text()]) + with _ensure_stopped(): + try: + settings = _read_settings() + version = settings.get('version', 0) + if version != 2: + raise Exception( + f'Configuration format not understood: {version}.') + + settings.setdefault('data', {}) + settings['data'].setdefault('stable', {}) + settings['data']['stable']['server_host'] = '127.0.0.1' + settings['data']['stable']['use_x_forwarded_for'] = True + settings['data']['stable']['trusted_proxies'] = ['127.0.0.1'] + _write_settings(settings) + except Exception as exception: + raise Exception( + traceback.format_tb(exception.__traceback__) + + [_settings_file.read_text()]) -def _wait_for_configuration_file() -> None: +def _wait_for_configuration_file(settings_file: pathlib.Path) -> None: """Wait until the Home Assistant daemon creates a configuration file.""" start_time = time.time() while time.time() < start_time + 300: - if _settings_file.exists(): + if settings_file.exists(): break time.sleep(1) def _read_settings() -> dict: - """Load settings as dictionary from YAML config file.""" - with _settings_file.open('rb') as settings_file: - return yaml.load(settings_file, Loader=YAMLLoader) + """Load internal storage for HTTP configuration.""" + with _settings_file.open('rb') as file_handle: + return json.load(file_handle) def _write_settings(settings: dict): + """Write HTTP configuration into internal storage.""" + with _settings_file.open('w') as file_handle: + return json.dump(settings, file_handle, indent=2) + + +def _migrate_old_configuration(): + """Migrate old configuration file.""" + _wait_for_configuration_file(_old_settings_file) + try: + settings = _read_old_settings() + if 'http' in settings: + del settings['http'] + + _write_old_settings(settings) + except Exception as exception: + print('Unable to upgrade old configuration file.', exception) + + +def _read_old_settings() -> dict: + """Load settings as dictionary from YAML config file.""" + with _old_settings_file.open('rb') as file_handle: + return yaml.load(file_handle, Loader=YAMLLoader) + + +def _write_old_settings(settings: dict): """Write settings from dictionary to YAML config file.""" - with _settings_file.open('w', encoding='utf-8') as settings_file: - yaml.dump(settings, settings_file, Dumper=YAMLDumper) + with _old_settings_file.open('w', encoding='utf-8') as file_handle: + yaml.dump(settings, file_handle, Dumper=YAMLDumper) + + +@contextlib.contextmanager +def _ensure_stopped(): + """Ensure that the service is stopped.""" + name = 'home-assistant-freedombox' + + starting_state = action_utils.service_is_running(name) + if starting_state: + action_utils.service_disable(name) + + try: + yield starting_state + finally: + if starting_state: + action_utils.service_enable(name)