-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
RFC for upload plugins #955
Conversation
Some direct thoughts after reading: "One python script for one upload service" is indeed a fascinating idea. However, we all know that the reality is always more complicated. If flameshot were only to support Linux platform and use interpreter/interpreter library from host system, I will support such idea. However, considering that we are also doing Windows (and other generic Linux packages), it would be more problematic.
The most conservative and well-proven plan is surely using so/dll plugin with My first thought on plugin system with script is to use Lua, which is designed to be embedded scripting language in the first place. However, it is expected that most users are not very familiar with it. The applicability on network communication is also doubtful. |
Actually as flameshot we do not need to distribute python or 3rd party add-ons. On both linux and windows the python interpreter needs to be found in the users path. For external libraries the user/script author is responsible for that. Flameshot will simply look in standard places: https://docs.python.org/3/c-api/intro.html#embedding-python For instance on windows a user could install the 3rd party libraries with Conda or however they normally get packages. I do see your point that for Windows users initial installation will be troublesome as they will need to navigate to a website and download python manually which is a hassle. This is a very valid critique I want to spend more time on to see what other windows programs do to make this easier for users.
Yeah I think if it does not work out with python or I get significant feedback that python is the wrong way to go, I will do the standard dlopen() with a C interface.
Yes I considered Lua since it is specifically meant for embedding, but the idea that users could very easily adjust thier upload scripts made me choose python over it. |
If this means I might be able to upload to my nextcloud with flameshot, then I am very excited to try this out! Let me know if you need any help testing. I use flameshot on both Linux and Windows and do not mind installing and configuring stuff. Currently I take a picture with flameshot being able to just take a picture with flameshot and hit the upload to nextcloud button and have the share link copied to my clipboard would be killer! |
First things first, disclaimer: I'm no expert as I've never wrote/implemented a plugin system. So the following is just my understanding from the plugin developer's point of view. This is a nice step forward but for sure it is a relatively hard one as it brings a whole new set is issues with it. Now to some of the points of the RFC and @hosiet's points:
|
I saw couple of installers, which ask user to install extra software for extended functionality, like Python interpreter.
What about ShareX-like approach? Their custom uploaders looks very well. Might be not such flexible as Lua or Python could be, but easy to use for end user. |
Thanks @mmahmoudian, let me answer some of the questions.
Sure, we can certainly return more. We can either do error codes or an error string. I don't think its worth the complexity of an upload progress bar. This would require constant communication between the plugin thread and the main GUI thread. The file's are also relatively small so it should not take too long.
My intent is to provide sample plugins in the actual flameshot installation. Then users can manually drop extra plugins into this folder similar to omyzsh. We could also keep a community-plugin repo as an easy place to find reviewed plugins. My main goal with this architecture is to allow flexibility for upload services but not have a large maintenance burden in the c++ code. I fear if we implement this as a core feature in c++ we will spend too much time updating this and adding new features.
Yes, and the other main thing with sandboxing in a scripting language is a bad plugin will not crash the entire application. I do not want bad community plugins to result in a large number of issues reported against flameshot. |
First of all |
Hmm We will probably step by step "collect" Plugins contributors have written for the big API's and bundle the biggest and reference smaller ones? I'm pretty sure that's what everybody already talks about? As for C++ vs Python I'm torn back and forth. Urging all low level users to install Python is heavy - thinking about non tech people I know that feels like a really bad idea. C++ for the 0,001% of people writing a custom upload plugin is not a no-go I think. The ShareX approach mentioned by @seamus-45 which is simply put "providing config for webcalls" sounds actually best to me? |
@Martin-Eckleben, don't forget about I think that the API in C++ will be better than the Python dependency, because on Windows it seems to be something alien. With the C++ API a plugin can be written in any programming language by the Swig (even in PHP, lol). |
I don't see how C++ or Python API makes it inherently easier.
Can you name a platform supported by flameshot but lacking std{in,out} or argv[]? |
The intention of the latest implementation is to allow users to load a plug-in that will integrate with the GUI so they need not interface with an API at all |
I still think that a declarative approach like ShareX does is the easiest for the end user like I've mentioned before, a python API is how Screencloud for example support external uploaders, but I found annoying start to develop a plugin for basically do a post request.
|
That's why it would be brillint, if flamrshot would have something like that:
b) or list the contents of and load the list in "upload with" menu, executing specified command as upload command when user selects the one. Maybe, this "upload with" menu would be a plugin itself, but it would be ideal if it will be in flameshot out-of-the-box |
Would love something like this as there are very few decent screenshot programs for linux and this is one of the few good ones. |
@rajeshisnepali your comment seems completely offtopic and unrelated with this pull request. If you have any suggestions, please open a separate issue. |
@borgmanJeremy I think #178 also can be addressed by this RFC as it fits the general theme as far as I understand it. |
Why was this closed? |
I think GitHub discussion s will work better. I'll have a formal proposal in a day or two. We've been discussing it on matrix and slack. |
Look forward to seeing it, even though I'm not using flameshot on my current system. Drop a link/x-ref here when the thread is up, would you? Cheers! 🙏 |
As a temporary workaround could you add service url to settings? I need to upload images to non-public cloud. I just could implement imgur api. |
No description provided.