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 #6659 - Swagger schemes selection default to page's protocol #6660

Merged

Conversation

richmahn
Copy link
Contributor

@richmahn richmahn commented Apr 16, 2019

Fixes #6659

Makes it so the Schemes selection on the swagger page (e.g. http://localhost:3000/api/swagger) doesn't have to be set if the website uses https. Before would always just default to HTTP since it was the first item in the v1_json.tmpl file. Uses pure javascript to move the protocol of the page's url to the top of the list by getting the swagger json file first, manimpultes json.schemes, and then calls SwaggerUIBundle() with that JSON object rather than a URL.

Fix taken and modified from: https://gist.github.com/miguelmota/289643541cf55825f14d2ea66598bf64

Can see it work with https at https://bg.door43.org/api/swagger

@richmahn richmahn changed the title Fixes #6659 - Swagger schemes selection default to page's Fixes #6659 - Swagger schemes selection default to page's protocol Apr 16, 2019
@techknowlogick techknowlogick added modifies/api This PR adds API routes or modifies them type/bug topic/ui Change the appearance of the Gitea UI labels Apr 16, 2019
@techknowlogick techknowlogick added this to the 1.9.0 milestone Apr 16, 2019
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Apr 16, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 16, 2019
@codecov-io
Copy link

Codecov Report

Merging #6660 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6660   +/-   ##
=======================================
  Coverage   40.54%   40.54%           
=======================================
  Files         406      406           
  Lines       54501    54501           
=======================================
  Hits        22095    22095           
  Misses      29370    29370           
  Partials     3036     3036

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 450fc9a...72c5573. Read the comment docs.

@techknowlogick techknowlogick merged commit 38b4c23 into go-gitea:master Apr 16, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make swagger scheme dropdown have the website's protocol selected
6 participants