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

    proxyUrl setting

    Scheduled Pinned Locked Moved General Discussions
    14 Posts 3 Posters 3.2k 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.
    • H Offline
      hamade
      last edited by

      Hi

      I am now trying to include openjscad interface on our website.
      The modeling scripts are ready, and works well, but I am not able to mount the script file directly on the page like

      https://YOURSITE/?uri=http://www.thingiverse.com/download:164128

      or

      https://YOURSITE/#http://www.thingiverse.com/download:164128

      the readme in the github says that

      use and path of the proxy can be set by:
      β€’ changing the proxyUrl value in src/ui/index.js
      β€’ since this is hardcoded , if you do not use the provided dev server, rebuild your main file (See Contributing)

      but there is no file such as src/ui/index.js
      by default installation.

      Is there something wrong with my installation?

      or any suggestion to set the proxyUrl, and so on
      I would like to know the needed process to enable the remote file loading.

      I am working on:
      https://fablab-shinagawa.org/jscad/packages/web/index.html

      one of the modeling script is:
      https://fablab-shinagawa.org/jscad/designs/fruitsHolder.js

      Thank you

      Founder of FabLab Shinagawa
      Director of hamanakadesignstudio LLC.

      z3devZ 1 Reply Last reply Reply Quote 0
      • z3devZ Offline
        z3dev @hamade
        last edited by

        @hamade welcome

        FYI, you are the first person trying this, i.e. installing the full website.

        This is going to take some extra steps because there's some setup for the website, as well as special files for making the website function properly.

        Are you sure that a 100% copy of the JSCAD website is necessary?

        1 Reply Last reply Reply Quote 0
        • H Offline
          hamade
          last edited by

          @z3dev
          Thank you for your reply.
          Actually, I do not need a 100% copy of the JSCAD website.
          Just want to include JSCAD interface to existing website.
          Instead of former question, I have been working on following URL, just with the necessary script :
          https://fablab-shinagawa.org/jscad/

          In this page, I edited the script temporary so that we are able to manipulate our modeling sources via help menu.

          Anyway, I would like to know the process to activate using those URLs such as :
          https://fablab-shinagawa.org/jscad/index.html#https://fablab-shinagawa.org/jscad/designs/fruitsHolder.js
          without errors.

          Thank you.

          Founder of FabLab Shinagawa
          Director of hamanakadesignstudio LLC.

          hrgdavorH z3devZ 3 Replies Last reply Reply Quote 0
          • hrgdavorH Offline
            hrgdavor @hamade
            last edited by

            @hamade if you setup proper "Access-Control-Allow-Origin" header on your server when downloading https://fablab-shinagawa.org/jscad/designs/fruitsHolder.js you would be able to do it without proxy by direct fetch from js

            this url would work then for my proto that has no proxy
            https://3d.hrg.hr/jscad/three/threejscad2.html?uri=https://fablab-shinagawa.org/jscad/designs/fruitsHolder.js

            for exampe if I put your script to gihtub as a gist it works
            https://3d.hrg.hr/jscad/three/threejscad2.html?uri=https://gist.githubusercontent.com/hrgdavor/08e61d2014ed7b62078fa9106380f634/raw/815d639e16bfa4e88e65e2e50b6772bc17cab35a/fruit.js

            H 1 Reply Last reply Reply Quote 0
            • z3devZ Offline
              z3dev @hamade
              last edited by

              @hamade OK. Here's where to start...

              The webserver must support PERL, as there's a PERL script that runs on the webserver. (I can assist if you are using Apache)

              After configuring and testing the webserver, copy 'remote.pl' to the webserver, and move into the base directory of the jscad website.

              We use...

              /var/www/openjscad.xyz/public_html/remote.pl

              In addition, a new directory needs to be created called 'cache'. The PERL script downloads files and puts the file into this directory.

              1 Reply Last reply Reply Quote 0
              • z3devZ Offline
                z3dev @hamade
                last edited by

                @hamade Those designs are not accessible.

                https://www.fablab-shinagawa.org/designs/petbottleOpener.js

                That URL needs to work, i.e. the file should download and show in the browser.

                So, the webserver configuration is incorrect.

                Here's an example...

                https://openjscad.xyz/examples/core/colors/colorCube.js

                H 1 Reply Last reply Reply Quote 0
                • H Offline
                  hamade @z3dev
                  last edited by

                  @z3dev
                  Thank you for your reply.
                  My rental server supports PERL.
                  I placed "remote.pl" file, and made "cache" folder in the same directory of "index.html". What is the permission setting of "cache" folder ?

                  The URL you showed as not accessible, has to be :
                  https://www.fablab-shinagawa.org/jscad/designs/petbottleOpener.js
                  Modeling scripts has no problem.
                  Please check this link :
                  https://openjscad.xyz/#https://www.fablab-shinagawa.org/jscad/designs/petbottleOpener.js

                  And I always have following error, when I put the link like :
                  https://www.fablab-shinagawa.org/jscad/packages/web/index.html#https://www.fablab-shinagawa.org/jscad/designs/petbottleOpener.js

                  ERROR:
                  Unexpected token # in JSON at position 0
                  Stack: SyntaxError: Unexpected token # in JSON at position 0

                  Founder of FabLab Shinagawa
                  Director of hamanakadesignstudio LLC.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    hamade @hrgdavor
                    last edited by

                    @hrgdavor
                    Thank you for your reply.
                    I think, it might be caused not by CORS matter.
                    Because when I am accessing from the same server, there still shows error message like this (Accessed URL: https://www.fablab-shinagawa.org/jscad/packages/web/index.html#https://fablab-shinagawa.org/jscad/designs/canHolder.js) :

                    ERROR:
                    Unexpected token # in JSON at position 0
                    Stack: SyntaxError: Unexpected token # in JSON at position 0

                    Founder of FabLab Shinagawa
                    Director of hamanakadesignstudio LLC.

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

                      please check browser network tab(it can be seen there why you get syntax error):

                      also in network tab you can see the url that is called and if you open it in a diffferent tab:
                      https://www.fablab-shinagawa.org/jscad/packages/web/remote.pl?url=https://fablab-shinagawa.org/jscad/designs/canHolder.js

                      it looks like your perl script is not executed. You need to cofigure web server to run it instead treating as static asset πŸ™‚

                      H 1 Reply Last reply Reply Quote 0
                      • H Offline
                        hamade @hrgdavor
                        last edited by

                        @hrgdavor
                        Thank you for your reply.
                        I suppose there is no error showed in console.

                        γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2021-10-12 20.12.16.png

                        The console says that :
                        DevTools failed to load source map: Could not parse content for https://www.fablab-shinagawa.org/jscad/packages/web/drawer.css.map: Unexpected token < in JSON at position 0

                        γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2021-10-12 20.15.55.png

                        Founder of FabLab Shinagawa
                        Director of hamanakadesignstudio LLC.

                        hrgdavorH 1 Reply Last reply Reply Quote 0
                        • hrgdavorH Offline
                          hrgdavor @hamade
                          last edited by hrgdavor

                          @hamade the error is exactly right πŸ™‚

                          you have given an url that is not a script, it fails on syntax parsing.

                          and if you take a look into network tab you will see why πŸ™‚

                          you need to fix your proxy script and web server config so it returns js file that you expect instead of perl source of your proxy script.

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            hamade
                            last edited by

                            @hrgdavor
                            Thank you for your reply.
                            I have got what we want.
                            What a beginner, the problem was the suffix of "remote.pl".
                            When I changed to .cgi, it works.

                            Thank you for your support.

                            Founder of FabLab Shinagawa
                            Director of hamanakadesignstudio LLC.

                            z3devZ 1 Reply Last reply Reply Quote 0
                            • z3devZ Offline
                              z3dev @hamade
                              last edited by

                              @hamade Can you provide some feedback on the installation?

                              What webserver are you using?

                              Did you make any special changes to the configuration of the webserver?

                              Did you have any issues installing the web site? Make any changes?

                              H 1 Reply Last reply Reply Quote 0
                              • H Offline
                                hamade @z3dev
                                last edited by

                                @z3dev
                                I am using a rental server of general settings, nothing special, I think.
                                I did no configuration of the web server.
                                I did not changed anything on setting when installing the web site.

                                Thanks to all of you related,
                                I have uploaded the page.
                                https://www.fablab-shinagawa.org/archive/index.html
                                when you click "γƒ‘γƒ©γƒ‘γƒˆγƒͺック" - which means "parametric"- tab,
                                you would see the list of our parametric designs, and again when you click a design,
                                you would link to the page includes openjscad model.

                                Founder of FabLab Shinagawa
                                Director of hamanakadesignstudio LLC.

                                1 Reply Last reply Reply Quote 0

                                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