@xuda.io/account_module 1.2.259 → 1.2.261
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 +6 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -113,6 +113,10 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
if (account_obj.account_info?.profile_picture) {
|
|
117
|
+
removeBg({ url: account_obj.account_info?.profile_picture }, job_id, headers);
|
|
118
|
+
}
|
|
119
|
+
|
|
116
120
|
// temp remove later on
|
|
117
121
|
const drive_module = await import(`${module_path}/drive_module/index.mjs`);
|
|
118
122
|
let drive_req = { app_id: account_obj.account_project_id, uid, path: '/' };
|
|
@@ -1547,7 +1551,7 @@ export const get_user_name = async function (uid) {
|
|
|
1547
1551
|
};
|
|
1548
1552
|
|
|
1549
1553
|
const removeBg = async function (req, job_id, headers) {
|
|
1550
|
-
const { url
|
|
1554
|
+
const { url } = req;
|
|
1551
1555
|
try {
|
|
1552
1556
|
let imageBuffer;
|
|
1553
1557
|
// if (inputPath) {
|
|
@@ -1567,7 +1571,7 @@ const removeBg = async function (req, job_id, headers) {
|
|
|
1567
1571
|
// Convert to buffer and save
|
|
1568
1572
|
const outputBuffer = Buffer.from(await blob.arrayBuffer());
|
|
1569
1573
|
|
|
1570
|
-
const originalname = path.basename(url);
|
|
1574
|
+
const originalname = 'avatar_' + path.basename(url);
|
|
1571
1575
|
const tempPath = path.join(os.tmpdir(), originalname + Date.now());
|
|
1572
1576
|
fs.writeFileSync(tempPath, outputBuffer);
|
|
1573
1577
|
|