Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Implement new upload providers for screenshot. Fixes #49. #84

Open
wants to merge 6 commits into from

2 participants

@xabolcs
Owner

Hi there!

This pull request contains:

  • a hotfix to make screenshot feature fully functional
  • an extra provider - updates needed in response handling in screenshot.js to utilize the provider

Please note that this request is implemented with a test auth key! All uploaded image will be deleted after 15 minutes!
So a minimal update is needed before merging!

Key added.

@xabolcs

As noted in the description, a new apiKey is needed to generate at http://www.uploadscreenshot.com/api-signup.
For example: 31dc22b9221404130294843815 will do the job.

@xabolcs
Owner

There were no feedback here so I decided to push away 942b6cc from this pull, and updated the apiKey field with the mentioned key.

@xabolcs
Owner

Pull should be upgraded with a working screenshot provider!

@whimboo
Owner

I would like to wait for a decision on issue #49 first before commening on the pull.

@xabolcs xabolcs referenced this pull request from a commit in xabolcs/nightlytt
@xabolcs xabolcs Merge pull #84 - New upload providers for screenshot a1c51a8
@xabolcs xabolcs referenced this pull request
Closed

Release version 3.7 #159

@xabolcs xabolcs commented on the diff
extension/chrome/content/screenshot/providers.js
((6 lines not shown))
addFormFields: function(formdata)
{
- formdata.addControl("uploadtype", "on");
- formdata.addControl("url", "paste image url here");
- formdata.addControl("MAX_FILE_SIZE", "3145728");
- formdata.addControl("refer", "");
- formdata.addControl("brand", "");
- formdata.addControl("optsize", "320x320");
+ formdata.addControl("mode", "local");
+ formdata.addControl("um", "image");
+ formdata.addControl("mode", "local");
+ formdata.addControl("forumurl", "http://postimage.org");
+ //formdata.addControl("MAX_FILE_SIZE", 10*1024*1024);
@xabolcs Owner
xabolcs added a note

These commented lines aren't needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
48 extension/chrome/content/screenshot/providers.js
@@ -29,55 +29,67 @@ var Providers = {
}
}
-var ImageShack = {
+var PostimageDotOrg = {
addFormFields: function(formdata)
{
- formdata.addControl("uploadtype", "on");
- formdata.addControl("url", "paste image url here");
- formdata.addControl("MAX_FILE_SIZE", "3145728");
- formdata.addControl("refer", "");
- formdata.addControl("brand", "");
- formdata.addControl("optsize", "320x320");
+ formdata.addControl("mode", "local");
+ formdata.addControl("um", "image");
+ formdata.addControl("mode", "local");
+ formdata.addControl("forumurl", "http://postimage.org");
+ //formdata.addControl("MAX_FILE_SIZE", 10*1024*1024);
@xabolcs Owner
xabolcs added a note

These commented lines aren't needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ //formdata.addControl("hash", 671);
},
getFileFormField: function()
{
- return "fileupload";
+ return "upload[]";
},
getReferer: function()
{
- return "http://www.imageshack.us/";
+ return "http://postimage.org";
},
getSubmissionURL: function()
{
- return "http://www.imageshack.us/";
+ return "http://postimage.org";
}
}
-var AllYouCanUpload = {
+var bayimg = {
+ genRemovalCode: function (aLength)
+ {
+ var len = aLength || 10;
+ var text = "";
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ for (var i=0; i < len; i++) {
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
+ }
+
+ return text;
+ },
+
addFormFields: function(formdata)
{
- formdata.addControl("images[0].submittedPhotoSize", "100%");
- formdata.addControl("imagesCount", "1");
+ formdata.addControl("code", bayimg.genRemovalCode());
},
getFileFormField: function()
{
- return "images[0].fileName";
+ return "file";
},
getReferer: function()
{
- return "http://allyoucanupload.webshots.com/";
+ return "http://bayimg.com";
},
getSubmissionURL: function()
{
- return "http://allyoucanupload.webshots.com/uploadcomplete";
+ return "http://upload.bayimg.com/upload";
}
}
-Providers.addProvider(ImageShack);
-//Providers.addProvider(AllYouCanUpload);
+Providers.addProvider(PostimageDotOrg);
+Providers.addProvider(bayimg);
View
2  extension/chrome/content/screenshot/screenshot.js
@@ -80,7 +80,7 @@ function captureTimer()
function submitScreenshot()
{
- var fileService = ImageShack;
+ var fileService = Providers.getSelectedProvider();
var data = canvas.toDataURL("image/png");
var pos = data.indexOf(";",5);
View
2  extension/chrome/locale/en-US/screenshot.dtd
@@ -5,7 +5,7 @@
<!ENTITY screenshot.window.title "Screenshot Grabber">
<!ENTITY screenshot.save.label "Save As...">
-<!ENTITY screenshot.submit.label "Submit to ImageShack...">
+<!ENTITY screenshot.submit.label "Submit Image...">
<!ENTITY screenshot.copy.label "Copy to Clipboard">
<!ENTITY screenshot.redraw.label "Redraw">
<!ENTITY screenshot.zoom.label "Zoom:">
Something went wrong with that request. Please try again.