From 387731eb52233ceeb186cbc5c6322861580c138d Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Sun, 11 Dec 2022 18:39:55 +0100 Subject: [PATCH] read only, problem on write but probably server side configuration problem --- index.html | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/index.html b/index.html index ec0edc8..554e4f4 100644 --- a/index.html +++ b/index.html @@ -1561,6 +1561,33 @@ function switchSide(){ } } +// consider https://github.com/bfren/docker-nginx-webdav/issues/95#issuecomment-1345609338 +// namely that the test WebDAV server is still missing the additional module in order to allow write requests +function writeWebDAV(){ + const webdavurl = "https://webdav.benetou.fr"; + const client = window.WebDAV.createClient(webdavurl) + async function w(path = "/file.txt"){ return await client.putFileContents(path, "SpaSca test"); } + w("/fot.txt") // need new permissions +} + +function getPagesFromWebDAV(){ + const webdavurl = "https://webdav.benetou.fr"; + const client = window.WebDAV.createClient(webdavurl) + async function getDirectory(path = "/"){ return await client.getDirectoryContents(path); } + getDirectory("book_as_png").then( d => d.sort( (a,b) => (a.filename>b.filename)).slice(0,10).map( (c,i) => addPageFromURL(webdavurl+c.filename))) +} + +function addPageFromURL(url){ + if (url.indexOf(".png")<0) return + let el = document.createElement("a-box") + el.setAttribute("position", -Math.random()+" "+Math.random()*3 + " -1") + el.setAttribute("width", ".1") + el.setAttribute("height", ".15") + el.setAttribute("depth", ".01") + el.setAttribute("src", url) + AFRAME.scenes[0].appendChild(el) + return el +} // could change model opacity based on hand position, fading out when within a (very small here) safe space