From 9525651000967f97afe6f5fe8dfd85363d9fe421 Mon Sep 17 00:00:00 2001 From: anonym Date: Wed, 21 Aug 2024 12:14:53 +0200 Subject: [PATCH] Welcome Screen: add facility for opening WhisperBack after login This is useful when errors are encountered at the Welcome Screen and we want to encourage users to send us a WhisperBack report. --- config/chroot_local-hooks/52-update-rc.d | 1 + .../python3/dist-packages/tailsgreeter/ui/main_window.py | 11 +++++++++++ .../lib/systemd/user/tails-post-greeter-whisperback.service | 13 +++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 config/chroot_local-includes/usr/lib/systemd/user/tails-post-greeter-whisperback.service diff --git a/config/chroot_local-hooks/52-update-rc.d b/config/chroot_local-hooks/52-update-rc.d index fb4a60350fa..6aff0c8f0e8 100755 --- a/config/chroot_local-hooks/52-update-rc.d +++ b/config/chroot_local-hooks/52-update-rc.d @@ -45,6 +45,7 @@ systemctl --global enable tails-htpdate-notify-user.service systemctl --global enable tails-dump-user-env.service systemctl --global enable tails-start-system-gnome-session-target.service systemctl --global enable tails-post-greeter-docs.service +systemctl --global enable tails-post-greeter-whisperback.service # This causes the proxies to run during the whole session, instead of # being started and stopped when needed. The only app which needs diff --git a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py index 4dd4c769cde..c63790008d8 100644 --- a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py +++ b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py @@ -18,6 +18,7 @@ import logging import threading from typing import TYPE_CHECKING import gi +import json import os import tailsgreeter # NOQA: E402 @@ -492,6 +493,16 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow): if response == Gtk.ResponseType.OK: self.unlock_tps(forceful_fsck=True) + def open_prefilled_whisperback_after_login(self, app: str, summary: str): + with open("/var/lib/gdm3/post-greeter-whisperback.json", "w") as f: + json.dump( + { + "app": app, + "summary": summary, + }, + f, + ) + def open_help_after_login(self, doc: str): with open("/var/lib/gdm3/post-greeter-docs.url", "w") as f: f.write(doc) diff --git a/config/chroot_local-includes/usr/lib/systemd/user/tails-post-greeter-whisperback.service b/config/chroot_local-includes/usr/lib/systemd/user/tails-post-greeter-whisperback.service new file mode 100644 index 00000000000..523add5512d --- /dev/null +++ b/config/chroot_local-includes/usr/lib/systemd/user/tails-post-greeter-whisperback.service @@ -0,0 +1,13 @@ +[Unit] +Description=Report errors detected at the Welcome Screen +Documentation=https://tails.net/doc/first_steps/whisperback/ +ConditionUser=1000 +ConditionPathExists=/var/lib/gdm3/post-greeter-whisperback.json + +[Service] +Type=oneshot +ExecStart=whisperback /var/lib/gdm3/post-greeter-whisperback.json +RemainAfterExit=yes + +[Install] +WantedBy=desktop.target -- 2.11.4.GIT