Files
mostafa-ismail-2004 ff1aa131f6 fix(cli): address review findings on the terminal command
- Background launches keep the launcher's switches, so Snap's
  --no-sandbox reaches Electron and the app can start confined.
- A crashed backend fails fast instead of waiting out the startup budget.
- The AUR launcher runs the renamed executable, and package-managed
  installs (VOICESTUDIO_DISABLE_UPDATER=1) are told to update through
  their package manager instead of opening a disabled updater.
- Windows: PATH is edited in the registry as stored (unexpanded entries,
  same value type); the warning never blocks a silent install; an
  update keeps the PATH entry in case it rolls back.
- Relative command links are resolved against their own folder, and
  bash users with ~/.bash_profile get the PATH entry there.
- Settings shows a translated, actionable message when PATH setup fails.
- Tests: the network guard also blocks connect_ex and sendto; the lock
  tests synchronize on events instead of sleeps and kill the holder to
  test a real crash; a Windows path assertion is separator-agnostic.
2026-11-05 19:40:27 +02:00

38 lines
1.9 KiB
Python

"""VoiceStudio application releases; installing an update belongs to the app's own updater."""
import os
from .application import installed_application
from .errors import CLIError
def install_info(app=None):
app = app or installed_application()
instructions = {
'source': 'Update and rebuild VoiceStudio from its source checkout.',
'store': ('Update VoiceStudio through Snap.' if app.distribution == 'snap-store' else
'Update VoiceStudio through the Mac App Store.'),
'directory': 'Install an application package to enable managed updates.',
}
# Package managers (the AUR package, for one) turn the app's updater off.
managed = os.environ.get('VOICESTUDIO_DISABLE_UPDATER') == '1'
automatic = app.method in {'appimage', 'dmg', 'nsis', 'deb'} and not managed
fallback = ('Run voicestudio update, or use Settings → Updates in the app.' if automatic
else 'Update VoiceStudio with the package manager that installed it.' if managed
else 'Update VoiceStudio using its application installer.')
return app.info() | {'automatic': automatic, 'instructions': instructions.get(app.method, fallback)}
def open_app_updater(info):
"""Hand the update to the app, which checks, downloads, verifies and installs it.
The CLI makes no network requests of its own: the app's updater is the one
sanctioned update check, and it uses the channel chosen in Settings → Updates.
"""
if not info['automatic']:
raise CLIError('update_unsupported', info['instructions'])
from .desktop import CHECK_UPDATES_FLAG, desktop_process
desktop_process([CHECK_UPDATES_FLAG], detached=True)
return {'current': info['version'], 'opened': True,
'message': f'VoiceStudio {info["version"]} opened Settings → Updates to check for an update. '
'Updates download and install from there.'}