mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 15:12:48 +01:00
feat: redact API key in log table
This commit is contained in:
1 parent
190face11d
commit
5483717e0c
4 files changed
+24
-2
No files matched your search
@@ -13,6 +13,7 @@
|
|||||||
- Documentation ships with source
|
- Documentation ships with source
|
||||||
- Open filepicker when generating system log
|
- Open filepicker when generating system log
|
||||||
- Developers page (and -d flag)
|
- Developers page (and -d flag)
|
||||||
|
- Redact API key in log table
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
- Reduce padding on keys button
|
- Reduce padding on keys button
|
||||||
|
|||||||
+19
-2
@@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import locale
|
import locale
|
||||||
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
import textwrap
|
import textwrap
|
||||||
@@ -437,9 +438,25 @@ class Controller:
|
|||||||
with open(log, "r") as f:
|
with open(log, "r") as f:
|
||||||
lines = [line.split(strings.delimiter) for line in f.read().splitlines()]
|
lines = [line.split(strings.delimiter) for line in f.read().splitlines()]
|
||||||
for record in lines:
|
for record in lines:
|
||||||
store.append(record)
|
clean = self.redact_log(record)
|
||||||
|
store.append(clean)
|
||||||
self.open_page(NotebookPage.LOG)
|
self.open_page(NotebookPage.LOG)
|
||||||
|
|
||||||
|
def redact_log(self, record: list) -> list[str]:
|
||||||
|
"""
|
||||||
|
requests library includes Steam API key in URL params
|
||||||
|
"""
|
||||||
|
clean = []
|
||||||
|
for item in record:
|
||||||
|
if "&key=" in item:
|
||||||
|
pat = r"(.*&key=)(\S+)(.*)"
|
||||||
|
scrubbed = re.sub(pat, r"\1REDACTED\3", item)
|
||||||
|
clean.append(scrubbed)
|
||||||
|
else:
|
||||||
|
clean.append(item)
|
||||||
|
return clean
|
||||||
|
|
||||||
|
|
||||||
def select_colorized(self) -> None:
|
def select_colorized(self) -> None:
|
||||||
model = self.model_manager.get_mod_store()
|
model = self.model_manager.get_mod_store()
|
||||||
sel = self.mediator.modtreeview.get_selection()
|
sel = self.mediator.modtreeview.get_selection()
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
- Documentation ships with source
|
- Documentation ships with source
|
||||||
- Open filepicker when generating system log
|
- Open filepicker when generating system log
|
||||||
- Developers page (and -d flag)
|
- Developers page (and -d flag)
|
||||||
|
- Redact API key in log table
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
- Reduce padding on keys button
|
- Reduce padding on keys button
|
||||||
|
|||||||
@@ -487,8 +487,11 @@ class Options(Gtk.Box):
|
|||||||
|
|
||||||
|
|
||||||
active_combo = 1 if config["branch"] == BETA_REPO else 0
|
active_combo = 1 if config["branch"] == BETA_REPO else 0
|
||||||
|
|
||||||
|
self.controller.suppress_signal(self, self.branch_combo, "_on_branch_changed", True)
|
||||||
self.branch_combo.set_active(active_combo)
|
self.branch_combo.set_active(active_combo)
|
||||||
self.branch_combo.set_sensitive(prefs.allow_updates)
|
self.branch_combo.set_sensitive(prefs.allow_updates)
|
||||||
|
self.controller.suppress_signal(self, self.branch_combo, "_on_branch_changed", False)
|
||||||
|
|
||||||
if prefs.allow_updates is True:
|
if prefs.allow_updates is True:
|
||||||
msg = strings.options.self_update
|
msg = strings.options.self_update
|
||||||
|
|||||||
Reference in new issue
Block a user