Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test_login_logout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test Login And Logout
on:
schedule:
- cron: "30 13 * * *"
pull_request:
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -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"
Expand All @@ -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 "")
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_login_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Test Login UI Elements
on:
schedule:
- cron: "0 4 * * *"
pull_request:
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

<br>
Expand Down
1 change: 1 addition & 0 deletions internal/browser/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions internal/browser/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,4 @@ var brandFlags = map[Brand][]string{
"--disable-sync",
"--no-welcome-page",
},
UNKNOWN: {
"--no-sandbox",
},
}
4 changes: 4 additions & 0 deletions internal/browser/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/browser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Browser struct {
commandPath string
profilePath string
headless bool
noSandbox bool
brand Brand
proxy Proxy
}
Expand All @@ -16,6 +17,7 @@ type Config struct {
FileManager *storage.FileManager
CustomBrowserPath string
Headless bool
NoSandbox bool
Proxy Proxy
}

Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand All @@ -46,6 +47,7 @@ func main() {
FileManager: fileManager,
CustomBrowserPath: *browserPathFlag,
Headless: *headlessFlag,
NoSandbox: *noSandboxFlag,
}
proxyHttpAddress := os.Getenv("PROXY_HOST")
if proxyHttpAddress != "" {
Expand Down