-
Notifications
You must be signed in to change notification settings - Fork 272
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
[GeniusPaste] Rewrite to make pastebins customizable #338
Conversation
Rewrite the paste logic to support configurable pastebin services. Previously supported pastebin services are ported to the new format. This may break user configuration as it will reset the pastebin service in use to the new default. Closes geany#312.
Use constants instead of direct strings for pastebin service configuration lookup to lower the risk of typos.
This eases debugging a faulty pastebin configuration by showing the actual data sent and received.
Most non-API-based pastebin services will redirect the client to the newly created paste page. It is then safer to use the redirect URI than trying to parse some possibly complex HTML to extract the URI.
The request and response might be sensibly different, and their respective URI especially matters, so log them both separately.
Fixed a few details and added a neat feature while trying to add support for http://paste.debian.net/ (a459a19): support for using the pastebin service's HTTP redirection response as paste URL (649939a). It's a lot neater than grepping some more or less random web page when using a non-API pastebin (e.g. when simulating a browser rather than using a well defined API). |
@@ -0,0 +1,20 @@ | |||
# FIXME: outdated, this leads to a 404 on http://pasted.co/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this doens't work. It didn't before my changes either, I guess the service changed since it was implemented.
I couldn't find how to use it, and their link to a supposed API documentation leads to a 404.
I'd delete this pastebin configuration altogether if I was the only caller, but for now I kept it in the hope maybe someone knows how to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the end, it's merely ported from the previous hard-coded logic, with zero testing :)
Looks fine to me. Once @Enrix835 is giving ok, I'd like to merge it. |
[GeniusPaste] Rewrite to make pastebins customizable
Rewrite the paste logic to use customizable and configurable pastebin services through configuration files, fixing #312. As a showcase, this PR adds support for http://fpaste.org quite painlessly in a7bf3a7.
Disclaimer: this has not yet been tested under Windows, and I suspect that looking up the path to the system configuration directory holding the pastebin service configurations shipped with the plugin might not work. This should be tested.