read only, problem on write but probably server side configuration problem

webdav
Fabien Benetou 2 years ago
parent 50d7cd0f0b
commit 387731eb52
  1. 27
      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
</script>

Loading…
Cancel
Save