- cataloghi...

- fix: condividi su Telegram non funzionava errore sull'immagine
This commit is contained in:
Surya Paolo
2024-11-02 18:06:12 +01:00
parent 3bdab927b6
commit b7ffd751dc
12 changed files with 145 additions and 48 deletions

View File

@@ -3800,8 +3800,8 @@ module.exports = {
},
getmd5(mystr) {
return CryptoJS.MD5(mystr.toLowerCase()).toString();
getmd5(mystr) {
return CryptoJS.MD5(mystr ? mystr.toLowerCase(): '').toString();
},
getHash(mystr) {
@@ -4639,7 +4639,7 @@ module.exports = {
} else if (paramstr === 'DESCRIZ') {
description = value;
} else if (paramstr === 'SOCK') {
sock = (value.toLowerCase() === 'true');
sock = (value ? (value.toLowerCase() === 'true'): false);
}
}
@@ -4952,7 +4952,7 @@ module.exports = {
descrcontent = '';
}
mystr += `${icon} <strong>${title}</strong> ${icon}\n`;
mystr += `${icon} <strong>${title}</strong>\n`;
if (descrcontent) {
mystr += `${descrcontent}\n`;
@@ -5252,6 +5252,10 @@ module.exports = {
let status = '';
let online = false;
let solo_online = false;
let writtenby = myrec.username;
let sitoweb = '';
let contact_phone = '';
let contact_email = '';
if (tablerec === shared_consts.TABLES_MYGOODS) {
cat = await this.getCategoriaGoodByRec(myrec)
} else if (tablerec === shared_consts.TABLES_MYSKILLS) {
@@ -5265,11 +5269,19 @@ module.exports = {
} else if (tablerec === shared_consts.TABLES_MYHOSPS) {
cat = '';
} else if (tablerec === shared_consts.TABLES_MYBACHECAS) {
if (myrec.website) {
sitoweb = myrec.website
}
contact_phone = myrec.contact_phone || '';
contact_email = myrec.contact_email || '';
if (myrec.organisedBy) {
organizedBy = myrec.organisedBy;
contatto = '';
}
if ((myrec.contact_telegram.toLowerCase() !== contatto_telegram.toLowerCase()) || !contatto) {
if ((myrec.contact_telegram && myrec.contact_telegram.toLowerCase() !== contatto_telegram.toLowerCase()) || !contatto) {
contatto += '\n' + myrec.contact_telegram;
}
if (myrec.contact_phone) {
@@ -5312,12 +5324,22 @@ module.exports = {
if (incambiodi)
out += this.addRowTelegram('⚖️', 'In cambio di', incambiodi, true);
if (sitoweb)
out += this.addRowTelegram('🌐', 'Sito Web', sitoweb, true);
if (contributo)
out += this.addRowTelegram('💰', 'Contributo', contributo, true);
out += this.addRowTelegram('💰', 'Contributo Richiesto', contributo, true);
if (contact_phone) {
out += this.addRowTelegram('📞', 'Telefono', contact_phone, true);
}
if (contact_email) {
out += this.addRowTelegram('📨', 'Email', contact_email, true);
}
if (organizedBy) {
out += this.addRowTelegram('🏠', 'Organizzato da', organizedBy, true);
out += this.addRowTelegram('', 'Redatto da', contatto, true);
out += this.addRowTelegram('✍️', 'Redatto da', writtenby, true);
} else {
out += this.addRowTelegram('👤', 'Contatto', contatto, true);
}
@@ -5715,17 +5737,16 @@ module.exports = {
try {
let dir = this.getdirByIdApp(idapp) + dirmain + '/' + this.getDirUpload();
// let dir = this.getdirByIdApp(idapp) + dirmain + '/' + this.getDirUpload();
let dir = this.getHostByIdApp(idapp) + '/' + this.getDirUpload() + shared_consts.getDirectoryImgByTable(table, username) + dirmain;
let foldermain = dir + 'profile/' + username;
img = dir + img;
img = foldermain + '/' + table + '/' + img;
if (checkifExist) {
/*if (checkifExist) {
if (!fs.existsSync(img)) {
return '';
}
}
}*/
if (!this.sulServer()) {
// Finta Immagine
@@ -5774,4 +5795,19 @@ module.exports = {
return cleanedName;
},
fixUrl(myurl, idapp) {
if (!myurl.startsWith('http')) {
return this.getHostByIdApp(idapp) + myurl;
}
if (myurl.startsWith('http://127.0.0.1')) {
//myurl = myurl.replace('http://127.0.0.1:8084/', 'https://riso.app/')
// Se è in locale allora metti una foto finta...
myurl = 'https://images.unsplash.com/photo-1464047736614-af63643285bf?q=80&w=2874&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'
//myurl = myurl.replace('http://127.0.0.1', 'http://localhost')
}
return myurl;
}
};