update
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user