fix(doxless): typecheck, use os.walk for cross-platform

master
htran 2024-10-04 20:30:33 -07:00
parent 26fb2f5563
commit 05693709d5
2 changed files with 26 additions and 3 deletions

View File

@ -32,3 +32,25 @@ profile sharing process.
- [r2modman](https://github.com/ebkr/r2modmanPlus/tags) is in `%AppData%/r2modmanPlus-local/RiskOfRain2/profiles`
- [thunderstore (WARNING: DOWNLOAD ON CLICK)](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager) is in `%AppData%/Thunderstore\ Mod\ Manager/DataFolder/RiskOfRain2/profiles`
**Doxxing yourself**
I've provided [script to check for dox](./scripts/doxless.py), turns out
r2modman:
- Uses abspath, of Windows machines, on `%AppData%` (default: `SysDrive:/User/<USERNAME>/AppData/Roaming`)
for icon paths
- Does not erase this information
This is one way to leak information. I did not remove it in the current sync.
The r2modman's importer can just check for validity and go grab a different path.
Note that you'll probably will have a much better performance via `rg $USER`,
this script currently doesn't offer much.
```sh
python3 scripts/doxless.py
"""
*.mods.yml
"""
```

7
scripts/doxless.py Normal file → Executable file
View File

@ -5,7 +5,7 @@ import os
import time
import sys
def in_content(needle: str, pathlike: str):
def in_content(needle: str, pathlike: str | pathlib.Path):
content = ""
try:
# NB: latin-1 since we actually do have some language translation files
@ -16,7 +16,7 @@ def in_content(needle: str, pathlike: str):
return needle in content
def gitignore_patterns(gitignore_f: str | None = None):
def gitignore_patterns(gitignore_f: str):
with open(gitignore_f, 'r') as f:
return {line for line in (line.strip() for line in f) if not line.startswith('#') and line}
@ -33,7 +33,8 @@ def main():
username_in_content = []
user_lower = username.lower()
for root, dirs, filenames in pathlib.Path("./").walk():
for _root, dirs, filenames in os.walk(pathlib.Path("./")):
root = pathlib.Path(_root)
absdirs = [
e
for e in ((root.joinpath(d), d) for d in dirs)