cloudxs 1.0.1 → 1.0.3
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/dist/index.js +14 -1
- package/dist/index.mjs +14 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ var CloudXS = class {
|
|
|
50
50
|
if (!res.ok) {
|
|
51
51
|
throw new Error(json.message || "Failed to get upload URL");
|
|
52
52
|
}
|
|
53
|
-
const { uploadUrl, key } = json;
|
|
53
|
+
const { uploadUrl, key, userId } = json;
|
|
54
54
|
const uploadRes = await fetch(uploadUrl, {
|
|
55
55
|
method: "PUT",
|
|
56
56
|
headers: {
|
|
@@ -62,6 +62,19 @@ var CloudXS = class {
|
|
|
62
62
|
if (!uploadRes.ok) {
|
|
63
63
|
throw new Error("Upload failed");
|
|
64
64
|
}
|
|
65
|
+
const mediaFile = await fetch(`https://api.cloudxs.app/media/media-save`, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: {
|
|
68
|
+
"Content-Type": "application/json"
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
url: `${this.CDN_BASE_URL}/${key}`,
|
|
72
|
+
userId,
|
|
73
|
+
filename: file.name,
|
|
74
|
+
filetype: file.type,
|
|
75
|
+
filesize: file.size
|
|
76
|
+
})
|
|
77
|
+
});
|
|
65
78
|
return {
|
|
66
79
|
success: true,
|
|
67
80
|
url: `${this.CDN_BASE_URL}/${key}`
|
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ var CloudXS = class {
|
|
|
24
24
|
if (!res.ok) {
|
|
25
25
|
throw new Error(json.message || "Failed to get upload URL");
|
|
26
26
|
}
|
|
27
|
-
const { uploadUrl, key } = json;
|
|
27
|
+
const { uploadUrl, key, userId } = json;
|
|
28
28
|
const uploadRes = await fetch(uploadUrl, {
|
|
29
29
|
method: "PUT",
|
|
30
30
|
headers: {
|
|
@@ -36,6 +36,19 @@ var CloudXS = class {
|
|
|
36
36
|
if (!uploadRes.ok) {
|
|
37
37
|
throw new Error("Upload failed");
|
|
38
38
|
}
|
|
39
|
+
const mediaFile = await fetch(`https://api.cloudxs.app/media/media-save`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json"
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
url: `${this.CDN_BASE_URL}/${key}`,
|
|
46
|
+
userId,
|
|
47
|
+
filename: file.name,
|
|
48
|
+
filetype: file.type,
|
|
49
|
+
filesize: file.size
|
|
50
|
+
})
|
|
51
|
+
});
|
|
39
52
|
return {
|
|
40
53
|
success: true,
|
|
41
54
|
url: `${this.CDN_BASE_URL}/${key}`
|