@akemona-org/strapi-plugin-documentation 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +170 -0
  3. package/admin/src/assets/images/logo.svg +1 -0
  4. package/admin/src/components/Block/components.js +26 -0
  5. package/admin/src/components/Block/index.js +39 -0
  6. package/admin/src/components/Row/ButtonContainer.js +53 -0
  7. package/admin/src/components/Row/components.js +83 -0
  8. package/admin/src/components/Row/index.js +57 -0
  9. package/admin/src/containers/App/index.js +30 -0
  10. package/admin/src/containers/HomePage/actions.js +72 -0
  11. package/admin/src/containers/HomePage/components.js +59 -0
  12. package/admin/src/containers/HomePage/constants.js +14 -0
  13. package/admin/src/containers/HomePage/index.js +283 -0
  14. package/admin/src/containers/HomePage/reducer.js +49 -0
  15. package/admin/src/containers/HomePage/saga.js +126 -0
  16. package/admin/src/containers/HomePage/selectors.js +34 -0
  17. package/admin/src/containers/Initializer/index.js +28 -0
  18. package/admin/src/containers/Initializer/tests/index.test.js +21 -0
  19. package/admin/src/index.js +57 -0
  20. package/admin/src/lifecycles.js +13 -0
  21. package/admin/src/permissions.js +19 -0
  22. package/admin/src/pluginId.js +5 -0
  23. package/admin/src/reducers.js +8 -0
  24. package/admin/src/translations/ar.json +23 -0
  25. package/admin/src/translations/cs.json +24 -0
  26. package/admin/src/translations/de.json +30 -0
  27. package/admin/src/translations/en.json +31 -0
  28. package/admin/src/translations/es.json +27 -0
  29. package/admin/src/translations/fr.json +29 -0
  30. package/admin/src/translations/id.json +28 -0
  31. package/admin/src/translations/index.js +49 -0
  32. package/admin/src/translations/it.json +29 -0
  33. package/admin/src/translations/ko.json +24 -0
  34. package/admin/src/translations/ms.json +26 -0
  35. package/admin/src/translations/nl.json +24 -0
  36. package/admin/src/translations/pl.json +27 -0
  37. package/admin/src/translations/pt-BR.json +24 -0
  38. package/admin/src/translations/pt.json +24 -0
  39. package/admin/src/translations/ru.json +31 -0
  40. package/admin/src/translations/sk.json +27 -0
  41. package/admin/src/translations/th.json +27 -0
  42. package/admin/src/translations/tr.json +23 -0
  43. package/admin/src/translations/uk.json +26 -0
  44. package/admin/src/translations/vi.json +27 -0
  45. package/admin/src/translations/zh-Hans.json +31 -0
  46. package/admin/src/translations/zh.json +27 -0
  47. package/admin/src/utils/getTrad.js +5 -0
  48. package/admin/src/utils/openWithNewTab.js +20 -0
  49. package/config/functions/bootstrap.js +138 -0
  50. package/config/policies/index.js +35 -0
  51. package/config/routes.json +74 -0
  52. package/config/settings.json +46 -0
  53. package/controllers/Documentation.js +303 -0
  54. package/middlewares/documentation/defaults.json +5 -0
  55. package/middlewares/documentation/index.js +59 -0
  56. package/package.json +89 -0
  57. package/public/index.html +57 -0
  58. package/public/login.html +135 -0
  59. package/services/Documentation.js +1861 -0
  60. package/services/Token.js +31 -0
  61. package/services/utils/components.json +25 -0
  62. package/services/utils/forms.json +29 -0
  63. package/services/utils/parametersOptions.json +134 -0
  64. package/services/utils/unknownComponent.json +11 -0
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Module dependencies
5
+ */
6
+
7
+ // Public node modules.
8
+ const path = require('path');
9
+ const _ = require('lodash');
10
+ const swaggerUi = require('swagger-ui-dist');
11
+ const koaStatic = require('koa-static');
12
+
13
+ // Variables.
14
+ const initialRoutes = [];
15
+
16
+ module.exports = strapi => {
17
+ return {
18
+ beforeInitialize() {
19
+ strapi.config.middleware.load.before.push('documentation');
20
+
21
+ initialRoutes.push(..._.cloneDeep(strapi.plugins.documentation.config.routes));
22
+ },
23
+
24
+ initialize() {
25
+ // Find the plugins routes.
26
+ strapi.plugins.documentation.config.routes = strapi.plugins.documentation.config.routes.map(
27
+ (route, index) => {
28
+ if (route.handler === 'Documentation.getInfos') {
29
+ return route;
30
+ }
31
+
32
+ if (route.handler === 'Documentation.index' || route.path === '/login') {
33
+ route.config.policies = initialRoutes[index].config.policies;
34
+ }
35
+
36
+ // Set prefix to empty to be able to customise it.
37
+ if (_.get(strapi.plugins, ['documentation', 'config', 'x-strapi-config', 'path'])) {
38
+ route.config.prefix = '';
39
+ route.path = `/${strapi.plugins.documentation.config['x-strapi-config'].path}${route.path}`.replace(
40
+ '//',
41
+ '/'
42
+ );
43
+ }
44
+
45
+ return route;
46
+ }
47
+ );
48
+
49
+ strapi.router.get('/plugins/documentation/*', async (ctx, next) => {
50
+ ctx.url = path.basename(ctx.url);
51
+
52
+ return await koaStatic(swaggerUi.getAbsoluteFSPath(), {
53
+ maxage: strapi.config.middleware.settings.public.maxAge,
54
+ defer: true,
55
+ })(ctx, next);
56
+ });
57
+ },
58
+ };
59
+ };
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@akemona-org/strapi-plugin-documentation",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "3.7.0",
7
+ "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
8
+ "strapi": {
9
+ "name": "Documentation",
10
+ "icon": "book",
11
+ "description": "documentation.plugin.description"
12
+ },
13
+ "scripts": {
14
+ "test": "echo \"no tests yet\""
15
+ },
16
+ "dependencies": {
17
+ "@akemona-org/strapi-helper-plugin": "3.7.0",
18
+ "@buffetjs/core": "3.3.8",
19
+ "@buffetjs/custom": "3.3.8",
20
+ "@buffetjs/hooks": "3.3.8",
21
+ "@buffetjs/icons": "3.3.8",
22
+ "@buffetjs/styles": "3.3.8",
23
+ "@buffetjs/utils": "3.3.8",
24
+ "cheerio": "^1.0.0-rc.5",
25
+ "fs-extra": "^9.1.0",
26
+ "immutable": "^3.8.2",
27
+ "jsonwebtoken": "^8.1.0",
28
+ "koa-static": "^5.0.0",
29
+ "lodash": "4.17.21",
30
+ "moment": "^2.29.4",
31
+ "path-to-regexp": "^3.1.0",
32
+ "react": "^16.14.0",
33
+ "react-copy-to-clipboard": "^5.0.3",
34
+ "react-dom": "^16.9.0",
35
+ "react-intl": "4.5.0",
36
+ "react-redux": "7.2.3",
37
+ "react-router": "^5.2.0",
38
+ "react-router-dom": "^5.0.0",
39
+ "reactstrap": "8.4.1",
40
+ "redux": "^4.0.1",
41
+ "redux-immutable": "^4.0.0",
42
+ "reselect": "^4.0.0",
43
+ "swagger-ui-dist": "3.47.1"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/akemona/strapi.git",
48
+ "directory": "packages/strapi-plugin-documentation"
49
+ },
50
+ "author": {
51
+ "name": "soupette",
52
+ "email": "strapi@akemona.com",
53
+ "url": "https://strapi.akemona.com"
54
+ },
55
+ "maintainers": [
56
+ {
57
+ "name": "Strapi",
58
+ "email": "strapi@akemona.com",
59
+ "url": "https://strapi.akemona.com"
60
+ },
61
+ {
62
+ "name": "soupette",
63
+ "email": "cyril@strapi.io"
64
+ },
65
+ {
66
+ "name": "lauriejim",
67
+ "email": "jim@strapi.io"
68
+ }
69
+ ],
70
+ "contributors": [
71
+ {
72
+ "name": "soupette"
73
+ },
74
+ {
75
+ "name": "Aurelsicoko",
76
+ "email": "aurelien@strapi.io"
77
+ },
78
+ {
79
+ "name": "lauriejim",
80
+ "email": "jim@strapi.io"
81
+ }
82
+ ],
83
+ "engines": {
84
+ "node": ">=10.16.0 <=14.x.x",
85
+ "npm": ">=6.0.0"
86
+ },
87
+ "license": "SEE LICENSE IN LICENSE",
88
+ "gitHead": "129a8d6191b55810fd66448dcc47fee829df986c"
89
+ }
@@ -0,0 +1,57 @@
1
+ <!-- HTML for static distribution bundle build --><!DOCTYPE html><html lang="en"><head>
2
+ <meta charset="UTF-8">
3
+ <title>Swagger UI</title>
4
+ <link rel="stylesheet" type="text/css" href="<%=backendUrl%>/plugins/documentation/swagger-ui.css">
5
+ <link rel="icon" type="image/png" href="<%=backendUrl%>/plugins/documentation/favicon-32x32.png" sizes="32x32">
6
+ <link rel="icon" type="image/png" href="<%=backendUrl%>/plugins/documentation/favicon-16x16.png" sizes="16x16">
7
+ <style>
8
+ html
9
+ {
10
+ box-sizing: border-box;
11
+ overflow: -moz-scrollbars-vertical;
12
+ overflow-y: scroll;
13
+ }
14
+
15
+ *,
16
+ *:before,
17
+ *:after
18
+ {
19
+ box-sizing: inherit;
20
+ }
21
+
22
+ body
23
+ {
24
+ margin:0;
25
+ background: #fafafa;
26
+ }
27
+ </style>
28
+ </head>
29
+
30
+ <body>
31
+ <div id="swagger-ui"></div>
32
+ <script class="custom-swagger-ui">
33
+ window.onload = function() {
34
+ const ui = SwaggerUIBundle({
35
+ url: "https://petstore.swagger.io/v2/swagger.json",
36
+ spec: <%=spec%>,
37
+ dom_id: '#swagger-ui',
38
+ docExpansion: "none",
39
+ deepLinking: true,
40
+ presets: [
41
+ SwaggerUIBundle.presets.apis,
42
+ SwaggerUIStandalonePreset,
43
+ ],
44
+ plugins: [
45
+ SwaggerUIBundle.plugins.DownloadUrl,
46
+ ],
47
+ layout: "StandaloneLayout",
48
+ });
49
+
50
+ window.ui = ui;
51
+ }
52
+ </script>
53
+
54
+ <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-bundle.js"> </script>
55
+ <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-standalone-preset.js"> </script>
56
+ </body>
57
+ </html>
@@ -0,0 +1,135 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Login - Documentation</title>
3
+ <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
4
+ <style>
5
+ html {
6
+ font-size: 62.5%;
7
+ height: 100%;
8
+ margin: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ body {
13
+ height: 100%;
14
+ margin: 0;
15
+ background-color: #ffffff;
16
+ font-family: 'Lato';
17
+ font-size: 1.4rem;
18
+ font-weight: 400;
19
+ text-rendering: optimizeLegibility;
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+ }
23
+
24
+ .login {
25
+ height: 100%;
26
+ background-color: #F6F9FC;
27
+ }
28
+
29
+ .login .login-form {
30
+ height: calc(100% - 70px);
31
+ padding: 68px 0 0;
32
+ text-align: center;
33
+ }
34
+
35
+ .login .login-form form {
36
+ position: relative;
37
+ max-width: 460px;
38
+ padding: 26px 30px;
39
+ margin: 55px auto 0;
40
+ background-color: #ffffff;
41
+ border-radius: 3px;
42
+ box-shadow: 0px 2px 4px rgba(91, 107, 174, .15);
43
+ text-align: center;
44
+ }
45
+
46
+ .login .login-form form:before {
47
+ position: absolute;
48
+ content: '';
49
+ top: 0px;
50
+ left: 0;
51
+ display: inline-block;
52
+ width: 100%;
53
+ height: 2px;
54
+ background-color: #2B66CC;
55
+ }
56
+
57
+ .login .login-form form .error {
58
+ display: block;
59
+ color: #FF4E00;
60
+ padding-bottom: 20px;
61
+ }
62
+
63
+ .login .login-form .sub-title {
64
+ margin-top: 35px;
65
+ font-size: 1.6rem;
66
+ font-weight: 400;
67
+ }
68
+
69
+ .login .login-form .logo{
70
+ max-height: 40px;
71
+ }
72
+
73
+ .login .login-form form label {
74
+ display: block;
75
+ margin-bottom: 18px;
76
+ width: 100%;
77
+ text-align: left;
78
+ font-weight: 600;
79
+ }
80
+
81
+ .login .login-form form input {
82
+ outline: none;
83
+ width: calc(100% - 30px);
84
+ height: 36px;
85
+ padding: 0 15px;
86
+ border: 1px solid #ECECEC;
87
+ border-radius: 2px;
88
+ margin-bottom: 20px;
89
+ line-height: 36px;
90
+ text-align: left;
91
+ }
92
+
93
+ .login .login-form form input[type=submit] {
94
+ cursor: pointer;
95
+ display: inline-block;
96
+ width: auto;
97
+ margin: 12px auto 0;
98
+ padding: 0 75px;
99
+ background: transparent;
100
+ border-radius: 36px;
101
+ border: 1px solid #2B66CC;
102
+ color: #2B66CC;
103
+ text-transform: uppercase;
104
+ font-size: 1.4rem;
105
+ font-weight: 700;
106
+ transition: all .2s ease-out;
107
+ }
108
+
109
+ .login .login-form form input[type=submit]:hover {
110
+ background: #2B66CC;
111
+ color: #ffffff;
112
+ }
113
+ </style>
114
+ </head>
115
+ <body>
116
+ <div class="login">
117
+ <section class="login-form">
118
+ <div class="container">
119
+ <div class="row">
120
+ <div class="col-lg-6 col-lg-offset-3 col-md-12">
121
+ <img alt="Strapi logo" class="logo" src="https://strapi.akemona.com/assets/images/logo_login.png">
122
+ <h2 class="sub-title">Enter the password to access the documentation.</h2>
123
+ <form method="post" action="<%=actionUrl%>">
124
+ <span class="error">Wrong password...</span>
125
+ <label>Password</label>
126
+ <input type="password" name="password" placeholder="&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;">
127
+ <input type="submit" value="Login">
128
+ </form>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ </section>
133
+ </div>
134
+
135
+ </body></html>