emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/zuul 0003af3679 10/17: Add functions for anonymized scr


From: ELPA Syncer
Subject: [elpa] externals/zuul 0003af3679 10/17: Add functions for anonymized screenshots
Date: Tue, 30 Aug 2022 11:58:25 -0400 (EDT)

branch: externals/zuul
commit 0003af3679c223f087ea6c835a2fec31f643f64b
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Add functions for anonymized screenshots
---
 notes.org | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/notes.org b/notes.org
index 9a96e4146c..34aa58d165 100644
--- a/notes.org
+++ b/notes.org
@@ -105,3 +105,65 @@ Select and open a build retrieved with 
=zuul-get-buildsets=.
      (zuul-get-buildsets
       :change "300203")))
 #+end_src
+
+* Screenshots
+
+** Anonymize
+
+Add functions used to =anonymize= data.
+
+#+begin_src elisp :results none
+  (defun zuul-anonymize-build-name (build)
+    (with-temp-buffer
+      (insert (let-alist (zuul-data build) .job_name))
+      (unpackaged/lorem-ipsum-overlay t)
+      (buffer-string)))
+
+  (defun zuul-anonymize-buffer-with-overlay (&rest args)
+    (unpackaged/lorem-ipsum-overlay)
+    (setq mode-line-format nil))
+
+  (defun zuul-anonymize-buffer (&rest args)
+    (unpackaged/lorem-ipsum-overlay)
+    (setq mode-line-format nil))
+
+  (defun zuul-anonymize-silence-messages (orig-fun &rest args)
+    (let ((inhibit-message t))
+      (apply orig-fun args)))
+
+  (defun zuul-anonymize-task-command (data)
+    (let ((command
+           (pcase-let* ((`(,_hostname . ,data) (plist-get data ':host))
+                        (cmd-str (let-alist data .cmd)))
+             (if (stringp cmd-str)
+                 cmd-str
+               (mapconcat #'identity cmd-str " ")))))
+      (with-temp-buffer
+        (insert command)
+        (unpackaged/lorem-ipsum-overlay t)
+        (buffer-string))))
+#+end_src
+
+Add =advices= around functions that could be sensitive.
+
+#+begin_src elisp :results none
+  (advice-add 'zuul--data-host-cmd-str :override #'zuul-anonymize-task-command)
+  (advice-add 'url-insert-file-contents :around 
#'zuul-anonymize-silence-messages)
+  (advice-add 'compile-goto-error :around #'zuul-anonymize-silence-messages)
+  (advice-add 'compile-goto-error :after #'zuul-anonymize-buffer)
+  (advice-add 'zuul-log-mode :after #'zuul-anonymize-buffer-with-overlay)
+  (advice-add 'zuul--build-name-str :override #'zuul-anonymize-build-name)
+  (toggle-frame-tab-bar)
+#+end_src
+
+Remove advices and settings to restore original behavior.
+
+#+begin_src elisp :results none
+  (advice-remove 'zuul--data-host-cmd-str #'zuul-anonymize-task-command)
+  (advice-remove 'url-insert-file-contents #'zuul-anonymize-silence-messages)
+  (advice-remove 'compile-goto-error #'zuul-anonymize-silence-messages)
+  (advice-remove 'compile-goto-error #'zuul-anonymize-buffer)
+  (advice-remove 'zuul-log-mode #'zuul-anonymize-buffer-with-overlay)
+  (advice-remove 'zuul--build-name-str #'zuul-anonymize-build-name)
+  (toggle-frame-tab-bar)
+#+end_src



reply via email to

[Prev in Thread] Current Thread [Next in Thread]