diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce7c894f0..1d60c4a76 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@
## Documentation
- Fixed some issues in the API description
+- Fix security issue in GitHub pages with path insertion
+ [#1457](https://github.com/nextcloud/cookbook/pull/1457) @christianlupus
## 0.10.1 - 2022-11-09
diff --git a/docs/.bundle/config b/docs/.bundle/config
index b6c8cded2..4c19a2acd 100644
--- a/docs/.bundle/config
+++ b/docs/.bundle/config
@@ -1,2 +1,3 @@
---
BUNDLE_BUNDLE_PATH: "vendor/bundle"
+BUNDLE_PATH: "vendor/bundle"
diff --git a/docs/Makefile.local.dist b/docs/Makefile.local.dist
new file mode 100644
index 000000000..021059d4c
--- /dev/null
+++ b/docs/Makefile.local.dist
@@ -0,0 +1,2 @@
+# Example of local configuration
+# BUNDLER = bundler-2.7
diff --git a/docs/dev/api/0.0.2/index.html b/docs/dev/api/0.0.2/index.html
deleted file mode 100644
index 6dd41b004..000000000
--- a/docs/dev/api/0.0.2/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
- Swagger UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/dev/api/0.0.2/index.html b/docs/dev/api/0.0.2/index.html
new file mode 120000
index 000000000..2eba4cfec
--- /dev/null
+++ b/docs/dev/api/0.0.2/index.html
@@ -0,0 +1 @@
+../swagger/index.html
\ No newline at end of file
diff --git a/docs/dev/api/0.0.2/swagger-initializer.js b/docs/dev/api/0.0.2/swagger-initializer.js
new file mode 100644
index 000000000..1b52c6037
--- /dev/null
+++ b/docs/dev/api/0.0.2/swagger-initializer.js
@@ -0,0 +1,20 @@
+window.onload = function() {
+ //
+
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
+ window.ui = SwaggerUIBundle({
+ url: "openapi-cookbook.yaml",
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+
+ //
+};
diff --git a/docs/dev/api/0.0.3/index.html b/docs/dev/api/0.0.3/index.html
deleted file mode 100644
index 6dd41b004..000000000
--- a/docs/dev/api/0.0.3/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
- Swagger UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/dev/api/0.0.3/index.html b/docs/dev/api/0.0.3/index.html
new file mode 120000
index 000000000..2eba4cfec
--- /dev/null
+++ b/docs/dev/api/0.0.3/index.html
@@ -0,0 +1 @@
+../swagger/index.html
\ No newline at end of file
diff --git a/docs/dev/api/0.0.3/swagger-initializer.js b/docs/dev/api/0.0.3/swagger-initializer.js
new file mode 100644
index 000000000..1b52c6037
--- /dev/null
+++ b/docs/dev/api/0.0.3/swagger-initializer.js
@@ -0,0 +1,20 @@
+window.onload = function() {
+ //
+
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
+ window.ui = SwaggerUIBundle({
+ url: "openapi-cookbook.yaml",
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+
+ //
+};
diff --git a/docs/dev/api/0.0.4/index.html b/docs/dev/api/0.0.4/index.html
deleted file mode 100644
index 6dd41b004..000000000
--- a/docs/dev/api/0.0.4/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
- Swagger UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/dev/api/0.0.4/index.html b/docs/dev/api/0.0.4/index.html
new file mode 120000
index 000000000..2eba4cfec
--- /dev/null
+++ b/docs/dev/api/0.0.4/index.html
@@ -0,0 +1 @@
+../swagger/index.html
\ No newline at end of file
diff --git a/docs/dev/api/0.0.4/swagger-initializer.js b/docs/dev/api/0.0.4/swagger-initializer.js
new file mode 100644
index 000000000..1b52c6037
--- /dev/null
+++ b/docs/dev/api/0.0.4/swagger-initializer.js
@@ -0,0 +1,20 @@
+window.onload = function() {
+ //
+
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
+ window.ui = SwaggerUIBundle({
+ url: "openapi-cookbook.yaml",
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+
+ //
+};
diff --git a/docs/dev/api/0.1.0/index.html b/docs/dev/api/0.1.0/index.html
deleted file mode 100644
index 6ddcad895..000000000
--- a/docs/dev/api/0.1.0/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
- Public API cookbook app
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/dev/api/0.1.0/index.html b/docs/dev/api/0.1.0/index.html
new file mode 120000
index 000000000..2eba4cfec
--- /dev/null
+++ b/docs/dev/api/0.1.0/index.html
@@ -0,0 +1 @@
+../swagger/index.html
\ No newline at end of file
diff --git a/docs/dev/api/0.1.0/internal.html b/docs/dev/api/0.1.0/internal.html
index 9d995803a..45666e5cc 100644
--- a/docs/dev/api/0.1.0/internal.html
+++ b/docs/dev/api/0.1.0/internal.html
@@ -3,58 +3,17 @@
- Internal API of cookbook app
+ Swagger UI
+
-
-
-
+
diff --git a/docs/dev/api/0.1.0/swagger-initializer-internal.js b/docs/dev/api/0.1.0/swagger-initializer-internal.js
new file mode 100644
index 000000000..a337b3b17
--- /dev/null
+++ b/docs/dev/api/0.1.0/swagger-initializer-internal.js
@@ -0,0 +1,20 @@
+window.onload = function() {
+ //
+
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
+ window.ui = SwaggerUIBundle({
+ url: "internal-cookbook.yaml",
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+
+ //
+};
diff --git a/docs/dev/api/0.1.0/swagger-initializer.js b/docs/dev/api/0.1.0/swagger-initializer.js
new file mode 100644
index 000000000..1b52c6037
--- /dev/null
+++ b/docs/dev/api/0.1.0/swagger-initializer.js
@@ -0,0 +1,20 @@
+window.onload = function() {
+ //
+
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
+ window.ui = SwaggerUIBundle({
+ url: "openapi-cookbook.yaml",
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+
+ //
+};
diff --git a/docs/dev/api/swagger/index.css b/docs/dev/api/swagger/index.css
new file mode 100644
index 000000000..f2376fdaa
--- /dev/null
+++ b/docs/dev/api/swagger/index.css
@@ -0,0 +1,16 @@
+html {
+ box-sizing: border-box;
+ overflow: -moz-scrollbars-vertical;
+ overflow-y: scroll;
+}
+
+*,
+*:before,
+*:after {
+ box-sizing: inherit;
+}
+
+body {
+ margin: 0;
+ background: #fafafa;
+}
diff --git a/docs/dev/api/swagger/index.html b/docs/dev/api/swagger/index.html
new file mode 100644
index 000000000..73153d3d6
--- /dev/null
+++ b/docs/dev/api/swagger/index.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+ Swagger UI
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/dev/api/swagger/oauth2-redirect.html b/docs/dev/api/swagger/oauth2-redirect.html
index 64b171f7d..564091718 100644
--- a/docs/dev/api/swagger/oauth2-redirect.html
+++ b/docs/dev/api/swagger/oauth2-redirect.html
@@ -13,7 +13,7 @@
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
- qp = window.location.hash.substring(1);
+ qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
@@ -38,7 +38,7 @@
authId: oauth2.auth.name,
source: "auth",
level: "warning",
- message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
+ message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}
@@ -58,7 +58,7 @@
authId: oauth2.auth.name,
source: "auth",
level: "error",
- message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
+ message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
@@ -67,9 +67,13 @@
window.close();
}
- window.addEventListener('DOMContentLoaded', function () {
- run();
- });
+ if (document.readyState !== 'loading') {
+ run();
+ } else {
+ document.addEventListener('DOMContentLoaded', function () {
+ run();
+ });
+ }