@cocreate/file-server 1.0.12 → 1.0.14
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 +14 -0
- package/package.json +1 -2
- package/src/index.js +11 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.0.14](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.13...v1.0.14) (2022-12-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* typo res.end ([2299a83](https://github.com/CoCreate-app/CoCreate-file-server/commit/2299a83a7f54b14a6f034cfa54563f090acfc344))
|
|
7
|
+
|
|
8
|
+
## [1.0.13](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.12...v1.0.13) (2022-12-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* removed server-side-render. render passed from init ([e6a1f74](https://github.com/CoCreate-app/CoCreate-file-server/commit/e6a1f745ce9800f2a3721e6e680aec6401d3df43))
|
|
14
|
+
|
|
1
15
|
## [1.0.12](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.11...v1.0.12) (2022-12-05)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/file-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "A simple file-server component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file-server",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@cocreate/docs": "^1.4.13",
|
|
65
65
|
"@cocreate/hosting": "^1.6.11",
|
|
66
|
-
"@cocreate/server-side-render": "^1.1.20",
|
|
67
66
|
"express": "^4.18.2"
|
|
68
67
|
}
|
|
69
68
|
}
|
package/src/index.js
CHANGED
|
@@ -93,31 +93,22 @@ class CoCreateFileSystem {
|
|
|
93
93
|
var base64Data = src.replace(/^data:image\/(png|jpeg|jpg);base64,/, '');
|
|
94
94
|
let file = Buffer.from(base64Data, 'base64');
|
|
95
95
|
res.writeHead(200, {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
'Content-Type': content_type,
|
|
97
|
+
'Content-Length': file.length
|
|
98
98
|
});
|
|
99
|
-
res.
|
|
100
|
-
}
|
|
101
|
-
else if (content_type === 'text/html') {
|
|
99
|
+
res.send(file);
|
|
100
|
+
} else if (content_type === 'text/html') {
|
|
102
101
|
try {
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
let html = await render.HTML(src, organization_id);
|
|
103
|
+
if (html)
|
|
104
|
+
src = html
|
|
106
105
|
}
|
|
107
106
|
catch (err) {
|
|
108
|
-
|
|
109
|
-
console.log('infinte loop')
|
|
110
|
-
return res.send('there is a infinite loop');
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
console.warn('server-render: ' + err.message)
|
|
115
|
-
return res.send(src + `<script>console.log("${'server-render: ' + err.message}")</script>`)
|
|
116
|
-
}
|
|
107
|
+
console.warn('server-render: ' + err.message)
|
|
117
108
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
else {
|
|
109
|
+
res.type(content_type);
|
|
110
|
+
res.send(src)
|
|
111
|
+
} else {
|
|
121
112
|
res.type(content_type);
|
|
122
113
|
res.send(src);
|
|
123
114
|
}
|