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

Feature/cancel export rebased & bug fixes to customizable export UI #519

Merged
merged 12 commits into from
Jan 11, 2020

Conversation

sashadev-sky
Copy link
Member

@sashadev-sky sashadev-sky commented Jan 11, 2020

Fixes #0000 (<=== Add issue number here)

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with grunt
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updates
  • @mention the original creator of the issue in a comment below for help or for a review

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

=============================================

@sashadev-sky
Copy link
Member Author

sashadev-sky commented Jan 11, 2020

@jywarren labeled this high priority because #485 was not running for me and errored on the POST request. Also please lmk my changes to startExport don't override anything you were planning on implementing

@sashadev-sky
Copy link
Member Author

@jywarren Thought 'http//export.mapknitter.org/', was a typo so updated it to have a : but seeing now it doesn't need it. Was wondering how come?

@VladimirMikulic
Copy link
Contributor

@sashadev-sky I've cloned this and tested it locally. It works fine. There are no POST requests errors.

@VladimirMikulic
Copy link
Contributor

VladimirMikulic commented Jan 11, 2020

There is one error though when using HTTPS protocol.

Screenshot_20200111_133012

Export in export.html doesn't work over HTTPS.

@jywarren
Copy link
Member

jywarren commented Jan 11, 2020 via email

@tech4GT
Copy link
Member

tech4GT commented Jan 11, 2020

Hi, thanks! Cc @tech4GT were we able to get https running? Thanks all! Exciting to see this getting there!

On Sat, Jan 11, 2020, 7:30 AM Vladimir Mikulic @.***> wrote: @sashadev-sky https://github.com/sashadev-sky I've cloned this and tested it locally. It works fine. There are no POST requests errors. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#519?email_source=notifications&email_token=AAAF6JY2CSHTN4MWE6EC25TQ5G3EJA5CNFSM4KFRRUAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWA3WA#issuecomment-573312472>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAF6J4M44FQYWIDCAXFGHDQ5G3EJANCNFSM4KFRRUAA .

I think I did put in the cors code! :D

@jywarren
Copy link
Member

jywarren commented Jan 11, 2020 via email

@tech4GT
Copy link
Member

tech4GT commented Jan 11, 2020

Isn't cors distinct from running ssl to get https access?

On Sat, Jan 11, 2020, 11:26 AM Varun Gupta @.> wrote: Hi, thanks! Cc @tech4GT https://github.com/tech4GT were we able to get https running? Thanks all! Exciting to see this getting there! … <#m_4975143771099100894_> On Sat, Jan 11, 2020, 7:30 AM Vladimir Mikulic @.> wrote: @sashadev-sky https://github.com/sashadev-sky https://github.com/sashadev-sky I've cloned this and tested it locally. It works fine. There are no POST requests errors. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#519 <#519>?email_source=notifications&email_token=AAAF6JY2CSHTN4MWE6EC25TQ5G3EJA5CNFSM4KFRRUAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWA3WA#issuecomment-573312472>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAF6J4M44FQYWIDCAXFGHDQ5G3EJANCNFSM4KFRRUAA . I think I did put in the cors code! :D — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#519?email_source=notifications&email_token=AAAF6J7CCS7MOBLFIDTZIQDQ5HXJZA5CNFSM4KFRRUAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWFOXQ#issuecomment-573331294>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAF6J5TT7NIB3MBMMKPMITQ5HXJZANCNFSM4KFRRUAA .

Yes you're right! It's not yet working on https! I'll open an issue for this!

@VladimirMikulic
Copy link
Contributor

@tech4GT @jywarren is right. SSL is not related to CORS.
This error is a security mechanism because it prevents HTTPS websites to make requests to insecure endpoints(HTTP).
On the other hand, CORS is used to specify who can access the assets on the server, which methods it can use to do so among other things.

@VladimirMikulic
Copy link
Contributor

VladimirMikulic commented Jan 11, 2020

When SSL is enabled all ajax request must also go on https://something.
Simply put you can't make HTTP requests from HTTPS website.

@@ -320,6 +252,81 @@ L.DistortableCollection.Edit = L.Handler.extend({
}, this);
return this;
},

startExport: function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, are you sure this works? I had to move it into a closure to give it access to the this scope.

Ah, i see, you used bind instead, down on this line

OK!

@jywarren
Copy link
Member

When SSL is enabled all ajax request must also go on https://something.
Simply put you can't make HTTP requests from HTTPS website.

Yes, and what's happening in some cases is also a complex bug where a 500 error can generate a CORS error, because the 500 error is a different HTTP status code (i think?), and sometimes CORS only allows GET/POST -- so sometimes resolving the underlying 500 error can make CORS errors disappear too. But they could also be legit independent CORS errors. Gah! 😅

@jywarren
Copy link
Member

jywarren commented Jan 11, 2020

NOTE: RESOLVED (see below)

Noting that using the external exporter will ALWAYS cause a 500 error when run locally, because your images are not accessible to the export service (which will try to fetch them).

@jywarren labeled this high priority because #485 was not running for me and errored on the POST request. Also please lmk my changes to startExport don't override anything you were planning on implementing

Were you getting this error running locally or from gh-pages?

You can also get this working locally by using remote images like this one:

https://publiclab.github.io/Leaflet.DistortableImage/examples/example.jpg

Maybe we should do that for all example images, because that'll allow us to test exports locally?

@jywarren
Copy link
Member

@jywarren Thought 'http//export.mapknitter.org/', was a typo so updated it to have a : but seeing now it doesn't need it. Was wondering how come?

I think that was actually a needed fix, but in the example I made in #485 I overrode the default so the example isn't affected by my original typo 😅

@jywarren
Copy link
Member

I'm going to try changing the example images to use remote ones and see if things work locally then.

@jywarren
Copy link
Member

Ah, i'd already thought of that, and they are already remote --

https://github.com/sashadev-sky/Leaflet.DistortableImage/blob/1a67e80d720c550a5049acad48622496eef9be6f/examples/export.html#L73

OK, what I did was I changed https:// to // so that we are less likely to trigger CORS, but we'll still have to test this only from an http origin.

@jywarren
Copy link
Member

😄 🎉 Tested this and it works!

image

The redirect to the status.json output file is a little weird, but it's cool. Maybe we should build more/better UI around this but I'm already doing that in publiclab/mapknitter#1192, and we can pull out the key JS parts of that and develop an export handler/UI mini repository from that code once it's running more smoothly.

@jywarren jywarren merged commit 7d6d743 into publiclab:main Jan 11, 2020
@jywarren
Copy link
Member

@tech4GT this may not work in gh-pages because we're on https there, but I'll turn of the https-forcing on this repo to see if we can run it without?

@VladimirMikulic
Copy link
Contributor

@jywarren I can confirm that this works on both HTTP and HTTPS.

@jywarren
Copy link
Member

jywarren commented Jan 11, 2020

Indeed it doesn't force, so we can try it at http://publiclab.github.io/Leaflet.DistortableImage/examples/export.html -- note NOT HTTPS. 🎉

It's republishing now... also i published v0.11.0 to NPM!

@jywarren
Copy link
Member

YES! IT WORKS!!!

image

Very nice folks!!!

we still need HTTPS on the exporter (https://github.com/publiclab/image-sequencer-app) for this to work on Mapknitter, which is on HTTPS. But this is really awesome.

Note that we're overriding the images in this example, so it doesn't matter what you do to the demo images, actually.

@jywarren
Copy link
Member

This is really cool. @publiclab/is-reviewers this is actually image sequencer running in a headless Node.js kubernetes cluster in Google Cloud, generating full-res MapKnitter exports! 💥

@VladimirMikulic
Copy link
Contributor

Well done everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants