forgejo/templates/swagger/ui.tmpl

13 lines
476 B
Go HTML Template
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
[BRANDING] Replace branding in Swagger - "Gitea" is automatically being determined in Swagger and cannot be overridden, therefor we override it after `swagger generate spec` is run. - Resolves https://codeberg.org/forgejo/forgejo/issues/226 (cherry picked from commit 0b453807656b6fbe54284d865e59880460f3d253) [BRANDING] Change Swagger title to Forgejo API (cherry picked from commit 79f6a70b53421be9984a9ad96ebd0d06ab5af02e) (cherry picked from commit 6cd47afe3366a615d40655a435275d5543910065) (cherry picked from commit a7ae2e4c09431cd7a1f18c5b87b9dd87981b538d) (cherry picked from commit 59f837e4661233dafc202ded9ad907dbdf7e3e69) (cherry picked from commit c1c3d1f0e63b880baa32d285d3eba6034137b45a) (cherry picked from commit 4b088713fb0a55c2c37f734ce82f13190ca412dd) (cherry picked from commit 3df1d2137112a95279a8c84a8601e4c137d75d4f) (cherry picked from commit a4a5fdbde4f9ebbf5ba6ba66c8f20a89e54860de) (cherry picked from commit 57aa9ed710a95aa51ae3824873c3766b38da7850) (cherry picked from commit 948b49bf9449af744a1f2e1324187897ed1c0809) (cherry picked from commit be4929ab6a802d7d748f537ab8b798e30588c1d4) (cherry picked from commit 9ecb507457d8a6aa60713762a1a5d2995ed986e5) Conflicts: templates/swagger/ui.tmpl (cherry picked from commit 8e57e688637b9fbd3c33d3e38aed8768a2c07208) (cherry picked from commit f0b3f621e34130c75b35c113ad509ab73118e123) (cherry picked from commit 5b0a6d093ea5210a5ba27705b1d1636e23da8738) (cherry picked from commit 2e0f6b5de8837a439ecadaf3434d006d7014016c) (cherry picked from commit bb08076f5c26481d78855823c2daa1a76d3865fb) (cherry picked from commit 5c9360e38a41a4494b1b1b247f9d57b1a0d91ef0) (cherry picked from commit 2f277561489e1228af163fa4e5d153ceb7eec864) (cherry picked from commit 6fce7eeb511d949249e045a995cc637d3788a1f0) (cherry picked from commit 8d27e7bebd961468bd492c4d64e132a46d97f62b) (cherry picked from commit fda2ee2aaedac8f394d9fc38085f768c775d2c38) (cherry picked from commit fe0489a4d856655fdcf93c16a41995709c47f78f) (cherry picked from commit fe9479b357d2ef0f5fd8247e8356ce7c75135b88) (cherry picked from commit 1deadb2f35c8c0c87cd93b6f04675312b1e667bb) (cherry picked from commit d1cb84b2f225c484755172735841e3b75abce409) (cherry picked from commit 9de15d49f8ff0ef0803e8b3a7437a45358e924b9) (cherry picked from commit 461fbe219c30de7e756ce2cb6dbc354417655a6f) (cherry picked from commit f39bf3ba5b6325898968533e79fdfc5fe74c3810) (cherry picked from commit b3f31c2f7bc5b4f5ed3f7fb6e6a6649331eb179a) (cherry picked from commit b9f493c139bc40bb5aaf361b813019968be75968) (cherry picked from commit 83781b16411d49f2f27b622ac3e806234b477984) (cherry picked from commit 4438ee0434f88fc0dcb917304a5baf5b8c2d11a8) (cherry picked from commit 56b6b368334fe3d11fb55b8e35bbfc314f45405a) (cherry picked from commit dde88ed2fda2403159e78f174357c5e993bce1de) (cherry picked from commit 96bb13ce5428dd88866c92cd4d9b4e216d7e544f) (cherry picked from commit aacc824826922e1a17be556dfbaf36667950a5aa)
2023-01-09 21:28:04 +00:00
<title>Forgejo API</title>
<link href="{{AssetUrlPrefix}}/css/swagger.css?v={{AssetVersion}}" rel="stylesheet">
</head>
<body>
<a class="swagger-back-link" href="{{AppSubUrl}}/">{{svg "octicon-reply"}}{{ctx.Locale.Tr "return_to_gitea"}}</a>
Introduce customized HTML elements, fix incorrect AppUrl usages in templates (#22861) This PR follows: * #21986 * #22831 This PR also introduce customized HTML elements, which would also help problems like: * #17760 * #21429 * #21440 With customized HTML elements, there won't be any load-search-replace operations, and it can avoid page flicking (which @silverwind cares a lot). Browser support: https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements # FAQ ## Why the component has the prefix? As usual, I would strongly suggest to add prefixes for our own/private names. The dedicated prefix will avoid conflicts in the future, and it makes it easier to introduce various 3rd components, like GitHub's `relative-time` component. If there is no prefix, it's impossible to introduce another public component with the same name in the future. ## Why the `custcomp.js` is loaded before HTML body? The `index.js` is after HTML body. Customized components must be registered before the content loading. Otherwise there would be still some flicking. `custcomp.js` should have its own dependencies and should be very light, so it won't affect the page loading time too much. ## Why use `data-url` attribute but not use the `textContent`? According to the standard, the `connectedCallback` occurs on the tag-opening moment. The element's children are not ready yet. ## Why not use `{{.GuessCurrentOrigin $.ctx ...}}` to let backend decide the absolute URL? It's difficult for backend to guess the correct protocol(scheme) correctly with zero configuration. Generating the absolute URL from frontend can guarantee that the URL is 100% correct -- since the user is visiting it. # Screenshot <details> ![image](https://user-images.githubusercontent.com/2114189/218256757-a267c8ba-3108-4755-9ae5-329f1b08f615.png) </details>
2023-02-17 14:02:20 +00:00
<div id="swagger-ui" data-source="{{AppSubUrl}}/swagger.{{.APIJSONVersion}}.json"></div>
<script src="{{AssetUrlPrefix}}/js/swagger.js?v={{AssetVersion}}"></script>
</body>
</html>