@cocreate/url-uploader 1.1.1 → 1.2.0
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/.github/workflows/automated.yml +25 -38
- package/CHANGELOG.md +26 -0
- package/docs/index.html +216 -216
- package/package.json +3 -11
- package/release.config.js +12 -4
- package/src/index.js +88 -51
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
name: Automated Workflow
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
6
|
- master
|
|
7
|
+
|
|
6
8
|
jobs:
|
|
7
9
|
about:
|
|
8
10
|
runs-on: ubuntu-latest
|
|
@@ -18,52 +20,37 @@ jobs:
|
|
|
18
20
|
with:
|
|
19
21
|
direction: overwrite-github
|
|
20
22
|
githubToken: "${{ secrets.GITHUB }}"
|
|
23
|
+
|
|
21
24
|
release:
|
|
22
25
|
runs-on: ubuntu-latest
|
|
23
26
|
steps:
|
|
24
27
|
- name: Checkout
|
|
25
|
-
uses: actions/checkout@
|
|
26
|
-
- name: Setup Node.js
|
|
27
|
-
uses: actions/setup-node@v3
|
|
28
|
+
uses: actions/checkout@v4
|
|
28
29
|
with:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
fetch-depth: 0 # Required so semantic-release can trace git tags/history
|
|
31
|
+
|
|
32
|
+
- name: Setup Node.js
|
|
33
|
+
uses: actions/setup-node@v4
|
|
33
34
|
with:
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
node-version: 22
|
|
36
|
+
|
|
37
|
+
- name: Install Semantic Release & Plugins
|
|
38
|
+
# Installs semantic-release and its plugins on the runner
|
|
39
|
+
run: |
|
|
40
|
+
npm install -g semantic-release \
|
|
41
|
+
@semantic-release/changelog \
|
|
42
|
+
@semantic-release/npm \
|
|
43
|
+
@semantic-release/github \
|
|
36
44
|
@semantic-release/git
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
- name: Run Semantic Release (Native)
|
|
47
|
+
id: semantic
|
|
48
|
+
# This will automatically pick up your export default config file in the repository root
|
|
49
|
+
run: npx semantic-release
|
|
38
50
|
env:
|
|
39
|
-
GITHUB_TOKEN: "${{ secrets.
|
|
51
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
40
52
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
53
|
+
|
|
41
54
|
outputs:
|
|
42
55
|
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
|
-
|
|
62
|
-
- name: Set Environment Variables
|
|
63
|
-
run: |
|
|
64
|
-
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
65
|
-
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
66
|
-
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
67
|
-
- name: CoCreate Upload
|
|
68
|
-
run: coc upload
|
|
69
|
-
|
|
56
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.1.3...v1.2.0) (2026-07-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* update automated workflow and release configuration for improved semantic release handling ([cbba9cd](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/cbba9cdfee2bd4a524308397d91c7da5e1a0947b))
|
|
7
|
+
|
|
8
|
+
## [1.1.3](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.1.2...v1.1.3) (2026-07-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* remove unnecessary console logs in init function for cleaner output ([816740d](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/816740df97ea0582e1b55c4d8d1b29fa77770a2f))
|
|
14
|
+
* removed post install ([5a25d82](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/5a25d8261d25aeb51cd32ccdb4301eaa0f1ac652))
|
|
15
|
+
* semantic version handling. Reorganize .gitignore for improved clarity and structure ([ba5c0de](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/ba5c0de22dae1e670ab5c5862fac52111f160cc5))
|
|
16
|
+
* update .gitignore to include package-lock.json and pnpm-lock.yaml ([a677fea](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/a677fea7b4e8236145c5a97e520b02b045ef999b))
|
|
17
|
+
* update module export to ES6 syntax in release.config.js ([99052d8](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/99052d8b5a7c3233890c3850ecef28392ce5dc04))
|
|
18
|
+
|
|
19
|
+
## [1.1.2](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.1.1...v1.1.2) (2025-05-01)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* update [@cocreate](https://github.com/cocreate) dependencies ([3868e41](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/3868e4141ee18d8e2b916d0cc4e2b2095f27490c))
|
|
25
|
+
* webpack.config and devdependencies ([9a52602](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/9a5260297be3f14417cc87af89863439d60f7b14))
|
|
26
|
+
|
|
1
27
|
## [1.1.1](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.1.0...v1.1.1) (2024-12-09)
|
|
2
28
|
|
|
3
29
|
|
package/docs/index.html
CHANGED
|
@@ -1,228 +1,228 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
<title>CoCreate-url-uploader Documentation | CoCreateJS</title>
|
|
8
|
+
<link
|
|
9
|
+
rel="icon"
|
|
10
|
+
type="image/png"
|
|
11
|
+
sizes="32x32"
|
|
12
|
+
href="https://cocreate.app/images/favicon.ico" />
|
|
13
|
+
<meta
|
|
14
|
+
name="description"
|
|
15
|
+
content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
|
|
16
|
+
<meta
|
|
17
|
+
name="keywords"
|
|
18
|
+
content="helper classes, utility classes, css framework, css library, inline style classes" />
|
|
19
|
+
<meta name="robots" content="index,follow" />
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
<!-- CoCreate CSS CDN -->
|
|
22
|
+
</head>
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
24
|
+
<body>
|
|
25
|
+
<div array="" object="" key="" id="cocreate-url-uploader">
|
|
26
|
+
<div
|
|
27
|
+
class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
|
|
28
|
+
<div class="display:flex align-items:center">
|
|
29
|
+
<h2>CoCreate-url-uploader</h2>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
class="display:flex align-items:center font-size:20px"
|
|
33
|
+
share-height="600"
|
|
34
|
+
share-width="500"
|
|
35
|
+
share-media="https://via.placeholder.com/300/09f/fff.png">
|
|
36
|
+
<a
|
|
37
|
+
href="https://github.com/CoCreate-app/CoCreate-url-uploader"
|
|
38
|
+
target="_blank"
|
|
39
|
+
class="margin-right:15px"
|
|
40
|
+
><i class="fab fa-github"></i
|
|
41
|
+
></a>
|
|
42
|
+
<a
|
|
43
|
+
class="margin-right:15px share"
|
|
44
|
+
share-network="twitter"
|
|
45
|
+
title="Share on twitter"
|
|
46
|
+
><i class="fab fa-twitter"></i
|
|
47
|
+
></a>
|
|
48
|
+
<a
|
|
49
|
+
class="margin-right:15px share"
|
|
50
|
+
share-network="facebook"
|
|
51
|
+
title="Share on Facebook"
|
|
52
|
+
><i class="fab fa-facebook"></i
|
|
53
|
+
></a>
|
|
54
|
+
<a
|
|
55
|
+
class="margin-right:15px share"
|
|
56
|
+
share-network="instagram"
|
|
57
|
+
title="Share on instagram"
|
|
58
|
+
><i class="fab fa-instagram"></i
|
|
59
|
+
></a>
|
|
60
|
+
<a
|
|
61
|
+
class="margin-right:15px share"
|
|
62
|
+
share-network="share"
|
|
63
|
+
title="Share on share"
|
|
64
|
+
><i class="fas fa-share-alt"></i
|
|
65
|
+
></a>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<h1 class="max-width:500px margin:20px_10px">
|
|
69
|
+
A simple HTML5, CSS and pure javascript component. Easy
|
|
70
|
+
configuration using data-attributes and highly styleable.
|
|
71
|
+
</h1>
|
|
72
|
+
<div id="url-uploader-section" class="display:flex flex-wrap:wrap">
|
|
73
|
+
<div class="flex-grow:1 width:300px padding:20px_10px">
|
|
74
|
+
<h2
|
|
75
|
+
class="border-bottom:1px_solid_lightgrey padding:5px_0px">
|
|
76
|
+
Install
|
|
77
|
+
</h2>
|
|
78
|
+
<pre
|
|
79
|
+
class="margin-top:15px"><code class="language-javascript">npm install cocreate-url-uploader</code></pre>
|
|
80
|
+
<p class="padding:10px_0px">Or you can use cdn link:</p>
|
|
81
|
+
<pre><code class="language-javascript">https://cdn.cocreate.app/js/CoCreate-url-uploader.min.js</code></pre>
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
<h2
|
|
84
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
85
|
+
Usage
|
|
86
|
+
</h2>
|
|
87
|
+
<p class="padding:10px_0px">url-uploader usage content</p>
|
|
88
|
+
<pre><code class="language-html"><div></div></code></pre>
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
<h2
|
|
91
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
92
|
+
Reference
|
|
93
|
+
</h2>
|
|
94
|
+
<p class="padding:10px_0px">
|
|
95
|
+
This is url-uploader reference content
|
|
96
|
+
</p>
|
|
97
|
+
<pre><code class="language-javascript"><div></div></code></pre>
|
|
98
|
+
<p class="padding:10px_0px">
|
|
99
|
+
This is url-uploader reference content
|
|
100
|
+
</p>
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
102
|
+
<h2
|
|
103
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
104
|
+
Attributes
|
|
105
|
+
</h2>
|
|
106
|
+
<ul class="list-style-type:none">
|
|
107
|
+
<li
|
|
108
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
109
|
+
<h4>
|
|
110
|
+
<span>url-uploader</span>
|
|
111
|
+
<span class="cocreate-badge success"
|
|
112
|
+
>string</span
|
|
113
|
+
>
|
|
114
|
+
<span class="cocreate-badge warning"
|
|
115
|
+
>optional</span
|
|
116
|
+
>
|
|
117
|
+
</h4>
|
|
118
|
+
<p>url-uploader-attribute</p>
|
|
119
|
+
</li>
|
|
120
|
+
<li
|
|
121
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
122
|
+
<h4>
|
|
123
|
+
<span>url-uploader</span>
|
|
124
|
+
<span class="cocreate-badge success"
|
|
125
|
+
>string</span
|
|
126
|
+
>
|
|
127
|
+
<span class="cocreate-badge warning"
|
|
128
|
+
>optional</span
|
|
129
|
+
>
|
|
130
|
+
</h4>
|
|
131
|
+
<p>url-uploader-attribute</p>
|
|
132
|
+
</li>
|
|
133
|
+
</ul>
|
|
134
|
+
</div>
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
136
|
+
<div
|
|
137
|
+
class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
|
|
138
|
+
<!-- SandBox -->
|
|
139
|
+
<h2
|
|
140
|
+
class="border-bottom:1px_solid_lightgrey padding:5px_0px">
|
|
141
|
+
Demo
|
|
142
|
+
</h2>
|
|
143
|
+
<div
|
|
144
|
+
class="position:sticky top:0 padding:10px_0px height:100vh">
|
|
145
|
+
<!-- SandBox -->
|
|
146
|
+
<div
|
|
147
|
+
class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
|
|
148
|
+
id="playground">
|
|
149
|
+
<div
|
|
150
|
+
id="demo-code"
|
|
151
|
+
resizable
|
|
152
|
+
class="position:relative height:50%">
|
|
153
|
+
<textarea
|
|
154
|
+
type="code"
|
|
155
|
+
lang="html"
|
|
156
|
+
array="demos"
|
|
157
|
+
object=""
|
|
158
|
+
key="demo"
|
|
159
|
+
save="false"
|
|
160
|
+
id="demo"
|
|
161
|
+
class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
162
|
+
<div
|
|
163
|
+
resize="bottom"
|
|
164
|
+
class="background:lightgrey"></div>
|
|
165
|
+
</div>
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
<div
|
|
168
|
+
id="demo-preview"
|
|
169
|
+
class="position:relative overflow:auto background-color:white">
|
|
170
|
+
<div
|
|
171
|
+
get-value="#demo"
|
|
172
|
+
class="padding:20px"></div>
|
|
173
|
+
</div>
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
175
|
+
<div
|
|
176
|
+
class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
177
|
+
<a
|
|
178
|
+
class="margin-right:10px"
|
|
179
|
+
id="eye"
|
|
180
|
+
show="#eye-slash"
|
|
181
|
+
hide="#eye, #demo-preview"
|
|
182
|
+
toggle="code-height"
|
|
183
|
+
toggle-query="#demo-code"
|
|
184
|
+
><i class="far fa-eye"></i
|
|
185
|
+
></a>
|
|
186
|
+
<a
|
|
187
|
+
class="margin-right:10px"
|
|
188
|
+
hidden
|
|
189
|
+
id="eye-slash"
|
|
190
|
+
show="#eye, #demo-preview"
|
|
191
|
+
hide="#eye-slash"
|
|
192
|
+
toggle="code-height"
|
|
193
|
+
toggle-query="#demo-code"
|
|
194
|
+
><i class="fas fa-eye-slash"></i
|
|
195
|
+
></a>
|
|
196
|
+
<a
|
|
197
|
+
class="margin-right:10px"
|
|
198
|
+
id="code"
|
|
199
|
+
show="#code-slash"
|
|
200
|
+
hide="#code, #demo-code"
|
|
201
|
+
><i class="fa fa-code"></i
|
|
202
|
+
></a>
|
|
203
|
+
<a
|
|
204
|
+
class="margin-right:10px"
|
|
205
|
+
hidden
|
|
206
|
+
id="code-slash"
|
|
207
|
+
show="#code, #demo-code"
|
|
208
|
+
hide="#code-slash"
|
|
209
|
+
><i class="fas fa-code"></i
|
|
210
|
+
></a>
|
|
211
|
+
<a
|
|
212
|
+
class="margin-right:5px"
|
|
213
|
+
fullscreen
|
|
214
|
+
target="#playground"
|
|
215
|
+
><i class="fas fa-expand"></i
|
|
216
|
+
></a>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
<!-- End SandBox -->
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
<!--CoCreateJS-->
|
|
226
|
+
<script src="https://CoCreate.app/dist/CoCreate.js"></script>
|
|
227
|
+
</body>
|
|
228
228
|
</html>
|
package/package.json
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/url-uploader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A simple url-uploader component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"url-uploader",
|
|
7
|
-
"cocreate",
|
|
8
|
-
"low-code-framework",
|
|
9
|
-
"no-code-framework",
|
|
10
|
-
"cocreatejs",
|
|
11
|
-
"cocreatejs-component",
|
|
12
|
-
"cocreate-framework",
|
|
13
|
-
"no-code",
|
|
14
7
|
"low-code",
|
|
15
|
-
"collaborative-framework",
|
|
16
8
|
"realtime",
|
|
17
9
|
"realtime-framework",
|
|
18
10
|
"collaboration",
|
|
@@ -26,8 +18,7 @@
|
|
|
26
18
|
"scripts": {
|
|
27
19
|
"start": "npx webpack --config webpack.config.js",
|
|
28
20
|
"build": "npx webpack --mode=production --config webpack.config.js",
|
|
29
|
-
"dev": "npx webpack --config webpack.config.js --watch"
|
|
30
|
-
"postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
|
|
21
|
+
"dev": "npx webpack --config webpack.config.js --watch"
|
|
31
22
|
},
|
|
32
23
|
"repository": {
|
|
33
24
|
"type": "git",
|
|
@@ -43,6 +34,7 @@
|
|
|
43
34
|
"type": "GitHub Sponsors ❤",
|
|
44
35
|
"url": "https://github.com/sponsors/CoCreate-app"
|
|
45
36
|
},
|
|
37
|
+
"type": "module",
|
|
46
38
|
"main": "./src/index.js",
|
|
47
39
|
"dependencies": {
|
|
48
40
|
"node-fetch": "^3.3.2"
|
package/release.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default {
|
|
2
2
|
dryRun: false,
|
|
3
3
|
branches: ["master"],
|
|
4
4
|
plugins: [
|
|
@@ -10,12 +10,20 @@ module.exports = {
|
|
|
10
10
|
changelogFile: "CHANGELOG.md",
|
|
11
11
|
},
|
|
12
12
|
],
|
|
13
|
-
"@semantic-release/npm",
|
|
14
|
-
"@semantic-release/github",
|
|
13
|
+
"@semantic-release/npm",
|
|
15
14
|
[
|
|
16
|
-
"@semantic-release/
|
|
15
|
+
"@semantic-release/github",
|
|
17
16
|
{
|
|
17
|
+
successComment: false,
|
|
18
|
+
failTitle: false,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"@semantic-release/git",
|
|
23
|
+
{
|
|
24
|
+
// Only stage and commit the changelog and package.json
|
|
18
25
|
assets: ["CHANGELOG.md", "package.json"],
|
|
26
|
+
message: "chore(release): ${nextRelease.version} [skip ci]",
|
|
19
27
|
},
|
|
20
28
|
],
|
|
21
29
|
],
|
package/src/index.js
CHANGED
|
@@ -20,65 +20,102 @@
|
|
|
20
20
|
// you must obtain a commercial license from CoCreate LLC.
|
|
21
21
|
// For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
import { URL } from "url";
|
|
24
|
+
import fetch from "node-fetch";
|
|
25
|
+
import server from "@cocreate/server";
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Converts a raw binary ArrayBuffer payload cleanly to a Base64 string.
|
|
29
|
+
* @param {ArrayBuffer} buffer - The downloaded file raw binary buffer
|
|
30
|
+
* @returns {string} Base64 formatted string
|
|
31
|
+
*/
|
|
32
|
+
function arrayBufferToBase64(buffer) {
|
|
33
|
+
let binary = "";
|
|
34
|
+
const bytes = new Uint8Array(buffer);
|
|
35
|
+
const len = bytes.byteLength;
|
|
36
|
+
for (let i = 0; i < len; i++) {
|
|
37
|
+
binary += String.fromCharCode(bytes[i]);
|
|
38
|
+
}
|
|
39
|
+
return Buffer.from(binary, "binary").toString("base64");
|
|
40
|
+
}
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Fetches the binary asset from a remote URL, updates the file parameters,
|
|
44
|
+
* converts the raw output to Base64, and sends the updated payload back to the client socket.
|
|
45
|
+
* @param {Object} data - Socket event payload
|
|
46
|
+
*/
|
|
47
|
+
async function fetchFileFromURL(data) {
|
|
48
|
+
try {
|
|
49
|
+
const file = data.file;
|
|
50
|
+
if (!file || !file.src) {
|
|
51
|
+
data.error = "Missing file object or file source URL.";
|
|
52
|
+
if (data.socket && server && server.wsManager) {
|
|
53
|
+
return server.wsManager.send(data);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
40
57
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
58
|
+
// Store original URL before file.src gets overwritten with Base64 content
|
|
59
|
+
const originalUrl = file.src;
|
|
60
|
+
const response = await fetch(originalUrl);
|
|
45
61
|
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
data.error = "Failed to fetch file: " + response.statusText;
|
|
64
|
+
if (data.socket && server && server.wsManager) {
|
|
65
|
+
return server.wsManager.send(data);
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
48
69
|
|
|
49
|
-
|
|
50
|
-
|
|
70
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
71
|
+
file.src = arrayBufferToBase64(arrayBuffer);
|
|
72
|
+
file.size = arrayBuffer.byteLength;
|
|
73
|
+
file["content-type"] = response.headers.get("content-type");
|
|
51
74
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
if (!file.name) {
|
|
76
|
+
const parsedUrl = new URL(originalUrl);
|
|
77
|
+
file.name = parsedUrl.pathname.split("/").pop() || "downloaded_file";
|
|
78
|
+
}
|
|
56
79
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
if (!file.directory) file.directory = "/";
|
|
81
|
+
if (!file.path) file.path = file.directory;
|
|
82
|
+
|
|
83
|
+
if (!file.pathname) {
|
|
84
|
+
if (file.path.endsWith("/")) {
|
|
85
|
+
file.pathname = file.path + file.name;
|
|
86
|
+
} else {
|
|
87
|
+
file.pathname = file.path + "/" + file.name;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
65
90
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
91
|
+
if (data.socket && server && server.wsManager) {
|
|
92
|
+
server.wsManager.send(data);
|
|
93
|
+
}
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error("Error fetching file:", error);
|
|
96
|
+
data.error = "Internal uploader error while retrieving resource.";
|
|
97
|
+
if (data.socket && server && server.wsManager) {
|
|
98
|
+
server.wsManager.send(data);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
72
102
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Auto-initialization loop.
|
|
105
|
+
* Silently polls to verify that the unified server orchestrator is fully loaded,
|
|
106
|
+
* and that the socket manager (wsManager) has completed its initial handshakes,
|
|
107
|
+
* then maps active URL importing event triggers.
|
|
108
|
+
*/
|
|
109
|
+
function init() {
|
|
110
|
+
if (server && server.isInitialized && server.wsManager) {
|
|
111
|
+
server.wsManager.on("importUrl", (data) => fetchFileFromURL(data));
|
|
112
|
+
} else {
|
|
113
|
+
// Retry in 500ms if the shared socket server instance has not yet mounted
|
|
114
|
+
setTimeout(init, 500);
|
|
115
|
+
}
|
|
82
116
|
}
|
|
83
117
|
|
|
84
|
-
module
|
|
118
|
+
// Auto-execute initialization upon module compilation
|
|
119
|
+
init();
|
|
120
|
+
|
|
121
|
+
export default init;
|