JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Can "openjscad.xyz/?uri=..." support "data" protocol in addition to "http(s)"?

    Design Discussions
    2
    5
    634
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Hermann-SW
      Hermann-SW last edited by Hermann-SW

      I have minimal JSCAD file:

      $ cat JSCAD.minimal.js 
      module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})}
      $
      

      I have it online on my webserver as well, and can start openjscad.xyz with it easily, and it just works:
      https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js

      Then I tried to use "data" protocol:

      $ cat doit
      #!/bin/bash
      browser=firefox
      browser=chromium-browser
      
      $browser "openjscad.xyz?uri=data:text/plain;base64,`base64 -w 0 $1`"
      $ ./doit JSCAD.minimal.js 
      Opening in existing browser session.
      $ 
      

      But that URI does not work:
      https://openjscad.xyz/?uri=data:text/plain;base64,bW9kdWxlLmV4cG9ydHM9ZnVuY3Rpb24gbWFpbigpe3JldHVybiByZXF1aXJlKCdAanNjYWQvbW9kZWxpbmcnKS5wcmltaXRpdmVzLnNwaGVyZSh7cmFkaXVzOiA1MH0pfQo=

      Is there a reason why data scheme does not work for "?uri=data..."?
      If not, can it be enabled?

      I ask because this method would allow to share simple JSCAD files in the URL without storing them somewhere ...

      I tested, and there is an 8KB URI length limitation on openjscad.xyz. But in case data scheme would work, maybe "...?uri=data:application/gzip,base64;..." would work as well, allowing for scripts with gzipped length of up to 6KB ...

      Regards,

      Hermann.

      P.S:
      My GraphvizFiddle tool has a similar Share button approach, allowing to share a design via URL, eg:
      https://stamm-wilbrandt.de/GraphvizFiddle/?1705330894960#digraph%20G%20%7Brankdir%3DLR%3B%20JS-%3ECAD%7D%0A

      1 Reply Last reply Reply Quote 0
      • Hermann-SW
        Hermann-SW @hrgdavor last edited by

        @hrgdavor Thanks, done:
        https://github.com/jscad/OpenJSCAD.org/issues/1318

        1 Reply Last reply Reply Quote 1
        • hrgdavor
          hrgdavor @Hermann-SW last edited by

          @Hermann-SW yes, the repo is better for bugs and features

          Hermann-SW 1 Reply Last reply Reply Quote 0
          • Hermann-SW
            Hermann-SW @hrgdavor last edited by Hermann-SW

            @hrgdavor Sure, Hermann-SW.
            Should I create the issue against this repo?
            https://github.com/jscad/OpenJSCAD.org

            9/2022 I created thread on user user callbacks:
            https://openjscad.nodebb.com/topic/384/are-there-jscad-user-callbacks?_=1705433092538
            Should I create a freature request issue on that as well?

            Regards,

            Hermann.

            hrgdavor 1 Reply Last reply Reply Quote 0
            • hrgdavor
              hrgdavor last edited by

              @Hermann-SW do you have an github account ? This would be nicer as a github issue.

              Hermann-SW 1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB | Contributors