Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a

This commit is contained in:
OverSu 2026-11-28 12:20:19 +01:00
commit 3a1fba4efe
2 changed files with 1301 additions and 196 deletions

View file

@ -94,6 +94,12 @@ def request(value):
calls.append({'path': path, 'state': state,
'number': str(field('LineIdentification') or '')[:80]})
return calls
if operation == 'imei':
properties = bus('org.ofono', MODEM, 'org.ofono.Modem', 'GetProperties')[0]
serial = properties.get('Serial', {}).get('data')
if not isinstance(serial, str) or not re.fullmatch(r'[0-9]{15}', serial):
raise RuntimeError('RADIO_NOT_READY')
return serial
if operation == 'status':
return {
'modem': bus('org.ofono', MODEM, 'org.ofono.Modem', 'GetProperties'),

View file

@ -82,7 +82,7 @@ def networks(rescan=False):
mode = 'unsupported'
found.append({'id': ident, 'ssid': ssid, 'signal': int(signal),
'security': mode, 'connected': active == '*'})
return sorted(found, key=lambda row: -row['signal'])[:128]
return sorted(found, key=lambda row: (not row['connected'], -row['signal']))[:128]
def connection_info():
@ -96,9 +96,12 @@ def connection_info():
device = nm('-g','GENERAL.DBUS-PATH','device','show',DEVICE,timeout=5)
path=device.stdout.strip() if device.returncode==0 else ''
if re.fullmatch(r'/org/freedesktop/NetworkManager/Devices/[0-9]+',path):
speed=subprocess.run(['/usr/bin/busctl','--system','--timeout=2','--json=short','get-property',
'org.freedesktop.NetworkManager',path,'org.freedesktop.NetworkManager.Device.Wireless','Bitrate'],
capture_output=True,text=True,timeout=3)
try:
speed=subprocess.run(['/usr/bin/busctl','--system','--timeout=2','--json=short','get-property',
'org.freedesktop.NetworkManager',path,'org.freedesktop.NetworkManager.Device.Wireless','Bitrate'],
capture_output=True,text=True,timeout=3)
except (OSError, subprocess.TimeoutExpired):
return info
if speed.returncode==0:
try:
kbps=json.loads(speed.stdout)['data']
@ -108,6 +111,14 @@ def connection_info():
return info
def profile_ssid(value):
# NetworkManager keyfiles accept either a string or a list of octets.
if re.fullmatch(r'(?:[0-9]+;)+', value):
return bytes(int(part) for part in value[:-1].split(';')).decode()
escapes = {'s':' ', 't':'\t', 'n':'\n', 'r':'\r', '\\':'\\', ';':';'}
return re.sub(r'\\([stnr\\;])', lambda match: escapes[match[1]], value)
def saved_profiles(profile_dir):
result = []
for path in profile_dir.glob('vulpes-*.nmconnection'):
@ -119,7 +130,7 @@ def saved_profiles(profile_dir):
uid = str(uuid.UUID(parser['connection']['uuid']))
if path.name != 'vulpes-' + uid + '.nmconnection':
continue
ssid = bytes(int(b) for b in parser['wifi']['ssid'].split(';') if b).decode()
ssid = profile_ssid(parser['wifi']['ssid'])
mode = parser.get('wifi-security', 'key-mgmt', fallback='open')
result.append({'id': uid, 'ssid': ssid, 'security': mode, 'known': True})
except (OSError, ValueError, KeyError, configparser.Error):
@ -191,21 +202,21 @@ def device_state():
return state
def current_network(profile_dir, observed=()):
def current_network(profile_dir, state, observed=()):
"""Resolve the active profile to a remembered SSID if scan results omit it."""
if device_state() != 'connected':
if state not in ('connecting', 'connected'):
return None
uid = active_wifi_uuid()
if not uid or uid == HOTSPOT_UUID:
return None
for network in observed:
if network.get('connected'):
return network
if state == 'connected' and network.get('connected'):
return {**network, 'savedId': uid}
saved = next((row for row in saved_profiles(profile_dir) if row['id'] == uid), None)
if not saved:
return None
return {'ssid': saved['ssid'], 'security': saved['security'],
'relSignalStrength': 0, 'savedId': uid, 'connected': True}
'signal': 0, 'savedId': uid, 'connected': state == 'connected'}
def hotspot_state(profile_dir):
@ -213,7 +224,7 @@ def hotspot_state(profile_dir):
result={'enabled':active_wifi_uuid()==HOTSPOT_UUID,'configured':False,'ssid':'Vulpes OS','security':'wpa2-psk','password':''}
if path.exists() and not path.is_symlink():
config=configparser.ConfigParser(interpolation=None);config.read(path)
result.update(configured=True,ssid=bytes(int(b) for b in config['wifi']['ssid'].split(';') if b).decode(),
result.update(configured=True,ssid=profile_ssid(config['wifi']['ssid']),
security='wpa2-psk' if config.has_section('wifi-security') else 'open',
password=re.sub(r'\\([\\s])',lambda match:' ' if match[1]=='s' else '\\',config.get('wifi-security','psk',fallback='')))
return result
@ -303,9 +314,15 @@ def dispatch(request, profile_dir=PROFILE_DIR):
stored = next((row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
network.update(known=stored is not None, savedId=stored['id'] if stored else None)
state = device_state() if enabled else 'disabled'
active = current_network(profile_dir, found) if state == 'connected' else None
observed = found
if state == 'connected' and operation != 'scan':
try:
observed = networks(rescan=False)
except WifiError:
observed = []
active = current_network(profile_dir, state, observed)
info={}
if active:
if active and state == 'connected':
try:info=connection_info()
except (WifiError,OSError,subprocess.TimeoutExpired):pass
return {'enabled': enabled, 'state':state, 'network':active,
@ -323,10 +340,13 @@ def dispatch(request, profile_dir=PROFILE_DIR):
raise WifiError('WIFI_INVALID_REQUEST')
network={'ssid':ssid,'security':security,'hidden':True}
else:
network = next((row for row in networks() if row['id'] == request.get('id')), None)
network = next((row for row in saved if row['id'] == request.get('id')), None)
if network is None:
network = next((row for row in networks() if row['id'] == request.get('id')), None)
if network is None:
raise WifiError('WIFI_NETWORK_GONE')
stored = next((row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
stored = network if network.get('known') else next(
(row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
uid = stored['id'] if stored else str(uuid.uuid4())
target = profile_dir / ('vulpes-' + uid + '.nmconnection')
previous = target.read_text() if stored else None