Commit dc164ff2 authored by aiduck's avatar aiduck

version1.1.0

parent f9056aa0
Pipeline #155907 passed with stage
in 26 seconds
{ {
"name": "@tuia/rip", "name": "@tuia/rip",
"version": "1.0.6", "version": "1.1.0",
"description": "Tools for user behavior recording and playback based on rrweb", "description": "Tools for user behavior recording and playback based on rrweb",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -39,15 +39,15 @@ class Reporter { ...@@ -39,15 +39,15 @@ class Reporter {
} }
// 上传CDN // 上传CDN
toCDN(payload) { toCDN(payload) {
const blob = new Blob([JSON.stringify(payload)], { type: "application/json" }); // const blob = new Blob([JSON.stringify(payload)], { type: "application/json" });
const formData = new FormData(); // const formData = new FormData();
// 保存上下文 // 保存上下文
const trackId = this.counter.count; const trackId = this.counter.count;
const recordKey = this.recordKey; const recordKey = this.recordKey;
log("trackId", trackId); log("trackId", trackId);
log("recordKey", recordKey); log("recordKey", recordKey);
this.uploadingPile.add(trackId); this.uploadingPile.add(trackId);
formData.append("file", blob, `${this.recordKey + trackId}.json`); // formData.append("file", blob, `${this.recordKey + trackId}.json`);
const extra = { const extra = {
...this.baseInfo, ...this.baseInfo,
recordKey: this.recordKey, recordKey: this.recordKey,
...@@ -55,11 +55,17 @@ class Reporter { ...@@ -55,11 +55,17 @@ class Reporter {
isCDN: true, isCDN: true,
}; };
try { try {
fetch(`${this.environmentUrl}/upload`, { fetch(`${this.environmentUrl}/uploadString`, {
// fetch(`http://localhost:3000/upload`, { // fetch(`http://localhost:3000/uploadString`, {
method: "POST", method: "POST",
credentials: "include", credentials: "include",
body: formData, // body: formData
headers: new Headers({ "content-type": "application/json" }),
body: JSON.stringify({
payload: payload,
recordKey: recordKey,
trackId: trackId
}),
}) })
.then(res => { .then(res => {
return res.json(); return res.json();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment