@cocreate/file-server 1.8.0 → 1.8.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.
@@ -1,83 +1,70 @@
1
- name: Automated Deployment
2
- "on":
3
- push:
4
- branches:
5
- - master
6
- jobs:
7
- about:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Checkout
11
- uses: actions/checkout@v3
12
- - name: setup nodejs
13
- uses: actions/setup-node@v3
14
- with:
15
- node-version: 16
16
- - name: Jaid/action-sync-node-meta
17
- uses: jaid/action-sync-node-meta@v1.4.0
18
- with:
19
- direction: overwrite-github
20
- githubToken: "${{ secrets.GITHUB }}"
21
- release:
22
- runs-on: ubuntu-latest
23
- steps:
24
- - name: Checkout
25
- uses: actions/checkout@v3
26
- - name: setup nodejs
27
- uses: actions/setup-node@v3
28
- with:
29
- node-version: 14
30
- - name: Semantic Release
31
- uses: cycjimmy/semantic-release-action@v3
32
- id: semantic
33
- with:
34
- extra_plugins: |
35
- @semantic-release/changelog
36
- @semantic-release/git
37
- @semantic-release/github
38
- env:
39
- GITHUB_TOKEN: "${{ secrets.GITHUB }}"
40
- NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
41
- outputs:
42
- new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
- new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
-
45
- upload:
46
- runs-on: ubuntu-latest
47
-
48
- steps:
49
- - name: Checkout
50
- uses: actions/checkout@v3
51
-
52
- - name: Setup Node.js
53
- uses: actions/setup-node@v3
54
- with:
55
- node-version: 16
56
-
57
- - name: Get Environment Variables
58
- run: |
59
- echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
60
- echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
61
- echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
62
-
63
- - name: Install @cocreate/cli
64
- run: npm install -g @cocreate/cli
65
-
66
- - name: CoCreate CLI Upload
67
- run: coc upload
68
-
69
- # docs:
70
- # runs-on: ubuntu-latest
71
- # steps:
72
- # - name: Checkout
73
- # uses: actions/checkout@v3
74
- # - name: setup nodejs
75
- # uses: actions/setup-node@v3
76
- # with:
77
- # node-version: 16
78
- # - name: update documentation
79
- # uses: CoCreate-app/CoCreate-docs@master
80
- # env:
81
- # organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
82
- # key: ${{ secrets.COCREATE_KEY }}
83
- # host: ${{ secrets.COCREATE_HOST }}
1
+ name: Automated Workflow
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ about:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v3
12
+ - name: Setup Node.js
13
+ uses: actions/setup-node@v3
14
+ with:
15
+ node-version: 16
16
+ - name: Jaid/action-sync-node-meta
17
+ uses: jaid/action-sync-node-meta@v1.4.0
18
+ with:
19
+ direction: overwrite-github
20
+ githubToken: "${{ secrets.GITHUB }}"
21
+ release:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v3
26
+ - name: Setup Node.js
27
+ uses: actions/setup-node@v3
28
+ with:
29
+ node-version: 14
30
+ - name: Semantic Release
31
+ uses: cycjimmy/semantic-release-action@v3
32
+ id: semantic
33
+ with:
34
+ extra_plugins: |
35
+ @semantic-release/changelog
36
+ @semantic-release/git
37
+ @semantic-release/github
38
+ env:
39
+ GITHUB_TOKEN: "${{ secrets.GITHUB }}"
40
+ NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
41
+ outputs:
42
+ new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
+ new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
+ upload:
45
+ runs-on: ubuntu-latest
46
+ needs: release
47
+ if: needs.release.outputs.new_release_published == 'true'
48
+ env:
49
+ VERSION: "${{ needs.release.outputs.new_release_version }}"
50
+ steps:
51
+ - name: Checkout
52
+ uses: actions/checkout@v3
53
+ - name: Setup Node.js
54
+ uses: actions/setup-node@v3
55
+ with:
56
+ node-version: 16
57
+ - name: Set npm registry auth
58
+ run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59
+ - name: Install dependencies
60
+ run: yarn install
61
+ - name: Build
62
+ run: yarn build
63
+ - name: Set Environment Variables
64
+ run: |
65
+ echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
66
+ echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
67
+ echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
68
+ - name: CoCreate Upload
69
+ run: coc upload
70
+
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [1.8.1](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.8.0...v1.8.1) (2023-08-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * /dist/CoCreate.js updated to https://CoCreate.app/dist/CoCreate.js ([27b8e89](https://github.com/CoCreate-app/CoCreate-file-server/commit/27b8e897cebf50c5015bbc440d8f89563ed71ee3))
7
+ * replace cdn with /dist ([58647d9](https://github.com/CoCreate-app/CoCreate-file-server/commit/58647d906e21150ec0a8d7dc448886ccaf30c6b1))
8
+ * update content-type of error pages ([59cdfb2](https://github.com/CoCreate-app/CoCreate-file-server/commit/59cdfb26f9cd802fe778d249cb1b03dd13f44978))
9
+ * update file uploader ([145f544](https://github.com/CoCreate-app/CoCreate-file-server/commit/145f5443619708676f425de1242b8a6f27ababf9))
10
+
1
11
  # [1.8.0](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.7.0...v1.8.0) (2023-08-17)
2
12
 
3
13
 
package/demo/index.html CHANGED
@@ -1,21 +1,19 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <link
8
+ rel="icon"
9
+ href="https://cdn.cocreate.app/favicon.ico"
10
+ type="image/ico"
11
+ sizes="16x16" />
12
+ <title>file-server | CoCreateJS</title>
13
+ </head>
3
14
 
4
- <head>
5
- <meta charset="utf-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <link rel="icon" href="https://cdn.cocreate.app/favicon.ico" type="image/ico" sizes="16x16">
9
- <title>file-server | CoCreateJS</title>
10
- </head>
11
-
12
- <body>
13
-
14
-
15
-
16
- <!--<script src="https://cdn.cocreate.app/file-server/latest/CoCreate-file-server.min.js"></script>-->
17
- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
18
-
19
- </body>
20
-
15
+ <body>
16
+ <!--<script src="https://cdn.cocreate.app/file-server/latest/CoCreate-file-server.min.js"></script>-->
17
+ <script src="https://CoCreate.app/dist/CoCreate.js"></script>
18
+ </body>
21
19
  </html>
package/docs/index.html CHANGED
@@ -225,14 +225,8 @@
225
225
  </div>
226
226
  </div>
227
227
  </div>
228
- <script>
229
- var CoCreateConfig = {
230
- key: "2061acef-0451-4545-f754-60cf8160",
231
- organization_id: "5ff747727005da1c272740ab",
232
- };
233
- </script>
234
228
 
235
229
  <!--CoCreateJS-->
236
- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
230
+ <script src="https://CoCreate.app/dist/CoCreate.js"></script>
237
231
  </body>
238
232
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file-server",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
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",
package/src/index.js CHANGED
@@ -76,7 +76,7 @@ class CoCreateFileSystem {
76
76
 
77
77
  if (!org || !org.object || !org.object[0]) {
78
78
  hostNotFound = hostNotFound || 'An organization could not be found using the host: ' + hostname + ' in platformDB: ' + process.env.organization_id
79
- res.writeHead(404, { 'Content-Type': 'text/plain' });
79
+ res.writeHead(404, { 'Content-Type': 'text/html' });
80
80
  if (org.storage === false && org.error)
81
81
  res.setHeader('storage', 'false')
82
82
  else
@@ -147,7 +147,7 @@ class CoCreateFileSystem {
147
147
  pageNotFound = default404 || `${pathname} could not be found for ${organization_id}`
148
148
  else
149
149
  pageNotFound = pageNotFound.object[0].src
150
- res.writeHead(404, { 'Content-Type': 'text/plain' });
150
+ res.writeHead(404, { 'Content-Type': 'text/html' });
151
151
  return res.end(pageNotFound);
152
152
  }
153
153
 
@@ -162,7 +162,7 @@ class CoCreateFileSystem {
162
162
  pageForbidden = default403 || `${pathname} access not allowed for ${organization_id}`
163
163
  else
164
164
  pageForbidden = pageForbidden.object[0].src
165
- res.writeHead(403, { 'Content-Type': 'text/plain' });
165
+ res.writeHead(403, { 'Content-Type': 'text/html' });
166
166
  return res.end(pageForbidden);
167
167
  }
168
168
 
@@ -189,8 +189,11 @@ class CoCreateFileSystem {
189
189
  let pageNotFound = await crud.send(data);
190
190
  if (!pageNotFound || !pageNotFound.object || !pageNotFound.object[0])
191
191
  pageNotFound = `${pathname} could not be found for ${organization_id}`
192
+ else
193
+ pageNotFound = pageNotFound.object[0].src
194
+
192
195
 
193
- res.writeHead(404, { 'Content-Type': 'text/plain' });
196
+ res.writeHead(404, { 'Content-Type': 'text/html' });
194
197
  return res.end(pageNotFound);
195
198
  }
196
199