kovacsv / Online3DViewer

A solution to visualize and explore 3D models in your browser.
https://3dviewer.net
MIT License
2.46k stars 542 forks source link

Local server Share URL has: 3dviewer.net included #458

Closed jlpoolen closed 5 months ago

jlpoolen commented 5 months ago

I installed this super project on my server and find that if I want to share my model, it appears as if the model has to be processed through your domain: 3dviewer.net

Here are the steps I went through:

1) visit my local URL at salemdata.us: firefox_2024-04-05_10-35-36

2) Loaded a file from my desktop: firefox_2024-04-05_10-36-15

3) Tried to share -- got error message that model has to be loaded via a URL: firefox_2024-04-05_10-37-05

4a) Staged my file on my server and then used a URL to load into my instance of Online 3D Viewer: firefox_2024-04-05_10-39-08

4b) File from my URL appears fine: firefox_2024-04-05_10-39-26

5) Tried to share. Found the value using the 1st option "Sharing Link" contains a link to 3dviewer.net: firefox_2024-04-05_10-40-22

6) Found the value using the 2nd options (with & with the "Use customized settings" checked): firefox_2024-04-05_10-44-13

The value of the "Sharing Link" field is: https://3dviewer.net/#model=https://salemdata.us/models/faceplate_202403090853-Body_FaceplatePocket-WeepHole.stl The value of the Embedded code with "Use customized settings" checked is: `

` The value of the Embedded code with "Use customized settings" **UN**checked is: `` In all cases, it looks as though any "shares" generate URLs that point to the domain: 3dviewer.net Question: Is there a way to run this viewer on one's server without having "Share" URLs including reference to "**3dviewer.net**"? I would like to be able to share privately without a call to 3dviewer.net . Thank you. [Edited: revised Steps 3 & 4 to include error message when attempting to share a locally loaded file.]
kovacsv commented 5 months ago

The sharing url is hard-coded in the code. You can make a fork and update this the way you need. You probably only need to modify this file: https://github.com/kovacsv/Online3DViewer/blob/master/source/website/sharingdialog.js

jlpoolen commented 5 months ago

I installed this super project on my server and find that if I want to share my model, it appears as if the model has to be processed through your domain: 3dviewer.net ...

Thank you.

[Edited: revised Steps 3 & 4 to include error message when attempting to share a locally loaded file.]

I should have indicated how I set up the server so others reading this Issue can duplicate:

1) in directory /usr/local/src: git clone https://github.com/kovacsv/Online3DViewer.git 2) in my Apache's htdocs directory, create a link to the project. The manner of accessing the project is critical:

/var/www/salemdata.us/htdocs # ln -s /usr/local/src/Online3DViewer/website 3dviewerB

Note: I linked to the top of the project, e.g. /usr/local/src/Online3DViewer, and then the URL to invoke the project correctly is my server + "3dviewer/website", e.g. https://salemdata.us/3dviewer/website/. I wanted to shorten the URL and remove a directory, so I tried to link directly to the directory "website" with the creation of the link "3dviewerB" that would be accessed with https://salemdata.us/3dviewerB/ and the unfortunate result was a corrupted page:

2024-04-06_12-07

So, it is necessary to point to the top of the project, and then include in the URL "website". At least for now. I'm still exploring this project and I am very impressed with what @kovacsv has created (one-time Patreon minimal donation forthcoming). I followed his suggestion, but rather than fork the project, I just copied what I had staged into a separate directory and changed my soft links. When I started to try and remove the "website" directory in the link, I ran into trouble and got the corrupted page above, so I thought I should share my efforts here so someone else trying to accomplish what I am does not encounter the same problem. I'm not familiar with Node, so what may be standard operating procedure for a developer using Node.js is something I have to grapple with.

kovacsv commented 5 months ago

Please find the setup instructions in the developer documentation.

After the code modification you need to call npm run create_package. This will generate the entire package in the build folder and this is what you can publish on a web server.

jlpoolen commented 5 months ago

Please find the setup instructions in the developer documentation.

After the code modification you need to call npm run create_package. This will generate the entire package in the build folder and this is what you can publish on a web server.

Thank you.

Here's the replacement I made:

janus /usr/local/src/Online3DViewerJLP # date
Sun Apr  7 06:37:11 PM PDT 2024
janus /usr/local/src/Online3DViewerJLP # diff source/website/sharingdialog.js  /usr/local/src/Online3DViewer/source/website/sharingdialog.js 
46c46
<             return 'https://salemdata.us/3dviewer/#' + hashParameters;
---
>             return 'https://3dviewer.net/#' + hashParameters;
83c83
<             embeddingCode += ' src="https://salemdata.us/3dviewer/embed.html#' + hashParameters + '">';
---
>             embeddingCode += ' src="https://3dviewer.net/embed.html#' + hashParameters + '">';
janus /usr/local/src/Online3DViewerJLP # 

I ran npm run create_package and then I created this softlink that points to the correct directory: ln -s /usr/local/src/Online3DViewerJLP/build/package/website /var/www/salemdata.us/htdocs/3dviewer

Also, in the "built" website directory, there is no ".htaccess" with redirects, so the ".htaccess" file I found under [PROJECT]./website/.htaccess appears to be a file used solely for your development/deployment.

Closing this ticket as I have a working solution that is easily created. Thank you, again.