Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17895: Ensure GraphiQL UI resources are served locally #17901

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion netbox/netbox/graphql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class NetBoxGraphQLView(GraphQLView):
"""
Extends strawberry's GraphQLView to support DRF's token-based authentication.
"""
graphiql_template = 'graphiql.html'

@csrf_exempt
def dispatch(self, request, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
{% load static %}
{% comment %}
This template derives from the strawberry-graphql project:
https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/static/graphiql.html
{% endcomment %}
<!--
The request to this GraphQL server provided the header "Accept: text/html"
and as a result has been presented GraphiQL - an in-browser IDE for
exploring GraphQL.
If you wish to receive JSON, provide the header "Accept: application/json" or
add "&raw" to the end of the URL within a browser.
-->
{% load static %}
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -112,10 +105,7 @@
headers["x-csrftoken"] = csrfToken;
}

const subscriptionsEnabled = JSON.parse("{{ SUBSCRIPTION_ENABLED }}");
const subscriptionUrl = subscriptionsEnabled
? httpUrlToWebSockeUrl(fetchURL)
: null;
const subscriptionUrl = httpUrlToWebSockeUrl(fetchURL);

const fetcher = GraphiQL.createFetcher({
url: fetchURL,
Expand Down