<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[openscad.xyz support for &quot;data:&quot; URI scheme would be cool]]></title><description><![CDATA[<p dir="auto">"<a href="https://openjscad.xyz?uri=" rel="nofollow ugc">https://openjscad.xyz?uri=</a>..." is cool.<br />
"data:" URI scheme does not work for openjscad.xyz:<br />
<a href="https://en.wikipedia.org/wiki/Data_URI_scheme#Syntax" rel="nofollow ugc">https://en.wikipedia.org/wiki/Data_URI_scheme#Syntax</a></p>
<p dir="auto">I use this working minimal JSCAD file:<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js</a></p>
<pre><code>module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})}
</code></pre>
<p dir="auto">This URI does not work:<br />
<a href="https://openjscad.xyz/?uri=data:text/html;module.exports=function%20main()%7Breturn%20require(%27@jscad/modeling%27).primitives.sphere(%7Bradius:%2050%7D" rel="nofollow ugc">https://openjscad.xyz/?uri=data:text/html;module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50}</a>)}</p>
<p dir="auto">Base64 encoding and using application/json does not work either:<br />
<a href="https://openjscad.xyz/?uri=data:application/json;base64,bW9kdWxlLmV4cG9ydHM9ZnVuY3Rpb24gbWFpbigpe3JldHVybiByZXF1aXJlKCdAanNjYWQvbW9kZWxpbmcnKS5wcmltaXRpdmVzLnNwaGVyZSh7cmFkaXVzOiA1MH0pfQo=" rel="nofollow ugc">https://openjscad.xyz/?uri=data:application/json;base64,bW9kdWxlLmV4cG9ydHM9ZnVuY3Rpb24gbWFpbigpe3JldHVybiByZXF1aXJlKCdAanNjYWQvbW9kZWxpbmcnKS5wcmltaXRpdmVzLnNwaGVyZSh7cmFkaXVzOiA1MH0pfQo=</a></p>
<p dir="auto">It would be cool to have "data:" links working with openjscad.xyz, because that would allow to share JSCAD files without storing them anywhere — they are stored as part of the link ...</p>
<p dir="auto">For looking where&amp;how to add "data:" scheme:  How is "dist/jscad-web.min.js" generated?</p>
<p dir="auto">P.S:<br />
My GraphvizFiddle tool does not support links, but stores graphviz files in URL percent-encoded; click and see:<br />
<a href="https://stamm-wilbrandt.de/GraphvizFiddle/?1660482135372#%2F*%0A%20%20%20%20fsm%20for%20JSON%20%22number%22%20(http%3A%2F%2Ftools.ietf.org%2Fsearch%2Frfc4627%23page-4)%0A*%2F%0Adigraph%20G%20%7B%0A%20%20size%3D%2212%2C12%22%3B%20rankdir%3DLR%3B%20%0A%0A%20%20node%5Bstyle%3Dinvis%5D%20A%3BB%3BC%3BD%3BE%3BF%3BG%3B%20node%5Bstyle%3Dsolid%5D%3B%0A%0A%20%20%7B%20rank%3Dsame%3B%20%22A%22%3B%20%22F%22%3B%20%221%22%3B%20%7D%20%7B%20rank%3Dsame%3B%20%22E%22%3B%20%22G%22%3B%20%2211%22%20%7D%0A%20%20%7B%20rank%3Dsame%3B%20%22B%22%3B%20%222%22%3B%20%7D%20%7B%20rank%3Dsame%3B%20%22C%22%3B%20%224%22%3B%20%7D%20%7B%20rank%3Dsame%3B%20%22D%22%3B%20%227%22%3B%20%7D%0A%0A%20%20%22F%22%20-%3E%20%22G%22%20%5Blabel%3D%22number%5Cn(rfc4627)%22%5D%3B%20%0A%20%20%22A%22%20-%3E%20%22B%22%20%5Blabel%3D%22%5Bminus%5D%22%5D%3B%20%22B%22%20-%3E%20%22C%22%20%5Blabel%3D%22int%22%5D%3B%20%0A%20%20%22C%22%20-%3E%20%22D%22%20%5Blabel%3D%22%5Bfrac%5D%22%5D%3B%20%22D%22%20-%3E%20%22E%22%20%5Blabel%3D%22%5Bexp%5D%22%5D%3B%0A%20%20%221%22%20-%3E%20%222%22%20%5Blabel%3D%22%22%5D%3B%20%221%22%20-%3E%20%222%22%20%5Blabel%3D%22%25x2D%22%5D%3B%20%222%22%20-%3E%20%224%22%20%5Blabel%3D%22%25x30%22%5D%3B%0A%20%20%222%22%20-%3E%20%223%22%20%5Blabel%3D%22%25x31-39%22%5D%3B%20%223%22%20-%3E%20%223%22%20%5Blabel%3D%22%25x30-39%22%5D%3B%0A%20%20%223%22%20-%3E%20%224%22%20%5Blabel%3D%22%22%5D%3B%20%224%22%20-%3E%20%227%22%20%5Blabel%3D%22%22%5D%3B%20%224%22%20-%3E%20%225%22%20%5Blabel%3D%22%25x2E%22%5D%3B%0A%20%20%225%22%20-%3E%20%226%22%20%5Blabel%3D%22%25x30-39%22%5D%3B%20%226%22%20-%3E%20%226%22%20%5Blabel%3D%22%25x30-39%22%5D%3B%0A%20%20%226%22%20-%3E%20%227%22%20%5Blabel%3D%22%22%5D%3B%20%227%22%20-%3E%20%2211%22%20%5Blabel%3D%22%22%5D%3B%0A%20%20%227%22%20-%3E%20%228%22%20%5Blabel%3D%22%25x65%22%5D%3B%20%227%22%20-%3E%20%228%22%20%5Blabel%3D%22%25x45%22%5D%3B%0A%20%20%228%22%20-%3E%20%229%22%20%5Blabel%3D%22%22%5D%3B%20%228%22%20-%3E%20%229%22%20%5Blabel%3D%22%25x2B%22%5D%3B%20%228%22%20-%3E%20%229%22%20%5Blabel%3D%22%25x2D%22%5D%3B%0A%20%20%229%22%20-%3E%20%2210%22%20%5Blabel%3D%22%25x30-39%22%5D%3B%0A%20%20%2210%22%20-%3E%20%2210%22%20%5Blabel%3D%22%25x30-39%22%5D%3B%20%2210%22%20-%3E%20%2211%22%20%5Blabel%3D%22%22%5D%3B%0A%7D%0A" rel="nofollow ugc">https://stamm-wilbrandt.de/GraphvizFiddle/?1660482135372#%2F*
    fsm for JSON "number" (http%3A%2F%2Ftools.ietf.org%2Fsearch%2Frfc4627%23page-4)
*%2F
digraph G {
  size%3D"12%2C12"%3B rankdir%3DLR%3B 

  node[style%3Dinvis] A%3BB%3BC%3BD%3BE%3BF%3BG%3B node[style%3Dsolid]%3B

  { rank%3Dsame%3B "A"%3B "F"%3B "1"%3B } { rank%3Dsame%3B "E"%3B "G"%3B "11" }
  { rank%3Dsame%3B "B"%3B "2"%3B } { rank%3Dsame%3B "C"%3B "4"%3B } { rank%3Dsame%3B "D"%3B "7"%3B }

  "F" -&gt; "G" [label%3D"number\n(rfc4627)"]%3B 
  "A" -&gt; "B" [label%3D"[minus]"]%3B "B" -&gt; "C" [label%3D"int"]%3B 
  "C" -&gt; "D" [label%3D"[frac]"]%3B "D" -&gt; "E" [label%3D"[exp]"]%3B
  "1" -&gt; "2" [label%3D""]%3B "1" -&gt; "2" [label%3D"%25x2D"]%3B "2" -&gt; "4" [label%3D"%25x30"]%3B
  "2" -&gt; "3" [label%3D"%25x31-39"]%3B "3" -&gt; "3" [label%3D"%25x30-39"]%3B
  "3" -&gt; "4" [label%3D""]%3B "4" -&gt; "7" [label%3D""]%3B "4" -&gt; "5" [label%3D"%25x2E"]%3B
  "5" -&gt; "6" [label%3D"%25x30-39"]%3B "6" -&gt; "6" [label%3D"%25x30-39"]%3B
  "6" -&gt; "7" [label%3D""]%3B "7" -&gt; "11" [label%3D""]%3B
  "7" -&gt; "8" [label%3D"%25x65"]%3B "7" -&gt; "8" [label%3D"%25x45"]%3B
  "8" -&gt; "9" [label%3D""]%3B "8" -&gt; "9" [label%3D"%25x2B"]%3B "8" -&gt; "9" [label%3D"%25x2D"]%3B
  "9" -&gt; "10" [label%3D"%25x30-39"]%3B
  "10" -&gt; "10" [label%3D"%25x30-39"]%3B "10" -&gt; "11" [label%3D""]%3B
}
</a></p>
]]></description><link>https://openjscad.nodebb.com/topic/379/openscad-xyz-support-for-data-uri-scheme-would-be-cool</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 21:11:14 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/379.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Aug 2022 12:54:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to openscad.xyz support for &quot;data:&quot; URI scheme would be cool on Sat, 20 Aug 2022 08:46:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hermann-sw" aria-label="Profile: Hermann-SW">@<bdi>Hermann-SW</bdi></a> Good questions...</p>
<p dir="auto">The website has a little Perl script that does the download of the requested file, and checks the content. This does two things; only know file types are allowed, and this goes around CORS.</p>
<p dir="auto"><a href="https://github.com/jscad/OpenJSCAD.org/blob/master/packages/web/remote.pl" rel="nofollow ugc">https://github.com/jscad/OpenJSCAD.org/blob/master/packages/web/remote.pl</a></p>
<p dir="auto">I guess that supporting data URL would be possible, but there would have to be some similar checks for data type, etc.</p>
]]></description><link>https://openjscad.nodebb.com/post/1249</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1249</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 20 Aug 2022 08:46:02 GMT</pubDate></item><item><title><![CDATA[Reply to openscad.xyz support for &quot;data:&quot; URI scheme would be cool on Tue, 16 Aug 2022 15:36:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/z3dev" aria-label="Profile: z3dev">@<bdi>z3dev</bdi></a> Thanks, I see your point wrt security.</p>
<p dir="auto">But what is the difference of ...uri=data:... to this openscad.xyz link with model wrt security? In case you eval the uri= specified file (and that seems to be the case because the model gets rendered in browser) you break the same security rules ...<br />
<a href="https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js" rel="nofollow ugc">https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js</a></p>
]]></description><link>https://openjscad.nodebb.com/post/1246</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1246</guid><dc:creator><![CDATA[Hermann-SW]]></dc:creator><pubDate>Tue, 16 Aug 2022 15:36:23 GMT</pubDate></item><item><title><![CDATA[Reply to openscad.xyz support for &quot;data:&quot; URI scheme would be cool on Tue, 16 Aug 2022 12:07:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hermann-sw" aria-label="Profile: Hermann-SW">@<bdi>Hermann-SW</bdi></a> thanks for the suggestions.</p>
<p dir="auto">The support of data URL contents is not trivia, especially if you expect the 'data' to be evaluated as a JavaScript module. That's kind of breaking every security rule in the book.</p>
<p dir="auto">However, the support for DATA formats might be possible, such as supplying JSON contents. But that would be very limited.</p>
<p dir="auto">I think the real solution would be allowing the require() to include modules from remote sites. There are many such requests (issues) for the same functionality.</p>
<p dir="auto">If you have any ideas then let's discuss via the GitHub discussions. There may be a solution, as modern browsers have a lot of functionality.</p>
]]></description><link>https://openjscad.nodebb.com/post/1245</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1245</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Tue, 16 Aug 2022 12:07:41 GMT</pubDate></item></channel></rss>