This commit is contained in:
2026-06-08 13:21:47 -05:00
parent 601c0b5cc5
commit eb2d9ab61a
7 changed files with 38 additions and 30 deletions
+8 -12
View File
@@ -6,11 +6,7 @@ import struct
import subprocess
import urllib.request
from pathlib import Path
vpncache = Path("/tmp/vpn_country.cache")
screenshotflag = Path("/tmp/screenshot_active")
from warehouse import Vpn_cache, Media_flag
class Cached:
def __init__(self, ttl):
@@ -93,13 +89,13 @@ class StatusBar:
def get_vpn(self):
def compute():
if not self.run(["wg", "show", "interfaces"]):
if vpncache.exists():
vpncache.unlink()
if Vpn_cache.exists():
Vpn_cache.unlink()
return ""
country = ""
if vpncache.exists():
country = vpncache.read_text().strip()
if Vpn_cache.exists():
country = Vpn_cache.read_text().strip()
if not country:
ip = http_get("https://ifconfig.me")
@@ -112,7 +108,7 @@ class StatusBar:
country = ""
if country:
vpncache.write_text(country)
Vpn_cache.write_text(country)
return f"VPN: {country or 'Unknown'}"
@@ -125,8 +121,8 @@ class StatusBar:
return self.rec.get(compute)
def get_time(self):
if screenshotflag.exists():
return "REDACTED"
if Media_flag.exists():
return "0001-01-01 12:00 AM"
return self.run(["date", "+%Y-%m-%d %I:%M %p"])
def render(self):