diff --git a/.github/workflows/test_login_logout.yml b/.github/workflows/test_login_logout.yml index d5ff970..17f57ce 100644 --- a/.github/workflows/test_login_logout.yml +++ b/.github/workflows/test_login_logout.yml @@ -3,6 +3,7 @@ name: Test Login And Logout on: schedule: - cron: "30 13 * * *" + pull_request: workflow_dispatch: jobs: @@ -62,9 +63,9 @@ jobs: echo "Testing: $test_name (Proxy: ${use_proxy:-false})" if [[ "$use_proxy" == "true" ]]; then - OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --path="$path_flag" 2>&1 || true) + OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --no-sandbox --path="$path_flag" 2>&1 || true) else - OUTPUT=$(PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --path="$path_flag" 2>&1 || true) + OUTPUT=$(PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --no-sandbox --path="$path_flag" 2>&1 || true) fi echo "$path_flag" @@ -84,9 +85,9 @@ jobs: sleep 45 if [[ "$use_proxy" == "true" ]]; then - OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --path="$path_flag" --logout 2>&1 || true) + OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --no-sandbox --path="$path_flag" --logout 2>&1 || true) else - OUTPUT=$(PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --path="$path_flag" --logout 2>&1 || true) + OUTPUT=$(PASSWORD="$PASSWORD" $BIN_NAME --email="$EMAIL" --headless --no-sandbox --path="$path_flag" --logout 2>&1 || true) fi LOGOUT_TOKEN=$(echo "$OUTPUT" | jq -r '.token' 2>/dev/null || echo "") diff --git a/.github/workflows/test_login_ui.yml b/.github/workflows/test_login_ui.yml index 35eb3cb..935a84a 100644 --- a/.github/workflows/test_login_ui.yml +++ b/.github/workflows/test_login_ui.yml @@ -3,6 +3,7 @@ name: Test Login UI Elements on: schedule: - cron: "0 4 * * *" + pull_request: workflow_dispatch: jobs: @@ -67,9 +68,9 @@ jobs: echo "Testing: $test_name (Proxy: ${use_proxy:-false})" if [[ "$use_proxy" == "true" ]]; then - OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$FAKE_PASSWORD" $BIN_NAME --email="$FAKE_EMAIL" --headless --path="$path_flag" 2>&1 || true) + OUTPUT=$(PROXY_HOST="$PROXY_HOST" PROXY_USER="$PROXY_USER" PROXY_PASS="$PROXY_PASS" PASSWORD="$FAKE_PASSWORD" $BIN_NAME --email="$FAKE_EMAIL" --headless --no-sandbox --path="$path_flag" 2>&1 || true) else - OUTPUT=$(PASSWORD="$FAKE_PASSWORD" $BIN_NAME --email="$FAKE_EMAIL" --headless --path="$path_flag" 2>&1 || true) + OUTPUT=$(PASSWORD="$FAKE_PASSWORD" $BIN_NAME --email="$FAKE_EMAIL" --headless --no-sandbox --path="$path_flag" 2>&1 || true) fi echo "$path_flag" diff --git a/README.md b/README.md index f7703cb..d6dfd79 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ paddock --email="your_email" | `--logout` | `bool` | will log you out from your current session | | `--force` | `bool` | forces a login with a new set `--email` | | `--path` | `string` | **(not safe)** sets the path to your favorite chromium based browser | +| `--no-sandbox` | `bool` | **(use with caution)** disables the sandboxed environment of the chromium browser | | `--freshness` | `duration` | will check whether the token is in x future still valid |
diff --git a/internal/browser/browser.go b/internal/browser/browser.go index f49f032..622eb3a 100644 --- a/internal/browser/browser.go +++ b/internal/browser/browser.go @@ -16,6 +16,7 @@ func New(config Config) (Browser, error) { b.proxy = config.Proxy b.commandPath = browserPath b.profilePath = config.FileManager.BrowserProfileDirPath() + b.noSandbox = config.NoSandbox b.headless = config.Headless b.brand = findBrowserBrand(browserPath) diff --git a/internal/browser/flags.go b/internal/browser/flags.go index bd57ac1..975a2a7 100644 --- a/internal/browser/flags.go +++ b/internal/browser/flags.go @@ -16,7 +16,4 @@ var brandFlags = map[Brand][]string{ "--disable-sync", "--no-welcome-page", }, - UNKNOWN: { - "--no-sandbox", - }, } diff --git a/internal/browser/run.go b/internal/browser/run.go index 0094dcb..e31be09 100644 --- a/internal/browser/run.go +++ b/internal/browser/run.go @@ -25,6 +25,10 @@ func (b *Browser) Run(tasks func(page *rod.Page) error) error { if b.headless { args = append(args, "--headless=new") } + if b.noSandbox { + args = append(args, "--no-sandbox") + } + if extras, ok := brandFlags[b.brand]; ok { args = append(args, extras...) } diff --git a/internal/browser/types.go b/internal/browser/types.go index fded745..9262719 100644 --- a/internal/browser/types.go +++ b/internal/browser/types.go @@ -8,6 +8,7 @@ type Browser struct { commandPath string profilePath string headless bool + noSandbox bool brand Brand proxy Proxy } @@ -16,6 +17,7 @@ type Config struct { FileManager *storage.FileManager CustomBrowserPath string Headless bool + NoSandbox bool Proxy Proxy } diff --git a/main.go b/main.go index 1a341b6..ee70e76 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ func main() { emailFlag := flags.String("email", "", "sets email") freshnessFlag := flags.Duration("freshness", time.Hour, "checks the tokens validity in x future (max freshness is 96h)") headlessFlag := flags.Bool("headless", false, "disables visual ui") + noSandboxFlag := flags.Bool("no-sandbox", false, "disables sandbox environment") logoutFlag := flags.Bool("logout", false, "logs out-> deletes subscriptionToken-> deletes browser-profile") forceFlag := flags.Bool("force", false, "forces login") flags.Parse(os.Args[1:]) @@ -46,6 +47,7 @@ func main() { FileManager: fileManager, CustomBrowserPath: *browserPathFlag, Headless: *headlessFlag, + NoSandbox: *noSandboxFlag, } proxyHttpAddress := os.Getenv("PROXY_HOST") if proxyHttpAddress != "" {