Skip to content

How to make this work in January 2025 in Fedora and nixOS #13

@belamu

Description

@belamu

Hi,

I got your script to work today, it's currently running. Here I post the steps, I had to take for others to replicate or someone to incorporate:

  • to get the python packages:
  • under Fedora:
    • in an empty directory:
    • create python virtual environment to install the packages in: python -m venv .venv
    • activate: . .venv/bin/activate
    • install the packages: pip install requests simplejson fpdf2 (the 2 is important, fpdf is 8 years old and incompatible)
  • under NixOS:
    • nix-shell -p python312Packages.requests -p python312Packages.simplejson -p python312Packages.fpdf2

For authentification I used a token from a website input:

  • for authentification I do not know what to input for the --auth option. The password is not sufficiant.
  • I did a login in my mattermost server in Firefox, went into the developer view (Right-click - Inspect (Q)), opened Tab "Network"
  • for any request with a lock symbol, under Cookies on the right, it showed values for "MMAUTHTOKEN", "MMCSRF", "MMUSERID"
  • right-click - copy all -> you get a dict. Paste the innermost dict with the three key-value pairs into the MMExport script as a global variable cookies
  • replace-all in the MMExport....py script:
    • headers=headers by headers=headers, cookies=cookies (in the requests.get calls)

Now the second error comes from missing fonts.

  • under Fedora:
    • search in /usr/share/fonts for NotoSans-Regular.ttf (e.g. with find -name "NotoSans-Regular.ttf")
    • fix the paths in lines 727 and following. Currently it was
    • SYSTEM_TTFONTS = 'usr/share/fonts/google-noto and removing the noto from the individual file names in the following lines
  • under NixOS:
    • find NotoSans-Regular.ttf in all of /nix/store took too long. So I did for i in /nix/store/*noto*; do find "$i" -name "NotoSans-Regular.ttf" >> ~/tmp/fonts ; done and it gave me /nix/store/9xz6bdv0yyzin2qa2pw0w1qy1ygipi8y-noto-64351-tex/fonts/truetype/google/noto/NotoSans-Regular.ttf`
    • hence my change in the python-script was SYSTEM_TTFONTS = '/nix/store/9xz6bdv0yyzin2qa2pw0w1qy1ygipi8y-noto-64351-tex/fonts/truetype/google/'

Running the script now worked with some warning from fpdf2 because of deprecated functions and classes. But it works:

  • -u username username is not the displayname but the username you use to login. It's displayed after a @ when clicked on your profile picture in the upper right corner
  • -a auth auth can be anything since authentification is done via the cookie
  • -t team the team is the group name that is shown above the search field
  • -s server the server is the url without https:// or anything after /, so for example mattermost.myinstitute.fr

In my case the output was a 4 GB pdf. I would definitly prefer a html/markdown output as signal-export by carderne does.

Thank you for your work. It took me about 90 minutes to figure all this out for two computers and accounts but that's much less than doing anything from scratch or even considering downloading, screenshotting, copy-pasting all by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions