ynput / ayon-launcher

AYON desktop application launcher
Apache License 2.0
31 stars 13 forks source link

WebActions: Launcher can handle webactions #121

Closed iLLiCiTiT closed 1 month ago

iLLiCiTiT commented 2 months ago

Changelog Description

AYON launcher is capable of handling ayon-launcher scheme using shims.

Additional info

AYON launcher is handling ayon-launcher scheme. On all platfrorms is the handling done using shim as startup executable. This way we have only one executable registered for handling of the scheme without being worried about different AYON launcher versions.

On macOs is scheme defined in shim's plist. On linux we use ayon.desktop which is also used for showing shortcut in apps menu. On windows is necessary to register the scheme, for that is necessary to have admin privileges and installation of shims will ask for them. At this moment this happens only on first shim installation, and there is no easy way how to register it afterwards.

We can prepare .reg file for windows admins so they can easily deploy and register shims without huge amount of job (or maybe just add expected content of reg file to README.md).

Testing notes:

  1. Make sure you have AYON server with these branches https://github.com/ynput/ayon-backend/pull/183 and https://github.com/ynput/ayon-frontend/pull/563 .
  2. If you've already tested https://github.com/ynput/ayon-launcher/pull/112 then remove existing deployed shim (%LOCALAPPDATA%\Ynput\AYON\shim`).
  3. Remove .poetry, .venv and vendor folders in AYON launcher root.
  4. Run ./tools/manage.ps1 create-env.
  5. Run ./tools/manage.ps1 install-runtime.
  6. Run ./tools/manage.ps1 build-make-installer.
  7. If all successfully finished then upload installer to your AYON server and install it.
  8. Install ayon-applications addon from this PR https://github.com/ynput/ayon-applications/pull/1 and restart server.
  9. Use it in your production or develop bundle.
  10. Select a task of your choice.
  11. You should see applications actions (If you have checked Develop mode, then you'll see actions from dev bundle),
  12. Run one of them.

Advanced testing notes:

You don't have to have build AYON launcher for testing webactions on windows. It is possible to point to a powershell script and create schema handler manually. It must be powershell, because .bat file handles & in argument as "execute following string".

Create <ayon-launcher>/tools/ayon_console.ps1 with this content:

$current_dir = Get-Location
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$repo_root = (Get-Item $script_dir).parent.FullName
$poetry_home = "$repo_root\.poetry"

Set-Location -Path $repo_root

$arguments=@()
for ($i=0; $i -lt $args.Length; $i++)
{
    $arg = $args[$i].Replace("&", "^&")
    $arguments += $arg
}
try {
    & $poetry_home\bin\poetry.exe run python "$( $repo_root )\start.py" $arguments
} finally {
    Set-Location -Path $current_dir
}

Create file ayon-launcher.reg with this content (replace <FILL THIS PATH> with your path) and open the file.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ayon-launcher]
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ayon-launcher\DefaultIcon]
@="<FILL THIS PATH>\\ayon-launcher\\common\\ayon_common\\resources\\AYON.ico"

[HKEY_CLASSES_ROOT\ayon-launcher\shell]

[HKEY_CLASSES_ROOT\ayon-launcher\shell\open]

[HKEY_CLASSES_ROOT\ayon-launcher\shell\open\command]
@="Powershell.exe -File "<FILL THIS PATH>\\ayon-launcher\\tools\\ayon_console.ps1" \"%1\""
ynbot commented 2 months ago

Task linked: AY-5077 AYON launcher shims Task linked: AY-5950 AYON Launcher handle webactions