Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds UserAgent and CPU Usage optimization #102

Merged
merged 24 commits into from
Mar 25, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix merge issues
briangann committed Mar 25, 2023
commit be797573c19dfba82b23a7b351930b8f98c1b9e8
3 changes: 3 additions & 0 deletions pkg/cmd/grafana-kiosk/main.go
Original file line number Diff line number Diff line change
@@ -230,6 +230,9 @@ func main() {
case "apikey":
log.Printf("Launching apikey kiosk")
kiosk.GrafanaKioskApikey(&cfg, messages)
case "aws":
log.Printf("Launcing AWS SSO kiosk")
kiosk.GrafanaKioskAWSLogin(&cfg)
default:
log.Printf("Launching ANON login kiosk")
kiosk.GrafanaKioskAnonymous(&cfg, messages)
7 changes: 4 additions & 3 deletions pkg/kiosk/aws_login.go
Original file line number Diff line number Diff line change
@@ -2,11 +2,12 @@ package kiosk

import (
"context"
"github.com/chromedp/chromedp"
"github.com/chromedp/chromedp/kb"
"log"
"os"
"time"

"github.com/chromedp/chromedp"
"github.com/chromedp/chromedp/kb"
)

func GrafanaKioskAWSLogin(cfg *Config) {
@@ -18,7 +19,7 @@ func GrafanaKioskAWSLogin(cfg *Config) {
log.Println("Using temp dir:", dir)
defer os.RemoveAll(dir)

opts := generateExecutorOptions(dir, cfg.General.WindowPosition, cfg.Target.IgnoreCertificateErrors)
opts := generateExecutorOptions(dir, cfg)

allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
defer cancel()
1 change: 1 addition & 0 deletions pkg/kiosk/config.go
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ type Config struct {
Target struct {
IgnoreCertificateErrors bool `yaml:"ignore-certificate-errors" env:"KIOSK_IGNORE_CERTIFICATE_ERRORS" env-description:"ignore SSL/TLS certificate errors" env-default:"false"`
IsPlayList bool `yaml:"playlist" env:"KIOSK_IS_PLAYLIST" env-default:"false" env-description:"URL is a playlist"`
UseMFA bool `yaml:"use-mfa" env:"KIOSK_USE_MFA" env-default:"false" env-description:"MFA is enabled for given account"`
LoginMethod string `yaml:"login-method" env:"KIOSK_LOGIN_METHOD" env-default:"anon" env-description:"[anon|local|gcom|goauth|idtoken|apikey]"`
Password string `yaml:"password" env:"KIOSK_LOGIN_PASSWORD" env-default:"guest" env-description:"password"`
URL string `yaml:"URL" env:"KIOSK_URL" env-default:"https://play.grafana.org" env-description:"URL to Grafana server"`
1 change: 1 addition & 0 deletions pkg/kiosk/utils.go
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ func generateExecutorOptions(dir string, cfg *Config) []chromedp.ExecAllocatorOp
chromedp.Flag("check-for-update-interval", "31536000"),
chromedp.Flag("ignore-certificate-errors", cfg.Target.IgnoreCertificateErrors),
chromedp.Flag("test-type", cfg.Target.IgnoreCertificateErrors),
chromedp.Flag("autoplay-policy", "no-user-gesture-required"),
chromedp.UserDataDir(dir),
}

You are viewing a condensed version of this merge commit. You can view the full changes here.