Compare commits
No commits in common. "3626b074bd8762b3c25af6dfc8675254063b7e1c" and "97b8bab2f484a31642d3c9b9b7c88c091755363b" have entirely different histories.
3626b074bd
...
97b8bab2f4
2 changed files with 7 additions and 14 deletions
|
@ -62,15 +62,11 @@ export const uploadFromUrl = async (url) => {
|
||||||
const filename = `${uuid()}.jpg`;
|
const filename = `${uuid()}.jpg`;
|
||||||
const file = `/tmp/${filename}`;
|
const file = `/tmp/${filename}`;
|
||||||
|
|
||||||
const { data } = await axios.get(url, {
|
const { data } = await axios.get(url, { responseType: "arraybuffer" });
|
||||||
headers: {
|
|
||||||
"User-Agent":
|
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0",
|
|
||||||
},
|
|
||||||
responseType: "arraybuffer",
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.writeFileSync(file, data);
|
fs.writeFileSync(file, data);
|
||||||
|
|
||||||
return uploadFromFile(filename, file, true);
|
return uploadFromFile(filename, file, true);
|
||||||
|
|
||||||
|
// return s3Object;
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,9 +43,6 @@ class Albums extends Pages {
|
||||||
model: "Albums",
|
model: "Albums",
|
||||||
id: album._id,
|
id: album._id,
|
||||||
};
|
};
|
||||||
const job = new JobsModel(jobData);
|
|
||||||
|
|
||||||
job.save();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const User = await UsersModel.findOne({ _id: user._id });
|
const User = await UsersModel.findOne({ _id: user._id });
|
||||||
|
@ -92,10 +89,6 @@ Publié automatiquement via #musictopus`;
|
||||||
const { data: buff } = await axios.get(
|
const { data: buff } = await axios.get(
|
||||||
data.images[i].uri,
|
data.images[i].uri,
|
||||||
{
|
{
|
||||||
headers: {
|
|
||||||
"User-Agent":
|
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0",
|
|
||||||
},
|
|
||||||
responseType: "arraybuffer",
|
responseType: "arraybuffer",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -117,6 +110,10 @@ Publié automatiquement via #musictopus`;
|
||||||
|
|
||||||
await M.post("statuses", { status, media_ids });
|
await M.post("statuses", { status, media_ids });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const job = new JobsModel(jobData);
|
||||||
|
|
||||||
|
job.save();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new ErrorEvent(
|
throw new ErrorEvent(
|
||||||
500,
|
500,
|
||||||
|
|
Loading…
Reference in a new issue