@cocreate/file-server 1.16.0 → 1.16.1
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.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.js +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.16.1](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.16.0...v1.16.1) (2024-01-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* wildcard without ext should defualt to */index.html ([7779170](https://github.com/CoCreate-app/CoCreate-file-server/commit/77791709688373f51db672937f3b64c1f1fae5a3))
|
|
7
|
+
|
|
1
8
|
# [1.16.0](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.15.2...v1.16.0) (2024-01-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -41,25 +41,18 @@ class CoCreateFileSystem {
|
|
|
41
41
|
res.setHeader('Access-Control-Allow-Methods', '');
|
|
42
42
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
43
43
|
|
|
44
|
+
let active = crud.wsManager.organizations.get(organization_id)
|
|
45
|
+
if (active === false) {
|
|
46
|
+
let balanceFalse = await getDefaultFile('/balanceFalse.html')
|
|
47
|
+
return sendResponse(balanceFalse.object[0].src, 403, { 'Content-Type': 'text/html', 'Account-Balance': 'false', 'storage': organization.storage })
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
let parameters = valideUrl.searchParams;
|
|
45
51
|
if (parameters.size) {
|
|
46
52
|
console.log('parameters', parameters)
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
let pathname = valideUrl.pathname;
|
|
50
|
-
if (pathname.endsWith('/')) {
|
|
51
|
-
pathname += "index.html";
|
|
52
|
-
} else if (!pathname.startsWith('/.well-known/acme-challenge')) {
|
|
53
|
-
let directory = pathname.split("/").slice(-1)[0];
|
|
54
|
-
if (!directory.includes('.'))
|
|
55
|
-
pathname += "/index.html";
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let active = crud.wsManager.organizations.get(organization_id)
|
|
59
|
-
if (active === false) {
|
|
60
|
-
let balanceFalse = await getDefaultFile('/balanceFalse.html')
|
|
61
|
-
return sendResponse(balanceFalse.object[0].src, 403, { 'Content-Type': 'text/html', 'Account-Balance': 'false', 'storage': organization.storage })
|
|
62
|
-
}
|
|
63
56
|
|
|
64
57
|
let lastIndex = pathname.lastIndexOf('/');
|
|
65
58
|
let wildcardPath = pathname.substring(0, lastIndex + 1);
|
|
@@ -70,7 +63,15 @@ class CoCreateFileSystem {
|
|
|
70
63
|
let fileExtension = wildcard.substring(fileLastIndex); // Get extension
|
|
71
64
|
wildcard = wildcardPath + '*' + fileExtension; // Create wildcard for file name
|
|
72
65
|
} else {
|
|
73
|
-
wildcard = wildcardPath + '
|
|
66
|
+
wildcard = wildcardPath + '*/index.html'; // Append '*' if it's just a path or folder
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (pathname.endsWith('/')) {
|
|
70
|
+
pathname += "index.html";
|
|
71
|
+
} else if (!pathname.startsWith('/.well-known/acme-challenge')) {
|
|
72
|
+
let directory = pathname.split("/").slice(-1)[0];
|
|
73
|
+
if (!directory.includes('.'))
|
|
74
|
+
pathname += "/index.html";
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// console.log("Wildcard: ", wildcard);
|