@xuda.io/account_module 1.2.304 → 1.2.306
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 +2 -2
- package/package.json +1 -2
- package/download_model.js +0 -56
package/index.mjs
CHANGED
|
@@ -1164,7 +1164,7 @@ export const get_contacts = async function (req) {
|
|
|
1164
1164
|
const contacts_ret = await db_module.find_couch_query('xuda_contacts', opt);
|
|
1165
1165
|
let requests_from_ret = { docs: [] };
|
|
1166
1166
|
let requests_to_ret = { docs: [] };
|
|
1167
|
-
|
|
1167
|
+
|
|
1168
1168
|
if (with_requests) {
|
|
1169
1169
|
requests_from_ret = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_from_uid: uid }, fields: ['team_req_date', 'team_req_to_email', 'team_req_from_uid'] });
|
|
1170
1170
|
requests_to_ret = await db_module.find_couch_query('xuda_team', {
|
|
@@ -1183,7 +1183,7 @@ export const get_contacts = async function (req) {
|
|
|
1183
1183
|
date_created: e.team_req_date,
|
|
1184
1184
|
email: [e.sender_account_info.email],
|
|
1185
1185
|
name: `${e.sender_account_info.first_name} ${e.sender_account_info.last_name}`,
|
|
1186
|
-
profile_avatar: e.sender_account_info.profile_avatar || anonymous_image_url,
|
|
1186
|
+
profile_avatar: e.sender_account_info.profile_avatar || _conf.anonymous_image_url,
|
|
1187
1187
|
pending: true,
|
|
1188
1188
|
uid: e.team_req_from_uid,
|
|
1189
1189
|
})),
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xuda.io/account_module",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.306",
|
|
4
4
|
"description": "Xuda Account Server Module",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@imgly/background-removal-node": "^1.4.5",
|
|
8
7
|
"lodash": "^4.17.21",
|
|
9
8
|
"validator": "^13.1.1"
|
|
10
9
|
},
|
package/download_model.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// download-models.js
|
|
2
|
-
const https = require('https');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
const models = ['u2net.onnx', 'u2net.onnx.bin', 'u2net.onnx.wasm'];
|
|
7
|
-
|
|
8
|
-
const baseUrl = 'https://static.imgly.com/background-removal/models/medium/';
|
|
9
|
-
const outputDir = '/var/xuda/assets/imgly-bg';
|
|
10
|
-
|
|
11
|
-
// Create directory if it doesn't exist
|
|
12
|
-
if (!fs.existsSync(outputDir)) {
|
|
13
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function downloadFile(url, filepath) {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
const file = fs.createWriteStream(filepath);
|
|
19
|
-
https
|
|
20
|
-
.get(url, (response) => {
|
|
21
|
-
if (response.statusCode === 200) {
|
|
22
|
-
response.pipe(file);
|
|
23
|
-
file.on('finish', () => {
|
|
24
|
-
file.close();
|
|
25
|
-
console.log(`Downloaded: ${path.basename(filepath)}`);
|
|
26
|
-
resolve();
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
reject(new Error(`HTTP ${response.statusCode}: ${url}`));
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
.on('error', (err) => {
|
|
33
|
-
fs.unlink(filepath, () => {}); // Delete partial file
|
|
34
|
-
reject(err);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function downloadAll() {
|
|
40
|
-
console.log('Downloading models to:', outputDir);
|
|
41
|
-
|
|
42
|
-
for (const model of models) {
|
|
43
|
-
const url = baseUrl + model;
|
|
44
|
-
const filepath = path.join(outputDir, model);
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
await downloadFile(url, filepath);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error(`Failed to download ${model}:`, error.message);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.log('Download complete!');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
downloadAll();
|