├── .gitignore
├── LICENSE
├── README.md
├── app.json
├── build
├── asset-manifest.json
├── images
│ ├── adsk.24x24.png
│ ├── forge-icon.png
│ ├── forge-logo-footer.png
│ ├── forge-logo.png
│ ├── fusion-engine.png
│ ├── fusion-rcar.png
│ ├── revit-factory.png
│ ├── revit-house.png
│ ├── rhino-legocar.png
│ ├── tie-fighter.png
│ ├── urban-house.png
│ └── viewer-rocks-preview.png
├── index.html
├── service-worker.js
└── static
│ ├── css
│ ├── main.d17c5ebf.css
│ └── main.d17c5ebf.css.map
│ ├── js
│ ├── main.77805bae.js
│ └── main.77805bae.js.map
│ └── media
│ ├── fontawesome-webfont.674f50d2.eot
│ ├── fontawesome-webfont.912ec66d.svg
│ ├── fontawesome-webfont.af7ae505.woff2
│ ├── fontawesome-webfont.b06871f2.ttf
│ ├── fontawesome-webfont.fee66e71.woff
│ ├── glyphicons-halflings-regular.448c34a5.woff2
│ ├── glyphicons-halflings-regular.89889688.svg
│ ├── glyphicons-halflings-regular.e18bbf61.ttf
│ ├── glyphicons-halflings-regular.f4769f9b.eot
│ └── glyphicons-halflings-regular.fa277232.woff
├── package-lock.json
├── package.json
├── public
├── images
│ ├── adsk.24x24.png
│ ├── forge-icon.png
│ ├── forge-logo-footer.png
│ ├── forge-logo.png
│ ├── fusion-engine.png
│ ├── fusion-rcar.png
│ ├── revit-factory.png
│ ├── revit-house.png
│ ├── rhino-legocar.png
│ ├── tie-fighter.png
│ ├── urban-house.png
│ └── viewer-rocks-preview.png
└── index.html
├── routes
└── auth.js
├── server
├── aps.js
├── config.js
└── server.js
├── src
├── actions
│ ├── index.js
│ ├── viewerActions.js
│ └── viewerTypes.js
├── components
│ ├── App.css
│ ├── App.js
│ ├── Client.js
│ ├── Footer
│ │ ├── Footer.js
│ │ ├── footer.css
│ │ └── index.js
│ ├── Gallery
│ │ ├── Gallery.js
│ │ ├── gallery.css
│ │ └── index.js
│ ├── Jumbotron
│ │ ├── Jumbotron.js
│ │ ├── index.js
│ │ └── jumbotron.css
│ ├── Properties
│ │ ├── Properties.js
│ │ ├── index.js
│ │ └── properties.css
│ └── Viewer
│ │ ├── Viewer-helpers.js
│ │ └── Viewer.js
├── index.js
├── reducers
│ ├── index.js
│ └── viewerReducer.js
└── store.js
└── thumbnail.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 |
6 | # testing
7 | coverage
8 |
9 | # production
10 | # build
11 |
12 | # misc
13 | .DS_Store
14 | .env
15 | npm-debug.log
16 |
17 |
18 | cra-server-ex.graffle
19 | server/credentials.js
20 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Autodesk, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Viewer - React - Express - Headless
2 |
3 | [](https://nodejs.org/)
4 | [](https://www.npmjs.com/)
5 | 
6 | [](http://opensource.org/licenses/MIT)
7 |
8 | [](http://developer.autodesk.com/)
9 | [](http://developer.autodesk.com/)
10 |
11 | ## Description
12 |
13 | Using Forge Viewer, you have the option of a Headless one, the option to add your own logo and get rid of extension that interact with the viewer is possible.
14 | I created a demonstration of this scenario using React on the Front End, Redux to handle states for Properties metadata access and NodeJS (Express) together with React-Scripts to handle the authentication and access to the use of the Forge services.
15 |
16 | The available Extensions once in Full Screen mode are.
17 | - Properties (Categories are display with the option to expand to see all metadata available from the model)
18 | - Explode Slider
19 | - Explode Animation
20 | - Rotate Animation
21 | - Restate of the model to original form
22 |
23 | This sample show a simple integration of the [Viewer](https://developer.autodesk.com/en/docs/viewer/v2/overview/) in a headless way with custom made extensions. The front-end will look like:
24 |
25 | ### Thumbnail
26 |
27 | 
28 |
29 | ## Setup
30 |
31 | The 6 models will need to translated and hosted on your own bucket. This will change the URN values that will need to be subtitued here.
32 | [URN Gallery JSON](https://github.com/Autodesk-Forge/viewer-react-express-headless/blob/master/src/components/Gallery/Gallery.js#L29)
33 |
34 | Feel free to use your own models in the Gallery.
35 |
36 | ### Note Restore State
37 |
38 | The Restore State functionality is hardcoded for the specific models. You will need to get the State for each of your models and pass the new JSON value at this location
39 | [Restore State JSON](https://github.com/Autodesk-Forge/viewer-react-express-headless/blob/master/src/components/Viewer/Viewer-helpers.js#L156)
40 |
41 | ### Development mode
42 |
43 | Follow these instructions to get the app running locally:
44 |
45 | 1. run `git clone` this repository
46 | 1. `cd` into the project's directory
47 | 1. create a file called `server/credentials.js` with your credentials, [follow this template](https://github.com/Autodesk-Forge/viewer-react-express-headless/blob/master/server/credentials_.js)
48 | 1. run `npm install`
49 | 1. run `npm run watch`
50 |
51 | This will get a server running locally, open `http://localhost:3000` on your browser to see the app running.
52 |
53 | ### Production mode
54 |
55 | To run this app in production mode, run `npm run build` and then `npm start` in a production environment.
56 |
57 | If you try to deploy this on Heroku, we set a `postinstall` script that will run the `build` script, so there is no need to run it again, simply let Heroku run `npm start` (which it does automatically) and you'll be good to go.
58 |
59 | ## Heroku Deployment
60 |
61 | To deploy this project to Heroku, be sure to set your environment variables in the dashboard:
62 |
63 | - `FORGE_CLIENT_ID`
64 | - `FORGE_CLIENT_SECRET`
65 |
66 | [](https://heroku.com/deploy)
67 |
68 | --------
69 |
70 | ## License
71 |
72 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
73 | Please see the [LICENSE](LICENSE) file for full details.
74 |
75 |
76 | ## Written by
77 |
78 | Jaime Rosales D.
79 | [](https://twitter.com/AfroJme) Forge Partner Development
80 | Forge Developer Portal
81 |
82 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "viewer-react-express-headless",
3 | "description": "A React and Node JS (express) sample demonstrating the use of Forge Headless Viewer and custom made extensions.",
4 | "repository": "https://github.com/Autodesk-Forge/viewer-react-express-headless.git",
5 | "logo": "https://github.com/Autodesk-Forge/viewer-react-express-headless/raw/master/public/images/adsk.24x24.png",
6 | "keywords": [ "node", "forge", "autodesk", "react" ],
7 | "website": "https://developer.autodesk.com/",
8 | "env": {
9 | "FORGE_CLIENT_ID": {
10 | "description": "Replace with your FORGE CLIENT ID KEY",
11 | "value": "public"
12 | },
13 | "FORGE_CLIENT_SECRET": {
14 | "description": "Replace with your FORGE CLIENT SECRET KEY",
15 | "value": "secret"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/build/asset-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "main.css": "static/css/main.d17c5ebf.css",
3 | "main.css.map": "static/css/main.d17c5ebf.css.map",
4 | "main.js": "static/js/main.77805bae.js",
5 | "main.js.map": "static/js/main.77805bae.js.map",
6 | "static/media/fontawesome-webfont.eot": "static/media/fontawesome-webfont.674f50d2.eot",
7 | "static/media/fontawesome-webfont.svg?v=4.7.0": "static/media/fontawesome-webfont.912ec66d.svg",
8 | "static/media/fontawesome-webfont.ttf?v=4.7.0": "static/media/fontawesome-webfont.b06871f2.ttf",
9 | "static/media/fontawesome-webfont.woff2?v=4.7.0": "static/media/fontawesome-webfont.af7ae505.woff2",
10 | "static/media/fontawesome-webfont.woff?v=4.7.0": "static/media/fontawesome-webfont.fee66e71.woff",
11 | "static/media/glyphicons-halflings-regular.eot": "static/media/glyphicons-halflings-regular.f4769f9b.eot",
12 | "static/media/glyphicons-halflings-regular.svg": "static/media/glyphicons-halflings-regular.89889688.svg",
13 | "static/media/glyphicons-halflings-regular.ttf": "static/media/glyphicons-halflings-regular.e18bbf61.ttf",
14 | "static/media/glyphicons-halflings-regular.woff": "static/media/glyphicons-halflings-regular.fa277232.woff",
15 | "static/media/glyphicons-halflings-regular.woff2": "static/media/glyphicons-halflings-regular.448c34a5.woff2"
16 | }
--------------------------------------------------------------------------------
/build/images/adsk.24x24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/adsk.24x24.png
--------------------------------------------------------------------------------
/build/images/forge-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/forge-icon.png
--------------------------------------------------------------------------------
/build/images/forge-logo-footer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/forge-logo-footer.png
--------------------------------------------------------------------------------
/build/images/forge-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/forge-logo.png
--------------------------------------------------------------------------------
/build/images/fusion-engine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/fusion-engine.png
--------------------------------------------------------------------------------
/build/images/fusion-rcar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/fusion-rcar.png
--------------------------------------------------------------------------------
/build/images/revit-factory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/revit-factory.png
--------------------------------------------------------------------------------
/build/images/revit-house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/revit-house.png
--------------------------------------------------------------------------------
/build/images/rhino-legocar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/rhino-legocar.png
--------------------------------------------------------------------------------
/build/images/tie-fighter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/tie-fighter.png
--------------------------------------------------------------------------------
/build/images/urban-house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/urban-house.png
--------------------------------------------------------------------------------
/build/images/viewer-rocks-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/images/viewer-rocks-preview.png
--------------------------------------------------------------------------------
/build/index.html:
--------------------------------------------------------------------------------
1 |
Autodesk Viewer
--------------------------------------------------------------------------------
/build/service-worker.js:
--------------------------------------------------------------------------------
1 | "use strict";var precacheConfig=[["/index.html","537864ad045928b0cb5a7c5596e64bec"],["/static/css/main.d17c5ebf.css","e1d99bf736ca259dc278009f177d6dd6"],["/static/js/main.77805bae.js","6382eae1dd57f67aa3afa5fd7ad34860"],["/static/media/fontawesome-webfont.674f50d2.eot","674f50d287a8c48dc19ba404d20fe713"],["/static/media/fontawesome-webfont.912ec66d.svg","912ec66d7572ff821749319396470bde"],["/static/media/fontawesome-webfont.af7ae505.woff2","af7ae505a9eed503f8b8e6982036873e"],["/static/media/fontawesome-webfont.b06871f2.ttf","b06871f281fee6b241d60582ae9369b9"],["/static/media/fontawesome-webfont.fee66e71.woff","fee66e712a8a08eef5805a46892932ad"],["/static/media/glyphicons-halflings-regular.448c34a5.woff2","448c34a56d699c29117adc64c43affeb"],["/static/media/glyphicons-halflings-regular.89889688.svg","89889688147bd7575d6327160d64e760"],["/static/media/glyphicons-halflings-regular.e18bbf61.ttf","e18bbf611f2a2e43afc071aa2f4e1512"],["/static/media/glyphicons-halflings-regular.f4769f9b.eot","f4769f9bdb7466be65088239c12046d1"],["/static/media/glyphicons-halflings-regular.fa277232.woff","fa2772327f55d8198301fdb8bcfc8158"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,a){var r=new URL(e);return a&&r.pathname.match(a)||(r.search+=(r.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),r.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],a=new URL(t,self.location),r=createCacheKey(a,hashParamName,n,/\.\w{8}\./);return[a.toString(),r]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(a){return setOfCachedUrls(a).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return a.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),a="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,a),e=urlsToCacheKeys.has(n));var r="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(r,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}});
--------------------------------------------------------------------------------
/build/static/media/fontawesome-webfont.674f50d2.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/fontawesome-webfont.674f50d2.eot
--------------------------------------------------------------------------------
/build/static/media/fontawesome-webfont.af7ae505.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/fontawesome-webfont.af7ae505.woff2
--------------------------------------------------------------------------------
/build/static/media/fontawesome-webfont.b06871f2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/fontawesome-webfont.b06871f2.ttf
--------------------------------------------------------------------------------
/build/static/media/fontawesome-webfont.fee66e71.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/fontawesome-webfont.fee66e71.woff
--------------------------------------------------------------------------------
/build/static/media/glyphicons-halflings-regular.448c34a5.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/glyphicons-halflings-regular.448c34a5.woff2
--------------------------------------------------------------------------------
/build/static/media/glyphicons-halflings-regular.89889688.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/build/static/media/glyphicons-halflings-regular.e18bbf61.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/glyphicons-halflings-regular.e18bbf61.ttf
--------------------------------------------------------------------------------
/build/static/media/glyphicons-halflings-regular.f4769f9b.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/glyphicons-halflings-regular.f4769f9b.eot
--------------------------------------------------------------------------------
/build/static/media/glyphicons-halflings-regular.fa277232.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/build/static/media/glyphicons-halflings-regular.fa277232.woff
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "viewer-server",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "npm run start:server",
7 | "watch": "npm-run-all --parallel start:*",
8 | "start:server": "node server/server.js",
9 | "start:client": "react-scripts start",
10 | "build": "react-scripts build",
11 | "test": "react-scripts test --env=jsdom",
12 | "eject": "react-scripts eject",
13 | "postinstall": "npm run build"
14 | },
15 | "author": "Jaime Rosales",
16 | "license": "MIT",
17 | "proxy": "http://localhost:3001/",
18 | "repository": {
19 | "type": "git",
20 | "url": "git+https://github.com/Autodesk-Forge/viewer-react-express-headless.git"
21 | },
22 | "bugs": {
23 | "url": "https://github.com/Autodesk-Forge/viewer-react-express-headless/issues"
24 | },
25 | "dependencies": {
26 | "@aps_sdk/authentication": "^0.1.0-beta.1",
27 | "@aps_sdk/autodesk-sdkmanager": "^0.0.7-beta.1",
28 | "axios": "^0.15.2",
29 | "babel-cli": "^6.26.0",
30 | "babel-core": "^6.26.3",
31 | "babel-preset-es2015": "6.3.13",
32 | "babel-preset-stage-0": "6.5.0",
33 | "bootstrap": "^3.3.7",
34 | "classnames": "^2.2.6",
35 | "dotenv": "^16.4.5",
36 | "express": "^4.16.3",
37 | "font-awesome": "^4.7.0",
38 | "lodash": "^4.17.10",
39 | "npm-run-all": "^3.1.1",
40 | "react": "^15.3.2",
41 | "react-dom": "^15.3.2",
42 | "react-redux": "^5.0.7",
43 | "react-scripts": "^1.1.4",
44 | "redux": "^3.6.0",
45 | "scroll-to": "0.0.2"
46 | },
47 | "babel": {
48 | "presets": [
49 | "es2015",
50 | "stage-0"
51 | ]
52 | },
53 | "engines": {
54 | "node": "6.7.x",
55 | "npm": "3.10.x"
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/public/images/adsk.24x24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/adsk.24x24.png
--------------------------------------------------------------------------------
/public/images/forge-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/forge-icon.png
--------------------------------------------------------------------------------
/public/images/forge-logo-footer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/forge-logo-footer.png
--------------------------------------------------------------------------------
/public/images/forge-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/forge-logo.png
--------------------------------------------------------------------------------
/public/images/fusion-engine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/fusion-engine.png
--------------------------------------------------------------------------------
/public/images/fusion-rcar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/fusion-rcar.png
--------------------------------------------------------------------------------
/public/images/revit-factory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/revit-factory.png
--------------------------------------------------------------------------------
/public/images/revit-house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/revit-house.png
--------------------------------------------------------------------------------
/public/images/rhino-legocar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/rhino-legocar.png
--------------------------------------------------------------------------------
/public/images/tie-fighter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/tie-fighter.png
--------------------------------------------------------------------------------
/public/images/urban-house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/urban-house.png
--------------------------------------------------------------------------------
/public/images/viewer-rocks-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk-Forge/viewer-react-express-headless/03292f6321ccae0e8ac5b8dcf6b921ea280977e9/public/images/viewer-rocks-preview.png
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
23 | Autodesk Viewer
24 |
25 |
26 |
27 |
28 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const { getPublicToken } = require('../server/aps');
3 |
4 | let router = express.Router();
5 |
6 | router.get('/token', async function (req, res, next) {
7 | try {
8 | res.json(await getPublicToken());
9 | } catch (err) {
10 | next(err);
11 | }
12 | });
13 |
14 | module.exports = router;
--------------------------------------------------------------------------------
/server/aps.js:
--------------------------------------------------------------------------------
1 | const { SdkManagerBuilder } = require('@aps_sdk/autodesk-sdkmanager');
2 | const { AuthenticationClient, Scopes } = require('@aps_sdk/authentication');
3 | const { APS_CLIENT_ID, APS_CLIENT_SECRET } = require('./config.js');
4 |
5 |
6 | const sdk = SdkManagerBuilder.create().build();
7 | const authenticationClient = new AuthenticationClient(sdk);
8 |
9 | const service = module.exports = {};
10 |
11 |
12 | service.getPublicToken = async () => {
13 | const credentials = await authenticationClient.getTwoLeggedToken(APS_CLIENT_ID, APS_CLIENT_SECRET, [
14 | Scopes.DataRead
15 | ]);
16 | return credentials;
17 | };
--------------------------------------------------------------------------------
/server/config.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config();
2 |
3 | let { APS_CLIENT_ID, APS_CLIENT_SECRET, PORT } = process.env;
4 | if (!APS_CLIENT_ID || !APS_CLIENT_SECRET) {
5 | console.warn('Missing some of the environment variables.');
6 | process.exit(1);
7 | }
8 |
9 | PORT = PORT || 3001;
10 |
11 | module.exports = {
12 | APS_CLIENT_ID,
13 | APS_CLIENT_SECRET,
14 | PORT
15 | };
--------------------------------------------------------------------------------
/server/server.js:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Autodesk, Inc. All rights reserved
3 | // Written by Jaime Rosales 2016 - Forge Developer Partner Services
4 | //
5 | // Permission to use, copy, modify, and distribute this software in
6 | // object code form for any purpose and without fee is hereby granted,
7 | // provided that the above copyright notice appears in all copies and
8 | // that both that copyright notice and the limited warranty and
9 | // restricted rights notice below appear in all supporting
10 | // documentation.
11 | //
12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
16 | // UNINTERRUPTED OR ERROR FREE.
17 | /////////////////////////////////////////////////////////////////////////////////
18 |
19 | const path = require('path');
20 | const express = require('express');
21 | const app = express();
22 | const request = require('request');
23 | const { PORT } = require('./config.js');
24 |
25 |
26 |
27 | app.use(express.static("../build"));
28 | app.use(require('../routes/auth.js'));
29 |
30 |
31 | app.listen(PORT, function () { console.log(`Server listening on port ${PORT}...`); });
--------------------------------------------------------------------------------
/src/actions/index.js:
--------------------------------------------------------------------------------
1 | import * as actions from './viewerActions';
2 | import * as types from './viewerTypes';
3 |
4 | export {
5 | types,
6 | actions,
7 | }
--------------------------------------------------------------------------------
/src/actions/viewerActions.js:
--------------------------------------------------------------------------------
1 | import * as types from './viewerTypes';
2 |
3 | export function getViewerProperties(properties = []) {
4 | //console.log('action', properties)
5 | return {
6 | type: types.GET_AGGREGATE_PROPERTIES,
7 | properties,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/actions/viewerTypes.js:
--------------------------------------------------------------------------------
1 | export const GET_AGGREGATE_PROPERTIES = 'GET_AGGREGATE_PROPERTIES';
--------------------------------------------------------------------------------
/src/components/App.css:
--------------------------------------------------------------------------------
1 | body.fullscreen {
2 | max-height: 100vh;
3 | overflow: hidden;
4 | }
5 |
--------------------------------------------------------------------------------
/src/components/App.js:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Autodesk, Inc. All rights reserved
3 | // Written by Jaime Rosales 2016 - Forge Developer Partner Services
4 | //
5 | // Permission to use, copy, modify, and distribute this software in
6 | // object code form for any purpose and without fee is hereby granted,
7 | // provided that the above copyright notice appears in all copies and
8 | // that both that copyright notice and the limited warranty and
9 | // restricted rights notice below appear in all supporting
10 | // documentation.
11 | //
12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
16 | // UNINTERRUPTED OR ERROR FREE.
17 | /////////////////////////////////////////////////////////////////////////////////
18 |
19 | import React, { Component } from 'react';
20 | import Jumbotron from './Jumbotron';
21 | import Footer from './Footer';
22 | import Gallery from './Gallery';
23 | import 'bootstrap/dist/css/bootstrap.css';
24 | import './App.css';
25 | import 'font-awesome/css/font-awesome.css';
26 |
27 | class App extends Component {
28 | render() {
29 | return (
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 | }
40 |
41 | export default App;
42 |
--------------------------------------------------------------------------------
/src/components/Client.js:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Autodesk, Inc. All rights reserved
3 | // Written by Jaime Rosales 2016 - Forge Developer Partner Services
4 | //
5 | // Permission to use, copy, modify, and distribute this software in
6 | // object code form for any purpose and without fee is hereby granted,
7 | // provided that the above copyright notice appears in all copies and
8 | // that both that copyright notice and the limited warranty and
9 | // restricted rights notice below appear in all supporting
10 | // documentation.
11 | //
12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
16 | // UNINTERRUPTED OR ERROR FREE.
17 | /////////////////////////////////////////////////////////////////////////////////
18 |
19 | import axios from 'axios';
20 |
21 | function getaccesstoken() {
22 | return axios.get('/token')
23 | .then(function (response) {
24 | return response.data;
25 | })
26 | .catch(function (error) {
27 | console.log(error);
28 | });
29 | }
30 |
31 | const Client = { getaccesstoken };
32 | export default Client;
--------------------------------------------------------------------------------
/src/components/Footer/Footer.js:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Autodesk, Inc. All rights reserved
3 | // Written by Jaime Rosales 2016 - Forge Developer Partner Services
4 | //
5 | // Permission to use, copy, modify, and distribute this software in
6 | // object code form for any purpose and without fee is hereby granted,
7 | // provided that the above copyright notice appears in all copies and
8 | // that both that copyright notice and the limited warranty and
9 | // restricted rights notice below appear in all supporting
10 | // documentation.
11 | //
12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
16 | // UNINTERRUPTED OR ERROR FREE.
17 | /////////////////////////////////////////////////////////////////////////////////
18 |
19 | import React, { Component } from 'react';
20 | import './footer.css';
21 |
22 | class Footer extends Component {
23 | render() {
24 | return (
25 |