Skip to content

Commit 5381842

Browse files
committed
add swagger-ui documentation
1 parent 2ca8716 commit 5381842

21 files changed

+1889
-5
lines changed

.htaccess

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Options -Indexes -ExecCGI -FollowSymLinks
1717
<ifModule mod_gzip.c>
1818
mod_gzip_on Yes
1919
mod_gzip_dechunk Yes
20-
mod_gzip_item_include file .(html?|css|js|php)$
20+
mod_gzip_item_include file .(html?|css|js|php|md)$
2121
mod_gzip_item_include handler ^cgi-script$
2222
mod_gzip_item_include mime ^text/.*
2323
mod_gzip_item_include mime ^application/x-javascript.*
@@ -79,7 +79,9 @@ DirectoryIndex index.php
7979

8080
RedirectMatch 403 (?i)^.*\/data\/.*\/((?!\.m3u8|\.ts|\.jpg|\.jpeg|\.gif|\.webp|\.png|\.mp3|\.mp4|\.aac|\.svg|\.obj|\.mtl|\.woff|\.woff2|\.ttf|\.css|\.pdf|\.css.map|\.js|\.js.map).)*$
8181
RedirectMatch 403 (?i)^.*\/desktop\/.*\/((?!\.png|\.jpg|\.jpeg|\.gif|\.webp|\.css|\.css.map|\.woff|\.woff2|\.ttf|\.svg|\.txt).)*$
82-
RedirectMatch 403 (?i)^.*\/docs\/.*$
82+
# dans /doc/* Refuser tout sauf les fichiers .md et .yaml et .html et ...
83+
RedirectMatch 403 (?i)^.*\/docs\/.*/((?!\.md|\.yaml|\.html|\.js|\.css|\.png|\.map).)*$
84+
8385
RedirectMatch 403 (?i)^.*\/install\/.*$
8486
RedirectMatch 403 (?i)^.*\/log\/.*$
8587
RedirectMatch 403 (?i)^.*\/mobile\/.*\/((?!\.png|\.jpg|\.jpeg|\.gif|\.webp|\.css|\.css.map|\.woff|\.woff2|\.ttf|\.svg|\.html|\.php).)*$
@@ -101,7 +103,7 @@ Order Allow,Deny
101103

102104
# Allow all :
103105

104-
<FilesMatch ".*\.(css|map|js|jpeg|jpg|png|php|html|svg|woff|woff2|ttf|m3u8|ts|ico|gif|webp|mp3|aac|mp4|pdf|txt)$|(apple\-app\-site\-association)$">
106+
<FilesMatch ".*\.(css|map|js|jpeg|jpg|png|php|html|svg|woff|woff2|ttf|m3u8|ts|ico|gif|webp|mp3|aac|mp4|pdf|txt|md|yaml)$|(apple\-app\-site\-association)$">
105107
Order Allow,Deny
106108
Allow from all
107109
</FilesMatch>
@@ -127,3 +129,7 @@ Order Allow,Deny
127129
Order Allow,Deny
128130
Deny from all
129131
</FilesMatch>
132+
133+
AddType text/plain .yaml .yml
134+
AddCharset UTF-8 .yaml .yml .html
135+
AddType application/yaml .yaml

docs/.htaccess

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/swagger-ui/favicon-16x16.png

665 Bytes
Loading

docs/swagger-ui/favicon-32x32.png

628 Bytes
Loading

docs/swagger-ui/index.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
html {
2+
box-sizing: border-box;
3+
overflow: -moz-scrollbars-vertical;
4+
overflow-y: scroll;
5+
}
6+
7+
*,
8+
*:before,
9+
*:after {
10+
box-sizing: inherit;
11+
}
12+
13+
body {
14+
margin: 0;
15+
background: #fafafa;
16+
}

docs/swagger-ui/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- HTML for static distribution bundle build -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Swagger UI</title>
7+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
8+
<link rel="stylesheet" type="text/css" href="index.css" />
9+
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
10+
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
11+
</head>
12+
13+
<body>
14+
<div id="swagger-ui"></div>
15+
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
16+
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
17+
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
18+
</body>
19+
</html>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<title>Swagger UI: OAuth2 Redirect</title>
5+
</head>
6+
<body>
7+
<script>
8+
'use strict';
9+
function run () {
10+
var oauth2 = window.opener.swaggerUIRedirectOauth2;
11+
var sentState = oauth2.state;
12+
var redirectUrl = oauth2.redirectUrl;
13+
var isValid, qp, arr;
14+
15+
if (/code|token|error/.test(window.location.hash)) {
16+
qp = window.location.hash.substring(1).replace('?', '&');
17+
} else {
18+
qp = location.search.substring(1);
19+
}
20+
21+
arr = qp.split("&");
22+
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
23+
qp = qp ? JSON.parse('{' + arr.join() + '}',
24+
function (key, value) {
25+
return key === "" ? value : decodeURIComponent(value);
26+
}
27+
) : {};
28+
29+
isValid = qp.state === sentState;
30+
31+
if ((
32+
oauth2.auth.schema.get("flow") === "accessCode" ||
33+
oauth2.auth.schema.get("flow") === "authorizationCode" ||
34+
oauth2.auth.schema.get("flow") === "authorization_code"
35+
) && !oauth2.auth.code) {
36+
if (!isValid) {
37+
oauth2.errCb({
38+
authId: oauth2.auth.name,
39+
source: "auth",
40+
level: "warning",
41+
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
42+
});
43+
}
44+
45+
if (qp.code) {
46+
delete oauth2.state;
47+
oauth2.auth.code = qp.code;
48+
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
49+
} else {
50+
let oauthErrorMsg;
51+
if (qp.error) {
52+
oauthErrorMsg = "["+qp.error+"]: " +
53+
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
54+
(qp.error_uri ? "More info: "+qp.error_uri : "");
55+
}
56+
57+
oauth2.errCb({
58+
authId: oauth2.auth.name,
59+
source: "auth",
60+
level: "error",
61+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
62+
});
63+
}
64+
} else {
65+
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
66+
}
67+
window.close();
68+
}
69+
70+
if (document.readyState !== 'loading') {
71+
run();
72+
} else {
73+
document.addEventListener('DOMContentLoaded', function () {
74+
run();
75+
});
76+
}
77+
</script>
78+
</body>
79+
</html>

0 commit comments

Comments
 (0)