@geosynk/vertigis-web-sdk 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geosynk/vertigis-web-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Enterprise SDK for extending VertiGIS Studio Web",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/scripts/start.js CHANGED
@@ -38,4 +38,9 @@ process.on("unhandledRejection", err => {
38
38
  throw err;
39
39
  });
40
40
 
41
+ // Ensure HTTPS server type so devServer opens https:// and never falls back to http://
42
+ if (!process.argv.includes("--type")) {
43
+ process.argv.push("--type", "https");
44
+ }
45
+
41
46
  sdkStart(webpackConfig, "web");
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>OAuth Callback</title>
6
+ <script>
7
+ function loadHandler() {
8
+ if (opener) {
9
+ if (location.hash && opener.completeOAuth) {
10
+ opener.completeOAuth(location.hash);
11
+ close();
12
+ } else if (location.search) {
13
+ opener.dispatchEvent(new CustomEvent("arcgis:auth:location:search", { detail: location.search }));
14
+ close();
15
+ } else {
16
+ close();
17
+ }
18
+ } else {
19
+ close();
20
+ }
21
+ }
22
+ window.addEventListener("load", loadHandler);
23
+ </script>
24
+ </head>
25
+ <body>
26
+ </body>
27
+ </html>
@@ -100,6 +100,7 @@ export default merge(defaultWebpackConfig, {
100
100
  host: "0.0.0.0",
101
101
  port: 3001,
102
102
  server: "https",
103
+ open: "https://localtest.me:3001/",
103
104
  headers: {
104
105
  "Access-Control-Allow-Origin": "*",
105
106
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
@@ -114,6 +115,34 @@ export default merge(defaultWebpackConfig, {
114
115
  protocol: "wss",
115
116
  },
116
117
  },
118
+ setupMiddlewares: (middlewares, devServer) => {
119
+ middlewares.unshift({
120
+ name: "portal-auth-interceptor",
121
+ middleware: (req, res, next) => {
122
+ const url = req.url.split("?")[0];
123
+ if (url === "/viewer/auth/portal.json" || url === "/auth/portal.json") {
124
+ const portalJsonPath = path.resolve(process.cwd(), "app/auth/portal.json");
125
+ if (fs.existsSync(portalJsonPath)) {
126
+ res.setHeader("Content-Type", "application/json");
127
+ res.setHeader("Access-Control-Allow-Origin", "*");
128
+ res.end(fs.readFileSync(portalJsonPath, "utf-8"));
129
+ return;
130
+ }
131
+ }
132
+ if (url === "/oauth_callback.html" || url === "/viewer/oauth_callback.html") {
133
+ const cbPath = path.resolve(process.cwd(), "app/oauth_callback.html");
134
+ if (fs.existsSync(cbPath)) {
135
+ res.setHeader("Content-Type", "text/html");
136
+ res.setHeader("Access-Control-Allow-Origin", "*");
137
+ res.end(fs.readFileSync(cbPath, "utf-8"));
138
+ return;
139
+ }
140
+ }
141
+ next();
142
+ },
143
+ });
144
+ return middlewares;
145
+ },
117
146
  onListening: function () {
118
147
  setupDualPortBridge(3001, 3000);
119
148
  },