-
Notifications
You must be signed in to change notification settings - Fork 81
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
Solution to allow dollhouse/floorplan on static hosting #41
Comments
This is a good work around, I still like the idea of trying to implement a javascript xhr proxy as noted in #8 (comment) for long term external hosting. It could easily use the same rule set as the internal hosting and would be pretty robust against changes. Right now 99% of all the network requests matterport makes are XHR and would flow through it. |
The static hosting doesn't seem to load for me when I replace |
How we could host it on apache/nginx ? |
Actually, I had some success using the Readbean webserver: a standalone binary that runs on Linux, Windows, Mac and BSD. I took the main ideas from the python webserver and ported them to Lua. Download Redbean 1: curl -o redbean.com https://justine.lol/redbean/redbean-latest.com Add lua code and web framework from fullmoon: zip -r redbean.com .init.lua .lua/fullmoon.lua` Add downloaded Matterport files: cd <matterport folder>
zip -r ../redbean.com * The lua code itself is rather simple: local fm = require "fullmoon"
fm.setRoute("/api/mp/models/graph", function(r)
local op = r.params.operationName
local file = "/api/mp/models/graph_" .. op .. ".json"
-- fm.logInfo("serving graph for operation " .. op .. ", serving file " .. file)
if GetAssetMode(file) == nil
then return fm.servePath("/api/mp/models/graph")
else return fm.servePath(file)
end
end)
fm.setRoute("/js/showcase.js","/js/showcase-internal.js")
fm.setRoute("/models/*/*.jpg", function(r)
local crop = r.params.crop
local width = r.params.width
local path = r.path
if width ~= nil then path = path .. "width=" .. width .. "_" end
if crop ~= nil then path = path .. "crop=" .. crop end
if crop == nil and width == nil then path = r.path else path = path..".jpg" end
-- fm.logInfo("cropped image: " .. path)
if GetAssetMode(path) == nil
then return fm.servePath(r.path)
else return fm.servePath(path)
end
end)
fm.setRoute("/v2/users/current",fm.servePath("/api/v2/users/current"))
fm.setRoute("/",fm.servePath("/index.html"))
fm.setRoute("/*", fm.serveAsset)
fm.run() |
any workarounds for Apache / Ngnix?? |
@michaelasg it isn't super complex to emulate what at the simple server in code does so look at that or @smee seems to have the logic as well (although it has changed some now so pay attention to the main code too). The good news is per the earlier comment I have actually implemented the javascript proxy. When I get enough time I will be able to generate rules to have it modify the requests so we can avoid post requests and rewrite the and not need a custom web server. |
That would be great. I can't install redbean on my shared hosting... Would be great to have each space folder being able to be hosted as a standard page under Apache, having multiple tours available at the same time. the python server works great for one thou! |
Hi! what is the best solution now for uploading to static hosting? Thanks |
|
The following line can be inserted into
showcase.js
to replace the functionality currently present in the HTTP server:It is placed at the beginning of
async getImageBitmap(e,t,i,n,s){
like so:This could probably be added to
showcase.js
by the script.The text was updated successfully, but these errors were encountered: