@geosynk/vertigis-web-sdk 1.0.1 → 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
|
@@ -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>
|
|
@@ -115,6 +115,34 @@ export default merge(defaultWebpackConfig, {
|
|
|
115
115
|
protocol: "wss",
|
|
116
116
|
},
|
|
117
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
|
+
},
|
|
118
146
|
onListening: function () {
|
|
119
147
|
setupDualPortBridge(3001, 3000);
|
|
120
148
|
},
|