Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to import a configuration file does absolutely nothing #3402

Closed
BlueSky-fur opened this issue Nov 4, 2023 · 1 comment
Closed

Trying to import a configuration file does absolutely nothing #3402

BlueSky-fur opened this issue Nov 4, 2023 · 1 comment
Labels
invalid the issues and PRs that do not follow our guidelines and cannot be processed

Comments

@BlueSky-fur
Copy link

BlueSky-fur commented Nov 4, 2023

Removed

@BlueSky-fur BlueSky-fur added the Unconfirmed Bug The bug is not confirmed by anyone else. label Nov 4, 2023
@mmahmoudian
Copy link
Member

mmahmoudian commented Nov 6, 2023

I have no idea what zipline is, and we at Flameshot do not support anything but Imgur at this point. Also, what you imported is not Flameshot configuration. It is probably something that zipline folks have put together.

I've set file permissions and when I then try to import the config in Flameshot nothing happens,

I have no idea what you mean by "import the config". Can you send us screenshot of screen recording of what you do and what is the procedure you are going through?

I've also not seen any toggle to change where you want to upload.

there is nothing to be toggled. We do not support anything but Imgur. Maybe in future we do, but not at this point of time.

#!/bin/bash
flameshot gui -r > /tmp/ss.png;
curl -H "authorization: datvxxxxxxZUxxxxTY5OTEzxxxxxE5OQ" http://xxx.xxxxxxxxxxxx.xx:3000/api/upload -F file=@/tmp/ss.png -H "Content-Type: multipart/form-data" -H "Format: random" -H "Embed: true" | jq -r '.files[0]' | tr -d '\n' | pbcopy;

Is this the config you are talking about? if it is, then this is a Bash script that have been carelessly put together. Here is how you can improve it:

  1. Always use expanded version of arguments for readability. For instance for Curl, the -H should be --header, the -F should become --form; and for Flameshot the -r should be --raw.
  2. In Flameshot you don't need to redirect (i.e >) the output of Flameshot and save it to a file, you can ask Flameshot to write into a file directly: flameshot gui --path /blah/blah/blah.png
  3. it is a rookie mistake to hard-code the filename in /tmp/ because it might collide with some other file and over-write it, and you upload a wrong file. The solution is to as your computer to create a temp file, and then use that file
  4. if Flameshot is aborted, the curl part will run, which is potentially dangerous. unfortunately the current version of Flameshot does not change the exit code when screenshot is aborted ( flameshot gui exits with 0 on abort #3321 ) , so we should try to improvise for now and check the output file
  5. you have an @ in the file path in the curl file that I don't know what it does. Perhaps that is the main cause of the error!!

Here is a better version (without changing the curl part apart from updating the file path):

#!/usr/bin/env bash

# create a temp file to avoid name collision
OUR_FILE=$(mktemp)

# take the screenshot
flameshot gui --path "${OUR_FILE}"

# check if aborted
if file "${OUR_FILE}" | grep --fixed-strings "${OUR_FILE}: empty"
then
    # solution taken from https://apple.stackexchange.com/a/115373/105984
    display notification "Screenshot was aborted, so we don't upload!" with title "Zipline upload script"
    exit 1
fi

# upload
curl -H "authorization: datvxxxxxxZUxxxxTY5OTEzxxxxxE5OQ" http://xxx.xxxxxxxxxxxx.xx:3000/api/upload \
     -F file="${OUR_FILE}"  \
     -H "Content-Type: multipart/form-data" \
     -H "Format: random" \
     -H "Embed: true" \
  | jq -r '.files[0]' \
  | tr -d '\n' \
  | pbcopy;

Does the monitor configuration matter with this issue?

No it does not. Also the link you provided does not work. It would be easier and safer if you post pictures directly into Github (just copy picture and paste inside the text box of Github)

@mmahmoudian mmahmoudian added invalid the issues and PRs that do not follow our guidelines and cannot be processed and removed Unconfirmed Bug The bug is not confirmed by anyone else. labels Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid the issues and PRs that do not follow our guidelines and cannot be processed
Projects
None yet
Development

No branches or pull requests

2 participants