fullpwerr commited on
Commit
aba37f8
·
1 Parent(s): cf275f8

Update cache and configuration paths to use /tmp for improved isolation

Browse files
Files changed (1) hide show
  1. app/utils.py +6 -1
app/utils.py CHANGED
@@ -3,9 +3,11 @@ import time
3
  import undetected_chromedriver as uc
4
  from selenium.webdriver.common.by import By
5
 
6
- # Force all cache to go to /tmp/.cache
7
  os.environ["XDG_CACHE_HOME"] = "/tmp/.cache"
8
  os.environ["XDG_CONFIG_HOME"] = "/tmp/.config"
 
 
9
 
10
  def bypass_shinigami(url: str) -> dict:
11
  options = uc.ChromeOptions()
@@ -17,6 +19,9 @@ def bypass_shinigami(url: str) -> dict:
17
  options.add_argument("--disable-dev-tools")
18
  options.add_argument("--disable-setuid-sandbox")
19
  options.add_argument("--remote-debugging-port=9222")
 
 
 
20
 
21
  driver = uc.Chrome(options=options, headless=True)
22
 
 
3
  import undetected_chromedriver as uc
4
  from selenium.webdriver.common.by import By
5
 
6
+ # Paksa semua cache/config/data ke /tmp
7
  os.environ["XDG_CACHE_HOME"] = "/tmp/.cache"
8
  os.environ["XDG_CONFIG_HOME"] = "/tmp/.config"
9
+ os.environ["XDG_DATA_HOME"] = "/tmp/.local/share"
10
+ os.environ["HOME"] = "/tmp"
11
 
12
  def bypass_shinigami(url: str) -> dict:
13
  options = uc.ChromeOptions()
 
19
  options.add_argument("--disable-dev-tools")
20
  options.add_argument("--disable-setuid-sandbox")
21
  options.add_argument("--remote-debugging-port=9222")
22
+ # Paksa user-data-dir dan cache ke /tmp
23
+ options.add_argument("--user-data-dir=/tmp/chrome-user-data")
24
+ options.add_argument("--disk-cache-dir=/tmp/.cache/chrome")
25
 
26
  driver = uc.Chrome(options=options, headless=True)
27