mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
Add a Remote Viewer.app that registers as a handler for .vv connection files. The app is built as an AppleScript droplet that copies the file to a temporary location (for quarantine compatibility) and launches remote-viewer. The original file is removed if it contains delete-this-file=1 (as remote-viewer does itself). Includes an +app_as_root variant that prompts for administrator privileges before launching. This is less secure but needed for USB forwarding.
18 lines
728 B
AppleScript
18 lines
728 B
AppleScript
on open theFiles
|
|
repeat with oneFile in theFiles
|
|
set srcPath to POSIX path of oneFile
|
|
set tmpPath to do shell script "/usr/bin/mktemp -t remote-viewer-vv"
|
|
|
|
do shell script "/bin/cp " & quoted form of srcPath & " " & quoted form of tmpPath
|
|
try
|
|
do shell script "/usr/bin/grep -q '^delete-this-file[[:space:]]*=[[:space:]]*[^0[:space:]]' " & quoted form of srcPath
|
|
do shell script "/bin/rm -f " & quoted form of srcPath
|
|
end try
|
|
do shell script "@PREFIX@/bin/remote-viewer " & quoted form of tmpPath & " > /dev/null 2>&1 &"@PRIVILEGES@
|
|
end repeat
|
|
end open
|
|
|
|
on run
|
|
do shell script "@PREFIX@/bin/remote-viewer > /dev/null 2>&1 &"@PRIVILEGES@
|
|
end run
|