@xuda.io/account_module 1.2.258 → 1.2.260
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/index.mjs +3 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1547,7 +1547,7 @@ export const get_user_name = async function (uid) {
|
|
|
1547
1547
|
};
|
|
1548
1548
|
|
|
1549
1549
|
const removeBg = async function (req, job_id, headers) {
|
|
1550
|
-
const { url
|
|
1550
|
+
const { url } = req;
|
|
1551
1551
|
try {
|
|
1552
1552
|
let imageBuffer;
|
|
1553
1553
|
// if (inputPath) {
|
|
@@ -1567,7 +1567,7 @@ const removeBg = async function (req, job_id, headers) {
|
|
|
1567
1567
|
// Convert to buffer and save
|
|
1568
1568
|
const outputBuffer = Buffer.from(await blob.arrayBuffer());
|
|
1569
1569
|
|
|
1570
|
-
const originalname = path.basename(url);
|
|
1570
|
+
const originalname = 'avatar_' + path.basename(url);
|
|
1571
1571
|
const tempPath = path.join(os.tmpdir(), originalname + Date.now());
|
|
1572
1572
|
fs.writeFileSync(tempPath, outputBuffer);
|
|
1573
1573
|
|
|
@@ -1580,7 +1580,7 @@ const removeBg = async function (req, job_id, headers) {
|
|
|
1580
1580
|
};
|
|
1581
1581
|
|
|
1582
1582
|
const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
1583
|
-
console.log(`Background removed!
|
|
1583
|
+
console.log(`Background removed! `, drive_ret);
|
|
1584
1584
|
} catch (error) {
|
|
1585
1585
|
console.error('Error:', error);
|
|
1586
1586
|
}
|