weechat-android icon indicating copy to clipboard operation
weechat-android copied to clipboard

[enhancement] curl command shown in the File sharing settings could be dynamically affected by the settings user applies

Open BrendanTCC opened this issue 2 years ago • 1 comments

I have VERY little experience with android app development (not even sure I'm ready to have another crack), but here's an oddball idea for anyone interested in playing around with it:

In the File Sharing settings, an example curl command is shown:

curl -s --user user:pass \
--header 'Additional: Header' \
--form additional-field \
--form [email protected] \ https://example.com | perl -nle \
'm#^https://\S+#; print $1//$&'

Why not have the command shown dynamically affected by the settings the user saves, for those that happen to want to go down a rabbit hole of playing with curl, for the sake of playing with curl?

ie, let's say the url is set to https://ttm.sh, that the user:pass isn't, configured, and that there's no additional headers configured:

curl -s \
--form [email protected] \ 
https://ttm.sh | perl -nle \
'm#^https://\S+#; print $1//$&'

No hard feelings if this is deemed too idiotic to spend any brainpower on.

(edit: removed "--form additional-field " from the second example because i was a goose and forgot about it)

BrendanTCC avatar Aug 28 '22 02:08 BrendanTCC

I thought about doing exactly this but decided not to do it because:

  • It's more work;
  • The unabridged command showcases all options that the app provides, I think this has some value maybe;
  • By default there is no server configured, so you either have to show either a broken command or some sort of a placeholder; also, if for some reason user inputs # in URL regex, now you have an issue with the Perl command...
  • The command is manually broken with \ to look nice, which depends on the length of server name, etc. If the user inputs a long server name, this will not work, so you'd have to remove the manual breaking I guess

oakkitten avatar Aug 29 '22 17:08 oakkitten