thayakawa-gh / SlackLogViewer

A viewer for json files exported from Slack workspaces.
MIT License
205 stars 13 forks source link

SlackLogViewer can't view images from slackdump's exports #18

Open spacekaila opened 1 year ago

spacekaila commented 1 year ago

I created a zip with slackdump with the following command

./slackdump -export workspace-name.zip -export-type mattermost -export-token xoxo-

I can open and view all my conversations with SlackLogViewer, but I can't view any images. I just see a loading placeholder:

image

Do I have to put a specific value in for the export-token? Or do I need to feed the value I put into SlackLogViewer? I can see that slackdump created an __uploads directory and all the attachments are there, but I can't see them in SlackLogViewer. If I click on a PDF it shows a bunch of HTML, but I can "download" the PDF to a folder, so it knows where it is.

spacekaila commented 1 year ago

I've also tried literally -export-token ... and the json comes out with t=..%2F.. and images still don't load. I also tried (for a sample json file) just taking out the ?t= bit entirely. If I paste the URL into my browser the image loads, but it still won't load in SlackLogViewer.

thayakawa-gh commented 1 year ago

Hi, @spacekaila. Sorry for my late reply. Did you use a valid token? You have to get a token from your slack workspace and pass it to the -export-token option. SlackLogViewer cannot load the attachments from the __uploads directory because downloading the attachments to the directory is a unique function of slackdump.

rusq commented 1 year ago

Hey @spacekaila , I may be able to help you with slackdump related questions (@thayakawa-gh I hope you don't mind my intrusion into this issue).

When you say "json comes out with t=...%2F..." what is the exact command line you are invoking slackdump?

%2F represents '/' and it shouldn't be the part of the token.

onadeemdev commented 1 year ago

Hello @rusq @thayakawa-gh can you guys assist me with the same issue. I am using the command line and the viewer does not load images. What exactly is the export token and where do I get it? Will putting this in allow the viewer to load the images? I have the same issue where my zip file loads in the viewer and shows the conversation but does not load the images.

Edit: I am on a Mac and v1.2.

Trying to understand is there a way for the viewer to load the images downloaded from slack dump zip.

rusq commented 1 year ago

Hey @onadeemdev see this doc for the description of what export token is. It could be any slack-supported token, i.e. bot, application or legacy token that has access to the messages of your workspace.

Sachin-A commented 10 months ago

Hello @rusq @thayakawa-gh

I have the same issue; however, the export zip (standard format) created by slackdump (version: 2.4.7) does show files/images under /attachments within each conversation directory. So, the data is all there clearly and just isn't being displayed by SlackLogViewer (version: v1.2.Alpha-1).

rusq commented 10 months ago

Happy new year,

@Sachin-A that is correct, the canonical export format never contains files, but contains the file URLs with the export token, that Slack generates when the export is being prepared. When slackdump export is generated - it pulls all files inside the archive.

I haven't yet found an elegant solution that would allow the viewers to display the files inside the ZIP archive. I considered having a "webserver" mode for the slackdump where it would serve the files from the archive, but that would require updating the file URLs to a slackdump specific URL, which I don't like already (2) I also don't like the idea of slackdump running a webserver, viewing export files seems like a separate problem from dumping the data.

Maybe we should combine our efforts with @thayakawa-gh and build a SlackLogViewDumper Pro and sell it for buttcoins or something, that would do all these things and make a coffee too, on demand.

thayakawa-gh commented 10 months ago

Hi, @Sachin-A . SlackLogViewer does't load the files in the attachments directory. You need to use export-token option with a valid token to have SlackLogViewer show the images, as mentioned above.

It is not so difficult to load these files in SlackLogViewer. However, it requires a special, not generic, "slackdump mode" to this app, so I don't know if it is the best solution. The next best thing, as @rusq said, might be to create SlackLogVieweDumper, but I think it would be difficult to sell it for a fee. Our tools basically lead to a loss for Slack Technologies so they would not approve us to sell it.

sclsj commented 6 months ago

Is this issue only limited to zip exports? I have a folder export and the images are also not loading. Would this [loading local images] be easier to implement if viewing a folder instead of a zip?

herianp commented 2 months ago

Hi, i have a same problem with images.. Could be a solution to use slack-api admin token during export?

thayakawa-gh commented 2 months ago

The only way to view images from slackdump's exports is to use slackdump with the -export-token ???? option, replacing ???? with your valid token. Please find out how to obtain the tokens on your own.

I have confirmed that SlackLogViewer can view images from the exports created by slackdump 2.5.10 using the following command:

slackdump -export filename.zip -export-token ????
rusq commented 2 months ago

Hello @thayakawa-gh. Thanks for replying, you're absolutely correct! Sorry I'm late.

The difference between Slack native and Slackdump exports is that Slack exports have the export token but don't have files in them. Slackdump exports have files (downloaded automatically), but don't have token. SlackLogViewer works perfectly fine with Slack export files, but not with Slackdump, unless the -export-token is provided by the user.

The version 3 of Slackdump has a built in viewer, it's not as finely made as SlackLogViewer - it's simple and experimental - but it is able to show files. It is currently in early alpha, but those who interested can build the latest version of slackdump from master, i.e.:

go build github.com/rusq/slackdump/v3/cmd/slackdump@latest

and then run

./slackdump view your_export.zip
rusq commented 2 months ago

@thayakawa-gh sorry, seems I'm only giving you trouble with people coming to complain that images aren't loading.