529 {
530
531
532
533
534
535
536 if (std::getenv("BG_CEF_PERSIST_SESSION"))
537 cmd->AppendSwitch("persist-session-cookies");
538 else
539 cmd->AppendSwitch("incognito");
540
541 cmd->AppendSwitch("disable-extensions");
542 cmd->AppendSwitch("disable-sync");
543 cmd->AppendSwitch("disable-component-update");
544 cmd->AppendSwitch("disable-print-preview");
545
546
547
548
549
550
551 cmd->AppendSwitch("disable-popup-blocking");
552
553 cmd->AppendSwitchWithValue("disable-features", "TranslateUI");
554 cmd->AppendSwitchWithValue("ssl-certificates-file", "/etc/ssl/certs/ca-certificates.crt");
555
556 cmd->AppendSwitchWithValue("dns-over-https-mode", "automatic");
557 cmd->AppendSwitchWithValue(
558 "dns-over-https-servers",
559 "https://cloudflare-dns.com/dns-query,https://dns.google/dns-query"
560 );
561
562 cmd->AppendSwitch("no-proxy-server");
563 cmd->AppendSwitchWithValue("proxy-server", "direct://");
564 cmd->AppendSwitch("proxy-bypass-list=*");
565
566 cmd->AppendSwitch("enable-gpu");
567 cmd->AppendSwitch("disable-gpu-compositing");
568 cmd->AppendSwitch("use-gl=desktop");
569
570
571
572
573
574
575
576
577
578
579
580
581 auto eq = [](const char* a, const char* b) -> bool {
582 return a && b && std::strcmp(a, b) == 0;
583 };
584
585 const char* internal_be = std::getenv("BastionGuard_CEF_BACKEND");
586 const char* ozone_be = std::getenv("OZONE_PLATFORM");
587 const char* sess_type = std::getenv("XDG_SESSION_TYPE");
588 const char* wl_disp = std::getenv("WAYLAND_DISPLAY");
589 const char* x_disp = std::getenv("DISPLAY");
590
591 bool want_wayland;
592 const char* picked_by;
593
594 if (eq(internal_be, "wayland")) { want_wayland = true; picked_by = "BastionGuard_CEF_BACKEND"; }
595 else if (eq(internal_be, "x11")) { want_wayland = false; picked_by = "BastionGuard_CEF_BACKEND"; }
596 else if (eq(ozone_be, "wayland")) { want_wayland = true; picked_by = "OZONE_PLATFORM"; }
597 else if (eq(ozone_be, "x11")) { want_wayland = false; picked_by = "OZONE_PLATFORM"; }
598 else if (eq(sess_type, "wayland")) { want_wayland = true; picked_by = "XDG_SESSION_TYPE"; }
599 else if (eq(sess_type, "x11")) { want_wayland = false; picked_by = "XDG_SESSION_TYPE"; }
600 else if (wl_disp && *wl_disp) { want_wayland = true; picked_by = "WAYLAND_DISPLAY"; }
601 else if (x_disp && *x_disp) { want_wayland = false; picked_by = "DISPLAY"; }
602 else { want_wayland = false; picked_by = "default(x11)"; }
603
604 std::cerr << "[SecureBrowser] Ozone backend: "
605 << (want_wayland ? "wayland" : "x11")
606 << " (via " << picked_by << ")\n";
607
608 cmd->AppendSwitchWithValue(
609 "enable-features",
610 "UseOzonePlatform,VaapiVideoDecoder,UseSkiaRenderer,DnsOverHttps"
611 );
612
613 if (want_wayland) {
614 cmd->AppendSwitchWithValue("ozone-platform", "wayland");
615 cmd->AppendSwitch("enable-webrtc-pipewire-capturer");
616 } else {
617 cmd->AppendSwitchWithValue("ozone-platform", "x11");
618
619 cmd->AppendSwitchWithValue("ozone-platform-hint", "x11");
620 }
621
622 cmd->AppendSwitch("no-default-browser-check");
623 cmd->AppendSwitch("no-first-run");
624 cmd->AppendSwitch("disable-crash-reporter");
625 cmd->AppendSwitch("disable-background-networking");
626 cmd->AppendSwitch("disable-breakpad");
627 }