Merge branch 'master' of git.darkou.fr:dbroqua/MusicTopus into develop
This commit is contained in:
commit
3626b074bd
2 changed files with 14 additions and 7 deletions
|
@ -62,11 +62,15 @@ 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, { responseType: "arraybuffer" });
|
const { data } = await axios.get(url, {
|
||||||
|
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,6 +43,9 @@ 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 });
|
||||||
|
@ -89,6 +92,10 @@ 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",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -110,10 +117,6 @@ 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