rebane2001 / matterport-dl

A downloader for matterport virtual tours
The Unlicense
323 stars 78 forks source link

Added graph post target support and harvest the standard graph resources #6

Closed mitchcapper closed 2 years ago

mitchcapper commented 2 years ago

Wasn't planning on this but got it coded out. This adds post server support to our internal server. This is required to support the /api/mp/models/graph endpoint. Previously we just returned no data, but this broke some functionality (measuring, item text and image targets, etc).

We still maintain the old functionality and return the no data for any other graph request. Graph targets harvested using fiddler/chrome network tab for the post requests. Copy the body into a new file in the graph_posts folder. NOTE the file name MUST match the exact value of operationName in the body.

This removes our hack of trying to replace all POST requests with GET requests.

This breaks some things though:
*) It is no longer one self contained script, it reads data now from the graph_posts folder. These strings could be embedded if really desired.

*) If we don't rewrite the showcase removing the post requests, if you don't host it using our local app it won't work. We could hide post support behind a command line arg to enable 'advanced' mode.

The one other solution is to instead still rewrite all POST to GET but to also try to rewrite graph requests to request graph_{operationName} I don't know how easy that is to do, but that would work with any server then.

This internal server could eventually support dollhouse/floorplan fully by being able to return different files for the same path but that is not coded.

Tags generally appear as white dots in the model, so they should now show up and clicking them should work:)

I override some additional headers now to be closer to the official client. Not required but figured could not hurt.

Finally, we properly handle UTF-8 everywhere except when we were writing out the main index.html file, this fixes that. This should allow better international support.

mitchcapper commented 2 years ago

one other option would be to have two showcase.js files. The one with all the POSTS swapped out (as we currently do) and then one that does not called showcase-internal.js or something. Then when the request comes in on the internal server for showcase.js it could just change that to be showcase-internal.js. Then everyone wins.