this post was submitted on 11 Mar 2024
34 points (97.2% liked)

feddit.ch Instance Announcements

157 readers
1 users here now

The only purpose for this community is to give the instance users information about the current state of the instance. Only moderators can post to this community.

founded 1 year ago
MODERATORS
 

Because of missing time and resources, feddit.ch will shut down on 31.03.2024. The domain feddit.ch will be available from the 08.06.2024.

In your profile settings, you can export your profile and import it on a new server into a new account.

Thank you all for your engagement.

_Frog

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 5 points 7 months ago* (last edited 7 months ago) (1 children)

I got it working in shell as well:

#!/bin/bash

read -p "Username: " user
read -p "Password: " -s pass
read -p "TOTP: " totp

res=$(curl \
    --request POST \
    --url "https://feddit.ch/api/v3/user/login" \
    --header 'accept: application/json' \
    --header 'content-type: application/json' \
    --data '{"username_or_email":"'$user'","password":"'$pass'","totp_2fa_token":"'$totp'"}')

jwt=$(echo $res | sed -re 's/^.*"jwt":"([^"]*)".*$/\1/')

curl \
    --request GET \
    --url "https://feddit.ch/api/v3/user/export_settings" \
    --header 'accept: application/json' \
    --cookie "jwt=$jwt" \
    -o "export.json"

I'd recommend echoing $res and $jwt before processing them further

Edit: if you don't have TOTP enabled, don't forget to remove it from the request

Docs: https://lemmy.readme.io/reference/post_user-login

Edit 2: added spacing

[โ€“] [email protected] 4 points 7 months ago

Thanks!!! It worked and I am now migrated.