JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

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

    Scheduled Pinned Locked Moved Design Discussions
    5 Posts 2 Posters 1.7k Views 2 Watching
    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-SWH Offline
      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
      • hrgdavorH Offline
        hrgdavor
        last edited by

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

        Hermann-SWH 1 Reply Last reply Reply Quote 0
        • Hermann-SWH Offline
          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.

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

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

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

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

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              Powered by NodeBB | Contributors