Skip to content

Commit

Permalink
aisingapore#1151 - support tagui_no_sandbox config
Browse files Browse the repository at this point in the history
  • Loading branch information
kensoh committed Dec 17, 2021
1 parent 981c934 commit 1887d35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Free RPA tool by [AI Singapore](https://aisingapore.org), a government-funded programme to accelerate AI. To start, click the download link below. Join the community or ask any questions at [our Telegram](https://t.me/rpa_chat).**

**[Download v6.101](https://tagui.readthedocs.io/en/latest/setup.html) | [Usage Guide](https://tagui.readthedocs.io/en/latest/index.html) | [Demos](https://github.com/aimakerspace/TagUI-Bricks) | [Samples](https://github.com/kelaberetiv/TagUI/tree/master/flows/samples) | [Slides](https://docs.google.com/presentation/d/1pltAMzr0MZsttgg1w2ORH3ontR6Q51W9/edit?usp=sharing&ouid=115132044557947023533&rtpof=true&sd=true) | [Podcast](https://botnirvana.org/podcast/tagui/) | [Video](https://www.youtube.com/watch?v=C5itbB3sCq0) | [Forum](https://community.aisingapore.org/groups/tagui-rpa/forum/) | [Zoom](https://github.com/kelaberetiv/TagUI/issues/914)**
**[Download v6.102](https://tagui.readthedocs.io/en/latest/setup.html) | [Usage Guide](https://tagui.readthedocs.io/en/latest/index.html) | [Demos](https://github.com/aimakerspace/TagUI-Bricks) | [Samples](https://github.com/kelaberetiv/TagUI/tree/master/flows/samples) | [Slides](https://docs.google.com/presentation/d/1pltAMzr0MZsttgg1w2ORH3ontR6Q51W9/edit?usp=sharing&ouid=115132044557947023533&rtpof=true&sd=true) | [Podcast](https://botnirvana.org/podcast/tagui/) | [Video](https://www.youtube.com/watch?v=C5itbB3sCq0) | [Forum](https://community.aisingapore.org/groups/tagui-rpa/forum/) | [Zoom](https://github.com/kelaberetiv/TagUI/issues/914)**

---

Expand Down
9 changes: 6 additions & 3 deletions src/tagui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ chrome_command="google-chrome"

if [ -z "$1" ]
then
echo "tagui v6.101: use following options and this syntax to run - ./tagui flow_filename option(s)"
echo "tagui v6.102: use following options and this syntax to run - ./tagui flow_filename option(s)"
echo
echo "tagui live launch TagUI live mode enabled with visual automation for interactive development"
echo "tagui update download and update to latest TagUI version (please backup your version beforehand)"
Expand Down Expand Up @@ -361,6 +361,9 @@ if [ "$tagui_web_browser" == "chrome" ]; then height="$(($height + 74))"; fi; wi
# setting to run chrome in headless mode if headless option is used
headless_switch=""; if [ "$tagui_web_browser" == "headless" ]; then headless_switch="--headless --disable-gpu"; fi

# check for tagui_no_sandbox for running chrome as root or in docker
no_sandbox_switch=""; if [ -f tagui_no_sandbox ]; then no_sandbox_switch="--no-sandbox"; fi

# skip restarting chrome in speed mode and resuse 1st websocket url
if [ "$tagui_data_set" -eq 1 ] || [ "$tagui_speed_mode" == false ]; then

Expand All @@ -376,7 +379,7 @@ echo "ERROR - cannot find \"$tagui_browser_command\""
echo "$tagui_custom_browser is at a non-standard location on your macOS, raise an issue on t.me/rpa_chat"; exit 1; fi
chrome_process_id="$(ps x | grep remote-debugging-port=9222 | grep tagui_user_profile | grep window-size | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$chrome_process_id" ]; then kill $chrome_process_id; fi
"$tagui_browser_command" --user-data-dir="$TAGUI_DIR/chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch > /dev/null 2>&1 &
"$tagui_browser_command" --user-data-dir="$TAGUI_DIR/chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch $no_sandbox_switch > /dev/null 2>&1 &
else
if [ "$tagui_custom_browser" == "Edge" ]; then
chrome_command="microsoft-edge"
Expand All @@ -386,7 +389,7 @@ echo "ERROR - cannot find \"$chrome_command\" command on your Linux to launch we
echo "update chrome_command setting in tagui/src/tagui and make sure symlink is created"; exit 1; fi
chrome_process_id="$(ps x | grep remote-debugging-port=9222 | grep tagui_user_profile | grep window-size | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$chrome_process_id" ]; then kill $chrome_process_id; fi
$chrome_command --user-data-dir="$TAGUI_DIR/chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch > /dev/null 2>&1 &
$chrome_command --user-data-dir="$TAGUI_DIR/chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch $no_sandbox_switch > /dev/null 2>&1 &
fi

# wait until chrome is ready with websocket url for php thread
Expand Down
8 changes: 6 additions & 2 deletions src/tagui.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rem enable windows for loop advanced flow control
setlocal enableextensions enabledelayedexpansion

if "%~1"=="" (
echo tagui v6.101: use following options and this syntax to run - tagui flow_filename option^(s^)
echo tagui v6.102: use following options and this syntax to run - tagui flow_filename option^(s^)
echo.
echo tagui live launch TagUI live mode enabled with visual automation for interactive development
echo tagui update download and update to latest TagUI version ^(please backup your version beforehand^)
Expand Down Expand Up @@ -1120,6 +1120,10 @@ if exist "tagui_chrome.in" (
set headless_switch=
if "%tagui_web_browser%"=="headless" set headless_switch=--headless --disable-gpu

rem check for tagui_no_sandbox for running chrome as root or in docker
set no_sandbox_switch=
if exist "tagui_no_sandbox" set no_sandbox_switch=--no-sandbox

rem skip restarting chrome in speed mode and resuse 1st websocket url
set or_result=F
if !tagui_data_set! equ 1 set or_result=T
Expand Down Expand Up @@ -1148,7 +1152,7 @@ if exist "tagui_chrome.in" (
for /f "tokens=* usebackq" %%p in (`wmic process where "caption like '%%chrome.exe%%' and commandline like '%%tagui_user_profile_ --remote-debugging-port=9222%%' and not commandline like '%%--type=renderer%%'" get processid 2^>nul ^| cut -d" " -f 1 ^| sort -nur ^| head -n 1`) do set chrome_process_id=%%p
)
if not "!chrome_process_id!"=="" taskkill /PID !chrome_process_id! /T /F > nul 2>&1
start "" "!chrome_command!" --user-data-dir="%~dp0chrome\tagui_user_profile" !chrome_switches! !window_size! !headless_switch!
start "" "!chrome_command!" --user-data-dir="%~dp0chrome\tagui_user_profile" !chrome_switches! !window_size! !headless_switch! !no_sandbox_switch!

:scan_ws_again
rem wait until chrome is ready with websocket url for php thread
Expand Down

0 comments on commit 1887d35

Please sign in to comment.