rusq / slackdump

Save or export your private and public Slack messages, threads, files, and users locally without admin privileges.
GNU General Public License v3.0
1.6k stars 72 forks source link

#293: browser compatibility #298

Closed rusq closed 4 months ago

rusq commented 4 months ago

Bump deps and create a compatibility layer for playwright, that keeps breaking with every fucking bump.

Should fix #293

rusq commented 4 months ago

Tested manually

go run ./cmd/slackdump -auth-reset 
# OK
go run ./cmd/slackdump -list-users
# OK
go run ./cmd/slackdump -list-users -legacy-browser
# OK
ianbmacdonald commented 4 months ago

Okay, so I was able to complete a build cloning the current slackdump.git and modifying the provided Dockerfile with a couple of tweaks, to disable the v3 tests (some failing, but for v3 roadmap, so I figure okay) and updating the source image to 1.22.5-alpine3.19 (diff below) to avoid a toolchain dependency problem with go.

$ diff /usr/local/src/slackdump/Dockerfile /tmp/Dockerfile_orig 
1c1
< FROM golang:1.22.5-alpine3.19 AS stage
---
> FROM golang:1.19-alpine3.17 AS stage
9c9,10
< RUN go build -ldflags="-s -w" ./cmd/slackdump
---
> RUN go test ./... \
>     && go build -ldflags="-s -w" ./cmd/slackdump

I copied the resulting binary out of the image, rather than use it as the entrypoint, which looked like it would work as well, but I would guess probably fail to launch the browser, etc. required to complete the manual email auth.

$ /usr/local/bin/slackdump version
Slackdump unknown (commit: unknown) built on: unknown

The options changed, so I tweaked my "-f -export -export-type" to just "export -type" after a quick browser of "help export".

The result appeared similar unfortunately, so I wondering if building in the container using alpine 3.19 failed to introduce the required dependencies for successful use on 24.04 (vs. dropping the go build essentials locally). I ran out of time for today. Results of the Dockerfile build are below.

$ /usr/local/bin/slackdump export 240708_std.zip -type standard
export: 2024/07/08 09:12:43 ℹ️ Initialising browser, once the browser appears, login as usual
export: 2024/07/08 09:12:49 Error 004 (Authentication Error): auth error: failed to initialise the auth provider: browser automation error: failed to launch: [launcher] Failed to get the debug url: [143385:143385:0708/091248.593858:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x59d8775b4842 base::debug::CollectStackTrace()
#1 0x59d8775a11e3 base::debug::StackTrace::StackTrace()
#2 0x59d8774f2034 logging::LogMessage::~LogMessage()
#3 0x59d875cc63f6 content::ZygoteHostImpl::Init()
#4 0x59d876a47572 content::ContentMainRunnerImpl::Initialize()
#5 0x59d876a45047 content::RunContentProcess()
#6 0x59d876a453b6 content::ContentMain()
#7 0x59d873165309 ChromeMain
#8 0x7a419b02a1ca (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9)
#9 0x7a419b02a28b __libc_start_main
#10 0x59d87316502a _start
Crash keys:
  "switch-22" = "--user-data-dir=/tmp/rod/user-data/1a39f10f27ba89a8"
  "switch-21" = "--use-mock-keychain"
  "switch-20" = "--remote-debugging-port=0"
  "switch-19" = "--no-startup-window"
  "switch-18" = "--no-first-run"
  "switch-17" = "--metrics-recording-only"
  "switch-16" = "--force-color-profile=srgb"
  "switch-15" = "--enable-automation"
  "switch-14" = "--disable-sync"
  "switch-13" = "--disable-renderer-backgrounding"
  "switch-12" = "--disable-prompt-on-repost"
  "switch-11" = "--disable-popup-blocking"
  "switch-10" = "--disable-ipc-flooding-protection"
  "switch-9" = "--disable-hang-monitor"
  "switch-8" = "--disable-dev-shm-usage"
  "switch-7" = "--disable-default-apps"
  "switch-6" = "--disable-component-extensions-with-background-pages"
  "switch-5" = "--disable-client-side-phishing-detection"
  "switch-4" = "--disable-breakpad"
  "switch-3" = "--disable-backgrounding-occluded-windows"
  "switch-2" = "--disable-background-timer-throttling"
  "switch-1" = "--disable-background-networking"
  "num-switches" = "24"
  "commandline-disabled-feature-2" = "TranslateUI"
  "commandline-disabled-feature-1" = "site-per-process"
  "commandline-enabled-feature-2" = "NetworkServiceInProcess"
  "commandline-enabled-feature-1" = "NetworkService"
  "osarch" = "x86_64"
  "pid" = "143385"
  "ptype" = "browser"

Error 004 (Authentication Error): auth error: failed to initialise the auth provider: browser automation error: failed to launch: [launcher] Failed to get the debug url: [143385:143385:0708/091248.593858:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x59d8775b4842 base::debug::CollectStackTrace()
#1 0x59d8775a11e3 base::debug::StackTrace::StackTrace()
#2 0x59d8774f2034 logging::LogMessage::~LogMessage()
#3 0x59d875cc63f6 content::ZygoteHostImpl::Init()
#4 0x59d876a47572 content::ContentMainRunnerImpl::Initialize()
#5 0x59d876a45047 content::RunContentProcess()
#6 0x59d876a453b6 content::ContentMain()
#7 0x59d873165309 ChromeMain
#8 0x7a419b02a1ca (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9)
#9 0x7a419b02a28b __libc_start_main
#10 0x59d87316502a _start
Crash keys:
  "switch-22" = "--user-data-dir=/tmp/rod/user-data/1a39f10f27ba89a8"
  "switch-21" = "--use-mock-keychain"
  "switch-20" = "--remote-debugging-port=0"
  "switch-19" = "--no-startup-window"
  "switch-18" = "--no-first-run"
  "switch-17" = "--metrics-recording-only"
  "switch-16" = "--force-color-profile=srgb"
  "switch-15" = "--enable-automation"
  "switch-14" = "--disable-sync"
  "switch-13" = "--disable-renderer-backgrounding"
  "switch-12" = "--disable-prompt-on-repost"
  "switch-11" = "--disable-popup-blocking"
  "switch-10" = "--disable-ipc-flooding-protection"
  "switch-9" = "--disable-hang-monitor"
  "switch-8" = "--disable-dev-shm-usage"
  "switch-7" = "--disable-default-apps"
  "switch-6" = "--disable-component-extensions-with-background-pages"
  "switch-5" = "--disable-client-side-phishing-detection"
  "switch-4" = "--disable-breakpad"
  "switch-3" = "--disable-backgrounding-occluded-windows"
  "switch-2" = "--disable-background-timer-throttling"
  "switch-1" = "--disable-background-networking"
  "num-switches" = "24"
  "commandline-disabled-feature-2" = "TranslateUI"
  "commandline-disabled-feature-1" = "site-per-process"
  "commandline-enabled-feature-2" = "NetworkServiceInProcess"
  "commandline-enabled-feature-1" = "NetworkService"
  "osarch" = "x86_64"
  "pid" = "143385"
  "ptype" = "browser"
rusq commented 4 months ago

@ianbmacdonald, yeah, v3 is in a fucked up state (testwise) for now, but this change only affected v2, will port it to v3 once fixed.