diff --git a/.env.development b/.env.development
index 3e28db4..345948f 100644
--- a/.env.development
+++ b/.env.development
@@ -1,12 +1,12 @@
-DATABASE=test_PiuCheBuono
+DATABASE=test_FreePlanet
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
-appTelegram_TEST=["1","17"]
-appTelegram=["1","17"]
-appTelegram_DEVELOP=["17"]
+appTelegram_TEST=["1","13"]
+appTelegram=["1","13"]
+appTelegram_DEVELOP=["13"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
MONGODB_USER=admin
@@ -41,7 +41,4 @@ FTPSERVER_USER=ftpusrsrv_
FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123
SCRIPTS_DIR=admin_scripts
-CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
-MIAB_HOST=box.lamiaposta.org
-MIAB_ADMIN_EMAIL=admin@lamiaposta.org
-MIAB_ADMIN_PASSWORD=passpao1pabox@1A
\ No newline at end of file
+CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
\ No newline at end of file
diff --git a/public/upload/catalogo/background.png b/public/upload/myschedas/background.png
similarity index 100%
rename from public/upload/catalogo/background.png
rename to public/upload/myschedas/background.png
diff --git a/src/server/models/mybacheca.js b/src/server/models/mybacheca.js
index ed46190..b98b644 100755
--- a/src/server/models/mybacheca.js
+++ b/src/server/models/mybacheca.js
@@ -64,6 +64,9 @@ const MyBachecaSchema = new Schema({
contact_phone: {
type: String
},
+ contact_email: {
+ type: String
+ },
contact_telegram: {
type: String
},
diff --git a/src/server/models/myelem.js b/src/server/models/myelem.js
index 8c8d9f3..30d36bd 100755
--- a/src/server/models/myelem.js
+++ b/src/server/models/myelem.js
@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
const tools = require('../tools/general');
const { ObjectID, ObjectId } = require('mongodb');
-const { MySchedaSchema, scheletroScheda } = require('../models/myscheda');
+const { MySchedaSchema, IDimensioni } = require('../models/myscheda');
mongoose.Promise = global.Promise;
mongoose.level = "F";
@@ -48,6 +48,13 @@ const elemText = new Schema(
}
);
+const IElementiPagina = new Schema(
+ {
+ pagina: IDimensioni,
+ riga: IDimensioni,
+ }
+);
+
const catalogo = new Schema(
{
@@ -57,10 +64,6 @@ const catalogo = new Schema(
Editore: [{ type: String }],
pdf: { type: Boolean },
printable: { type: Boolean },
- backgroundimage: { type: String },
- backgroundimage_printable: { type: String },
- widthpag: { type: Number },
- widthpagPrintable: { type: Number },
width: { type: String },
height: { type: String },
@@ -73,15 +76,27 @@ const catalogo = new Schema(
last_page_height: { type: Number },
last_page_width: { type: Number },
+ margine_pagina: { type: String },
+ margine_riga: { type: String },
margine_paginaPrintable: { type: String },
margine_rigaPrintable: { type: String },
+ backgroundimage: { type: String },
+ backgroundimage_printable: { type: String },
+ backgroundSize: { type: String },
+ backgroundSize_printable: { type: String },
+ widthpagPrintable: { type: Number },
+
// -------------------
arrSchede: [
{
- scheda: scheletroScheda,
+ scheda: MySchedaSchema,
order: { type: Number },
numSchede: { type: Number },
+ /*arrProdToShow: {
+ type: [[mongoose.Schema.Types.Mixed]], // Definizione tipo
+ select: false // Imposta il campo come non selezionabile
+ },*/
}
],
}
diff --git a/src/server/models/myscheda.js b/src/server/models/myscheda.js
index fba218e..90190a8 100755
--- a/src/server/models/myscheda.js
+++ b/src/server/models/myscheda.js
@@ -13,24 +13,46 @@ mongoose.plugin(schema => {
schema.options.usePushEach = true
});
+const ISize = new Schema({
+ width: { type: String },
+ height: { type: String },
+});
+
+const IBorders = new Schema({
+ top: { type: String },
+ bottom: { type: String },
+ left: { type: String },
+ right: { type: String },
+})
+const IDimensioni = new Schema({
+ size: ISize,
+ margini: IBorders,
+ padding: IBorders,
+});
+
+const IElementiScheda = new Schema({
+ pagina: IDimensioni,
+ riga: IDimensioni,
+ scheda_prodotto: IDimensioni,
+ immagine_prodotto: IDimensioni,
+});
+
const scheletroScheda = {
- idapp: {
- type: String,
- },
- name: { type: String },
+ idapp: { type: String },
isTemplate: { type: Boolean },
- widthpag: { type: Number },
- width: { type: Number },
- height: { type: Number },
- widthscheda: { type: String },
+ name: { type: String },
+ line_height: { type: Number },
numschede_perRiga: { type: Number },
numschede_perCol: { type: Number },
- margine_top: { type: Number },
- margine_pagina: { type: String },
- margine_riga: { type: String },
text: { type: String },
posiz_text: { type: Number },
- line_height: { type: Number },
+
+ dimensioni: IElementiScheda,
+
+ bgimg: { type: String },
+ bgimg_printable: { type: String },
+ bgSize: { type: String },
+ bgSize_Printable: { type: String },
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
@@ -68,4 +90,4 @@ MyScheda.createIndexes((err) => {
if (err) throw err;
});
-module.exports = { MyScheda, MySchedaSchema, scheletroScheda };
+module.exports = { MyScheda, MySchedaSchema, IDimensioni };
diff --git a/src/server/models/sendnotif.js b/src/server/models/sendnotif.js
index 79d3ac6..e1d9cb5 100755
--- a/src/server/models/sendnotif.js
+++ b/src/server/models/sendnotif.js
@@ -1009,7 +1009,7 @@ sendNotifSchema.statics.createNewNotification = async function (req, res, params
myrecnotif.idrec = rec._id;
try {
if (rec.photos && rec.photos[0]) {
- const mydir = server_constants.DIR_UPLOAD + shared_consts.getDirectoryByTable(table, true);
+ const mydir = tools.getHostByIdApp(myrecnotif.idapp) + server_constants.DIR_UPLOAD + '/' + shared_consts.getDirectoryImgByTable(table, rec.username);
myrecnotif.img = mydir + rec.photos[0].imagefile;
}
} catch (e) {
diff --git a/src/server/server.js b/src/server/server.js
index 14b81a2..5043548 100755
--- a/src/server/server.js
+++ b/src/server/server.js
@@ -888,7 +888,10 @@ function startServer(app, port) {
// Middleware per assicurarsi che gli headers CORS siano sempre presenti
app.use((req, res, next) => {
- const origin = req.headers.origin;
+ let origin = req.headers.origin;
+ if (!origin) {
+ origin = '*';
+ }
if (corsOptions.origin === '*' ||
(typeof corsOptions.origin === 'function' &&
corsOptions.origin.toString().includes(origin))) {
diff --git a/src/server/telegram/telegrambot.js b/src/server/telegram/telegrambot.js
index 2782cd7..b578d12 100755
--- a/src/server/telegram/telegrambot.js
+++ b/src/server/telegram/telegrambot.js
@@ -760,7 +760,7 @@ const MyTelegramBot = {
if (cl && idtelegram) {
return await cl.sendMsg(idtelegram, text, null, MyForm, message_id,
- chat_id, ripr_menuPrec, img);
+ chat_id, ripr_menuPrec, img, { idapp });
}
return { text: '' };
@@ -3883,7 +3883,10 @@ class Telegram {
};
}
+
if (opt && opt.img) {
+ opt.img = tools.fixUrl(opt.img, opt.idapp);
+ console.log('opt.img', opt.img)
return this.bot.sendPhoto(id, opt.img, { caption: text, ...form }).catch((e) => {
let blocked = false;
if ((e.message.indexOf('Forbidden') > 0) ||
@@ -3942,7 +3945,7 @@ class Telegram {
}
}
- async sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec, img = '') {
+ async sendMsg(id, text, menu, form, msg_id, chat_id, ripr_menuPrec, img = '', opzioni = null) {
if (!id || !text)
return false;
@@ -3952,12 +3955,12 @@ class Telegram {
let text1 = text.slice(0, 4090);
let text2 = text.slice(4090, text.length);
await this._inviaMsg(id, text1, form, menu, msg_id, chat_id,
- ripr_menuPrec, { img });
+ ripr_menuPrec, { img, ...opzioni });
return await this._inviaMsg(id, text2, form, menu, msg_id, chat_id,
- ripr_menuPrec, { img });
+ ripr_menuPrec, { img, ...opzioni });
} else {
return await this._inviaMsg(id, text, form, menu, msg_id, chat_id,
- ripr_menuPrec, { img });
+ ripr_menuPrec, { img, ...opzioni });
}
} catch (e) {
console.error('Error sendMsg', e);
diff --git a/src/server/tools/general.js b/src/server/tools/general.js
index 1a5587b..1b68422 100755
--- a/src/server/tools/general.js
+++ b/src/server/tools/general.js
@@ -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} ${title} ${icon}\n`;
+ mystr += `${icon} ${title}\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;
+ }
+
};
diff --git a/src/server/tools/globalTables.js b/src/server/tools/globalTables.js
index 0c0e4b2..427f308 100755
--- a/src/server/tools/globalTables.js
+++ b/src/server/tools/globalTables.js
@@ -462,6 +462,7 @@ module.exports = {
await tools.snooze(25);
textsent = risult.text;
+
}
}
}
diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js
index 5ef79e6..f6595c5 100755
--- a/src/server/tools/shared_nodejs.js
+++ b/src/server/tools/shared_nodejs.js
@@ -184,6 +184,12 @@ module.exports = {
// Condivise
TABLES_FAVORITE_BOOKMARK: ['myskills', 'mygoods', 'mybachecas', 'myhosps', 'attivitas'],
+ TABLEFORUSERS: [
+ 'myskills',
+ 'mygoods',
+ 'mybachecas',
+ 'myhosps',
+ ],
// Solo per NODEJS
@@ -244,6 +250,7 @@ module.exports = {
TABLES_PERM_CHANGE_FOR_USERS: ['myskills', 'mybachecas', 'myhosps', 'mygoods'],
+
TABLES_POPULATE_DATA: [
{
table: 'adtypegoods',
@@ -911,6 +918,7 @@ module.exports = {
website: 1,
organisedBy: 1,
contact_phone: 1,
+ contact_email: 1,
contact_telegram: 1,
address: 1,
min_partecip: 1,
@@ -1012,6 +1020,15 @@ module.exports = {
return (trovatorec) ? trovatorec.label : ''
},
+ getDirectoryImgByTable(table, username) {
+ if (this.TABLEFORUSERS.includes(table)) {
+ ris = 'profile/' + username + '/' + table + '/';
+ }
+
+ return ris;
+
+ },
+
ButtonCodeAction: {
NONE: 0,
NEXT_10: 1,
diff --git a/src/server/version.txt b/src/server/version.txt
index a5ba932..a5e4282 100644
--- a/src/server/version.txt
+++ b/src/server/version.txt
@@ -1 +1 @@
-1.1.7
\ No newline at end of file
+1.1.9
\ No newline at end of file