Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 258067c

Browse files
committed
refactor(GraphiQL): Subscriptions transport ws
1 parent 71ec1df commit 258067c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

graphiql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphiql/boot/GraphiQLController.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class GraphiQLController {
3838
private static final String ES_6_PROMISE = "es6-promise";
3939
private static final String REACT = "react";
4040
private static final String REACT_DOM = "react-dom";
41-
private static final String SUBSCRIPTIONS_TRANSPORT_WS = "subscriptions-transport-*ws";
41+
private static final String SUBSCRIPTIONS_TRANSPORT_WS = "subscriptions-transport-ws";
4242
private static final String GRAPHIQL_SUBSCRIPTIONS_FETCHER = "graphiql-subscriptions-fetcher";
4343

4444
@Value("${graphiql.endpoint.graphql:/graphql}")
@@ -132,11 +132,11 @@ private Map<String, String> getReplacements(String graphqlEndpoint, String subsc
132132
graphiqlCdnVersion, "graphiql.min.css"));
133133
replacements.put("graphiqlJsUrl", getCdnJsUrl(staticBasePath, graphiqlCdnEnabled, GRAPHIQL,
134134
graphiqlCdnVersion, "graphiql.min.js"));
135-
replacements.put("subscriptionsTransportWsBrowserClient", getJsDeliverUrl(staticBasePath, graphiqlCdnEnabled,
136-
SUBSCRIPTIONS_TRANSPORT_WS, "@0.9.15", "/browser/client.js",
137-
"subscriptions-transport-ws-browser-client-0.8.3.js"));
138-
replacements.put("graphiqlSubscriptionsFetcherBrowserClient", getJsDeliverUrl(staticBasePath, graphiqlCdnEnabled,
139-
GRAPHIQL_SUBSCRIPTIONS_FETCHER, "@0.0.2", "/browser/client.js",
135+
replacements.put("subscriptionsTransportWsBrowserClient", getJsDelivrUrl(staticBasePath, graphiqlCdnEnabled,
136+
SUBSCRIPTIONS_TRANSPORT_WS, "@0.9.15", "browser/client.js",
137+
"subscriptions-transport-ws-browser-client-0.9.15.js"));
138+
replacements.put("graphiqlSubscriptionsFetcherBrowserClient", getJsDelivrUrl(staticBasePath, graphiqlCdnEnabled,
139+
GRAPHIQL_SUBSCRIPTIONS_FETCHER, "@0.0.2", "browser/client.js",
140140
"graphiql-subscriptions-fetcher-browser-client-0.0.2.js"));
141141
replacements.put("props", props);
142142
replacements.put("headers", headers);
@@ -152,10 +152,10 @@ private String getCdnJsUrl(String staticBasePath, Boolean isCdnEnabled, String l
152152
return staticBasePath + "vendor/" + filename;
153153
}
154154

155-
private String getJsDeliverUrl(String staticBasePath, Boolean isCdnEnabled, String library,
156-
String cdnVersion, String cdnFileName, String filename) {
155+
private String getJsDelivrUrl(String staticBasePath, Boolean isCdnEnabled, String library,
156+
String cdnVersion, String cdnFileName, String filename) {
157157
if (isCdnEnabled && StringUtils.isNotBlank(cdnVersion)) {
158-
return CDN_JSDELIVR_NET_NPM + library + cdnVersion + "/" + cdnFileName;
158+
return CDN_JSDELIVR_NET_NPM + library + "/" + cdnVersion + "/" + cdnFileName;
159159
}
160160
return staticBasePath + "vendor/" + filename;
161161
}

graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
justify-content: center;
2323
text-align: center;
2424
}
25+
2526
</style>
2627

2728
<script src="${es6PromiseJsUrl}"></script>
@@ -146,6 +147,7 @@
146147
React.createElement(GraphiQL, props),
147148
document.body
148149
);
150+
149151
</script>
150152
</body>
151153
</html>

0 commit comments

Comments
 (0)