@strapi/plugin-documentation 4.0.4 → 4.0.8
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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"coming-soon": "Indholdet er på nuværende tidspunkt under konstruktion og kommer tilbage om et par uger!",
|
|
3
|
+
"components.Row.open": "Åben",
|
|
4
|
+
"components.Row.regenerate": "Regenerér",
|
|
5
|
+
"containers.HomePage.Block.title": "Versioner",
|
|
6
|
+
"containers.HomePage.Button.update": "Opdatér",
|
|
7
|
+
"containers.HomePage.PluginHeader.title": "Dokumentation - Indstillinger",
|
|
8
|
+
"containers.HomePage.PopUpWarning.confirm": "Jeg forstår",
|
|
9
|
+
"containers.HomePage.PopUpWarning.message": "Er du sikker på at du vil slette denne version?",
|
|
10
|
+
"containers.HomePage.copied": "Token kopieret til klippebord",
|
|
11
|
+
"containers.HomePage.form.jwtToken": "Hent dit jwt token",
|
|
12
|
+
"containers.HomePage.form.jwtToken.description": "Kopier dette token og brug det i swagger når du laver requests",
|
|
13
|
+
"containers.HomePage.form.password": "Kodeord",
|
|
14
|
+
"containers.HomePage.form.password.inputDescription": "Indstil kodeordet for at tilgå dokumentationen",
|
|
15
|
+
"containers.HomePage.form.restrictedAccess": "Begrænset adgang",
|
|
16
|
+
"containers.HomePage.form.restrictedAccess.inputDescription": "Gør dokumentationens endpoint private. Som standard er det offentligt",
|
|
17
|
+
"containers.HomePage.form.showGeneratedFiles": "Vis genererede filer",
|
|
18
|
+
"containers.HomePage.form.showGeneratedFiles.inputDescription": "Nyttig når du vil overskrive den genererede dokumentation. \nPluginnet vil generere filter splittet af model og plugin. \nVed at aktivere denne option bliver det nemmere at tilpasse din dokumentation",
|
|
19
|
+
"error.deleteDoc.versionMissing": "Versionen du prøver at slette, findes ikke.",
|
|
20
|
+
"error.noVersion": "En version er påkrævet",
|
|
21
|
+
"error.regenerateDoc": "Der opstod en fejl ved generering af dokumentation",
|
|
22
|
+
"error.regenerateDoc.versionMissing": "Versionen du forsøger at generere findes ikke",
|
|
23
|
+
"notification.delete.success": "Dokumentation slettet",
|
|
24
|
+
"notification.generate.success": "Dokumentation genereret",
|
|
25
|
+
"notification.update.success": "Indstillingerne er opdateret",
|
|
26
|
+
"pages.PluginPage.Button.open": "Åben dokumentation",
|
|
27
|
+
"pages.PluginPage.header.description": "Konfigurér dokumentations pluginnet",
|
|
28
|
+
"pages.PluginPage.table.generated": "Sidst genereret",
|
|
29
|
+
"pages.PluginPage.table.icon.delete": "Slet {target}",
|
|
30
|
+
"pages.PluginPage.table.icon.regenerate": "Regenerér {target}",
|
|
31
|
+
"pages.PluginPage.table.icon.show": "Åben {target}",
|
|
32
|
+
"pages.PluginPage.table.version": "Version",
|
|
33
|
+
"pages.SettingsPage.title": "Indstillinger",
|
|
34
|
+
"pages.SettingsPage.Button.description": "Konfigurér dokumentations pluginnet",
|
|
35
|
+
"pages.SettingsPage.header.save": "Gem",
|
|
36
|
+
"pages.SettingsPage.password.label": "Kodeord",
|
|
37
|
+
"pages.SettingsPage.toggle.hint": "Gør dokumentationens endpoint privat",
|
|
38
|
+
"pages.SettingsPage.toggle.label": "Begrænset adgang",
|
|
39
|
+
"plugin.description.long": "Opret et OpenAPI dokument og visualisér dit API med SWAGGER UI.",
|
|
40
|
+
"plugin.description.short": "Opret et OpenAPI dokument og visualisér dit API med SWAGGER UI.",
|
|
41
|
+
"plugin.name": "Dokumentation"
|
|
42
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"coming-soon": "¡Este contenido está actualmente en construcción y estará de regreso en unas semanas!",
|
|
2
3
|
"components.Row.open": "Abrir",
|
|
3
4
|
"components.Row.regenerate": "Regenerar",
|
|
4
5
|
"containers.HomePage.Block.title": "Versiones",
|
|
@@ -19,6 +20,23 @@
|
|
|
19
20
|
"error.noVersion": "Se requiere una versión",
|
|
20
21
|
"error.regenerateDoc": "Se produjo un error al regenerar el documento.",
|
|
21
22
|
"error.regenerateDoc.versionMissing": "La versión que está intentando generar no existe",
|
|
23
|
+
"notification.delete.success": "Documento eliminado",
|
|
24
|
+
"notification.generate.success": "Documento generado",
|
|
22
25
|
"notification.update.success": "Configuración actualizada correctamente",
|
|
26
|
+
"pages.PluginPage.Button.open": "Abrir documentación",
|
|
27
|
+
"pages.PluginPage.header.description": "Configura el plugin de documentación",
|
|
28
|
+
"pages.PluginPage.table.generated": "Último generado",
|
|
29
|
+
"pages.PluginPage.table.icon.delete": "Eliminar {target}",
|
|
30
|
+
"pages.PluginPage.table.icon.regenerate": "Regenerar {target}",
|
|
31
|
+
"pages.PluginPage.table.icon.show": "Abrir {target}",
|
|
32
|
+
"pages.PluginPage.table.version": "Versión",
|
|
33
|
+
"pages.SettingsPage.title": "Ajustes",
|
|
34
|
+
"pages.SettingsPage.Button.description": "Configura el plugin de documentación",
|
|
35
|
+
"pages.SettingsPage.header.save": "Guardar",
|
|
36
|
+
"pages.SettingsPage.password.label": "Contraseña",
|
|
37
|
+
"pages.SettingsPage.toggle.hint": "Hacer que la documentación sea privada",
|
|
38
|
+
"pages.SettingsPage.toggle.label": "Acceso restringido",
|
|
39
|
+
"plugin.description.long": "Cree un documento OpenAPI y visualice su API con SWAGGER UI.",
|
|
40
|
+
"plugin.description.short": "Cree un documento OpenAPI y visualice su API con SWAGGER UI.",
|
|
23
41
|
"plugin.name": "Documentación"
|
|
24
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-documentation",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,12 +24,11 @@
|
|
|
24
24
|
"test": "echo \"no tests yet\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@strapi/helper-plugin": "4.0.
|
|
28
|
-
"@strapi/utils": "4.0.
|
|
27
|
+
"@strapi/helper-plugin": "4.0.8",
|
|
28
|
+
"@strapi/utils": "4.0.8",
|
|
29
29
|
"bcryptjs": "2.4.3",
|
|
30
30
|
"cheerio": "^1.0.0-rc.5",
|
|
31
31
|
"fs-extra": "^9.1.0",
|
|
32
|
-
"koa-session": "6.2.0",
|
|
33
32
|
"koa-static": "^5.0.0",
|
|
34
33
|
"lodash": "4.17.21",
|
|
35
34
|
"path-to-regexp": "6.2.0",
|
|
@@ -45,6 +44,9 @@
|
|
|
45
44
|
"reselect": "^4.0.0",
|
|
46
45
|
"swagger-ui-dist": "3.47.1"
|
|
47
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@strapi/strapi": "^4.0.0"
|
|
49
|
+
},
|
|
48
50
|
"engines": {
|
|
49
51
|
"node": ">=12.22.0 <=16.x.x",
|
|
50
52
|
"npm": ">=6.0.0"
|
|
@@ -55,5 +57,5 @@
|
|
|
55
57
|
"description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
|
|
56
58
|
"kind": "plugin"
|
|
57
59
|
},
|
|
58
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "669bb2f0440d3b21a23c8d665fdba98bd3d8cc71"
|
|
59
61
|
}
|
package/server/config/index.js
CHANGED
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const defaultDocumentationConfig = require('./default-config');
|
|
4
4
|
|
|
5
|
-
const defaultConfig = {
|
|
6
|
-
...defaultDocumentationConfig,
|
|
7
|
-
session: {
|
|
8
|
-
key: 'plugin::documentation.sess',
|
|
9
|
-
maxAge: 'session',
|
|
10
|
-
secretKeys: ['mySecret'],
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
5
|
module.exports = {
|
|
15
|
-
default:
|
|
6
|
+
default: defaultDocumentationConfig,
|
|
16
7
|
};
|
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const koaStatic = require('koa-static');
|
|
5
|
-
const session = require('koa-session');
|
|
6
5
|
const swaggerUi = require('swagger-ui-dist');
|
|
7
6
|
|
|
8
7
|
module.exports = async ({ strapi }) => {
|
|
9
|
-
const sessionConfig = strapi.config.get('plugin.documentation').session;
|
|
10
|
-
strapi.server.app.keys = sessionConfig.secretKeys;
|
|
11
|
-
strapi.server.app.use(session(sessionConfig, strapi.server.app));
|
|
12
|
-
|
|
13
8
|
strapi.server.routes([
|
|
14
9
|
{
|
|
15
10
|
method: 'GET',
|
|
@@ -20,6 +20,10 @@ module.exports = ({ strapi }) => {
|
|
|
20
20
|
return path.join(strapi.dirs.extensions, 'documentation', 'documentation');
|
|
21
21
|
},
|
|
22
22
|
|
|
23
|
+
getCustomDocumentationPath() {
|
|
24
|
+
return path.join(strapi.dirs.extensions, 'documentation', 'config', 'settings.json');
|
|
25
|
+
},
|
|
26
|
+
|
|
23
27
|
getDocumentationVersions() {
|
|
24
28
|
return fs
|
|
25
29
|
.readdirSync(this.getFullDocumentationPath())
|
|
@@ -103,6 +107,16 @@ module.exports = ({ strapi }) => {
|
|
|
103
107
|
return [...apisToDocument, ...pluginsToDocument];
|
|
104
108
|
},
|
|
105
109
|
|
|
110
|
+
async getCustomSettings() {
|
|
111
|
+
const customConfigPath = this.getCustomDocumentationPath();
|
|
112
|
+
const pathExists = await fs.pathExists(customConfigPath);
|
|
113
|
+
if (pathExists) {
|
|
114
|
+
return fs.readJson(customConfigPath);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {};
|
|
118
|
+
},
|
|
119
|
+
|
|
106
120
|
/**
|
|
107
121
|
* @description - Creates the Swagger json files
|
|
108
122
|
*/
|
|
@@ -133,20 +147,24 @@ module.exports = ({ strapi }) => {
|
|
|
133
147
|
'full_documentation.json'
|
|
134
148
|
);
|
|
135
149
|
|
|
136
|
-
const
|
|
150
|
+
const defaultSettings = _.cloneDeep(defaultConfig);
|
|
137
151
|
|
|
138
152
|
const serverUrl = getAbsoluteServerUrl(strapi.config);
|
|
139
153
|
const apiPath = strapi.config.get('api.rest.prefix');
|
|
140
154
|
|
|
141
|
-
_.set(
|
|
155
|
+
_.set(defaultSettings, 'servers', [
|
|
142
156
|
{
|
|
143
157
|
url: `${serverUrl}${apiPath}`,
|
|
144
158
|
description: 'Development server',
|
|
145
159
|
},
|
|
146
160
|
]);
|
|
147
161
|
|
|
148
|
-
_.set(
|
|
149
|
-
_.set(
|
|
162
|
+
_.set(defaultSettings, ['info', 'x-generation-date'], new Date().toISOString());
|
|
163
|
+
_.set(defaultSettings, ['info', 'version'], version);
|
|
164
|
+
|
|
165
|
+
const customSettings = await this.getCustomSettings();
|
|
166
|
+
|
|
167
|
+
const settings = _.merge(defaultSettings, customSettings);
|
|
150
168
|
|
|
151
169
|
await fs.ensureFile(fullDocJsonPath);
|
|
152
170
|
await fs.writeJson(fullDocJsonPath, { ...settings, paths }, { spaces: 2 });
|