- Installazione primo Sito Web del server
- Creazione prima pagina Home
This commit is contained in:
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,3 +1,7 @@
|
|||||||
{
|
{
|
||||||
"search.useIgnoreFiles": false
|
"search.useIgnoreFiles": false,
|
||||||
|
"files.watcherExclude": {
|
||||||
|
"**/.git/objects/**": true,
|
||||||
|
"**/node_modules/**": true
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,9 @@ const productSchema = new Schema({
|
|||||||
unit: {
|
unit: {
|
||||||
type: Number
|
type: Number
|
||||||
},
|
},
|
||||||
|
stockQty: { // in magazzino
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
quantityAvailable: {
|
quantityAvailable: {
|
||||||
type: Number
|
type: Number
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -107,44 +107,46 @@ const SiteSchema = new Schema({
|
|||||||
},
|
},
|
||||||
confpages: {
|
confpages: {
|
||||||
font: { type: String, default: '' },
|
font: { type: String, default: '' },
|
||||||
col_toolbar: { type: String },
|
col_toolbar: { type: String, default: '' },
|
||||||
col_bgfooter: { type: String },
|
col_bgfooter: { type: String, default: '' },
|
||||||
show_darkopt: { type: Boolean, default: true },
|
show_darkopt: { type: Boolean, default: false },
|
||||||
showButtHome: { type: Boolean },
|
showButtHome: { type: Boolean, default: false },
|
||||||
showProfile: { type: Boolean },
|
showProfile: { type: Boolean, default: false },
|
||||||
showUserMenu: { type: Boolean },
|
showUserMenu: { type: Boolean, default: true },
|
||||||
showRegButton: { type: Boolean },
|
showiscrittiMenu: { type: Boolean, default: false },
|
||||||
enableReg: { type: Boolean },
|
showRegButton: { type: Boolean, default: false },
|
||||||
showNL: { type: Boolean },
|
enableReg: { type: Boolean, default: false },
|
||||||
showMsgs: { type: Boolean },
|
showNL: { type: Boolean, default: false },
|
||||||
showNotif: { type: Boolean },
|
sendNewsletter: { type: Boolean, default: false },
|
||||||
showCoins: { type: Boolean },
|
showMsgs: { type: Boolean, default: false },
|
||||||
showNameSurname: { type: Boolean },
|
showNotif: { type: Boolean, default: false },
|
||||||
showCompetenze: { type: Boolean },
|
showCoins: { type: Boolean, default: false },
|
||||||
showConnected: { type: Boolean },
|
showNameSurname: { type: Boolean, default: false },
|
||||||
bookingEvents: { type: Boolean },
|
showCompetenze: { type: Boolean, default: false },
|
||||||
enableEcommerce: { type: Boolean },
|
showConnected: { type: Boolean, default: false },
|
||||||
enableGroups: { type: Boolean },
|
bookingEvents: { type: Boolean, default: false },
|
||||||
enableCircuits: { type: Boolean },
|
enableEcommerce: { type: Boolean, default: false },
|
||||||
enableProj: { type: Boolean },
|
enableGroups: { type: Boolean, default: false },
|
||||||
enableTodos: { type: Boolean },
|
enableCircuits: { type: Boolean, default: false },
|
||||||
enableRegByBot: { type: Boolean },
|
enableProj: { type: Boolean, default: false },
|
||||||
enableRegMultiChoice: { type: Boolean },
|
enableTodos: { type: Boolean, default: false },
|
||||||
enableDebugOn: { type: Boolean },
|
enableRegByBot: { type: Boolean, default: false },
|
||||||
enabledRegNeedTelegram: { type: Boolean },
|
enableRegMultiChoice: { type: Boolean, default: false },
|
||||||
showViewEventi: { type: Boolean },
|
enableDebugOn: { type: Boolean, default: false },
|
||||||
showViewGroups: { type: Boolean },
|
enabledRegNeedTelegram: { type: Boolean, default: false },
|
||||||
showViewCircuits: { type: Boolean },
|
showViewEventi: { type: Boolean, default: false },
|
||||||
showViewUsers: { type: Boolean },
|
showViewGroups: { type: Boolean, default: false },
|
||||||
showViewBooking: { type: Boolean },
|
showViewCircuits: { type: Boolean, default: false },
|
||||||
showViewProfile: { type: Boolean },
|
showViewUsers: { type: Boolean, default: false },
|
||||||
enablePwa: { type: Boolean },
|
showViewBooking: { type: Boolean, default: false },
|
||||||
|
showViewProfile: { type: Boolean, default: false },
|
||||||
|
enablePwa: { type: Boolean, default: false },
|
||||||
lang: {
|
lang: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
videoPromo: { type: String },
|
videoPromo: { type: String, default: '' },
|
||||||
PDFPromo: { type: String },
|
PDFPromo: { type: String, default: '' },
|
||||||
},
|
},
|
||||||
confsite: {
|
confsite: {
|
||||||
options: { // ConfSite
|
options: { // ConfSite
|
||||||
@@ -153,7 +155,7 @@ const SiteSchema = new Schema({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
show: { type: Boolean },
|
show: { type: Boolean, default: false },
|
||||||
owneremail: { type: String },
|
owneremail: { type: String },
|
||||||
siteName: { type: String },
|
siteName: { type: String },
|
||||||
ownerDataName: { type: String },
|
ownerDataName: { type: String },
|
||||||
@@ -164,17 +166,17 @@ const SiteSchema = new Schema({
|
|||||||
country: { type: String },
|
country: { type: String },
|
||||||
},
|
},
|
||||||
contacts: {
|
contacts: {
|
||||||
facebook: { type: String },
|
facebook: { type: String, default: '' },
|
||||||
instagram: { type: String },
|
instagram: { type: String, default: '' },
|
||||||
whatsapp: { type: String },
|
whatsapp: { type: String, default: '' },
|
||||||
whatsapp_home: { type: Boolean },
|
whatsapp_home: { type: Boolean, default: false },
|
||||||
telegram: { type: String },
|
telegram: { type: String, default: '' },
|
||||||
youtube: { type: String },
|
youtube: { type: String, default: '' },
|
||||||
email: { type: String },
|
email: { type: String, default: '' },
|
||||||
address: { type: String },
|
address: { type: String, default: '' },
|
||||||
map: { type: String },
|
map: { type: String, default: '' },
|
||||||
info2: { type: String },
|
info2: { type: String, default: '' },
|
||||||
cell: { type: String },
|
cell: { type: String, default: '' },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,7 +230,7 @@ module.exports.findAll = async function () {
|
|||||||
|
|
||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
|
|
||||||
const myfind = { idapp, active: true };
|
let myfind = { idapp, active: true };
|
||||||
|
|
||||||
let rec = await Site.findOne(myfind).lean();
|
let rec = await Site.findOne(myfind).lean();
|
||||||
if (rec) {
|
if (rec) {
|
||||||
@@ -239,12 +241,28 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
// rec.confsite = {};
|
// rec.confsite = {};
|
||||||
|
|
||||||
return rec;
|
return rec;
|
||||||
|
} else {
|
||||||
|
myfind = { name: 'local' };
|
||||||
|
let rec = await Site.findOne(myfind).lean();
|
||||||
|
if (!rec) {
|
||||||
|
const mysite = new Site();
|
||||||
|
mysite.name = 'local';
|
||||||
|
|
||||||
|
await mysite.save();
|
||||||
|
|
||||||
|
mysite.idapp = idapp;
|
||||||
|
return mysite;
|
||||||
|
} else {
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.generateNewSite_IdApp = async function (idapp, params) {
|
module.exports.generateNewSite_IdApp = async function (idapp, params, createpage) {
|
||||||
|
|
||||||
|
const { MyPage } = require('../models/mypage');
|
||||||
|
|
||||||
let ris = null;
|
let ris = null;
|
||||||
|
|
||||||
@@ -270,6 +288,28 @@ module.exports.generateNewSite_IdApp = async function (idapp, params) {
|
|||||||
|
|
||||||
const ris = await mysite.save();
|
const ris = await mysite.save();
|
||||||
|
|
||||||
|
if (createpage) {
|
||||||
|
// 1. Crea Pagina principale HOME - Loggato
|
||||||
|
let myp = new MyPage({
|
||||||
|
order: 10,
|
||||||
|
idapp: mysite.idapp,
|
||||||
|
path: 'home',
|
||||||
|
active: true,
|
||||||
|
title: 'Home',
|
||||||
|
});
|
||||||
|
let rispag = await myp.save();
|
||||||
|
|
||||||
|
// 2. Crea Pagina principale HOME - Non Loggato
|
||||||
|
myp = new MyPage({
|
||||||
|
order: 10,
|
||||||
|
idapp: mysite.idapp,
|
||||||
|
path: 'home_logout',
|
||||||
|
active: true,
|
||||||
|
title: 'Home NoLoggato',
|
||||||
|
});
|
||||||
|
rispag = await myp.save();
|
||||||
|
}
|
||||||
|
|
||||||
if (ris)
|
if (ris)
|
||||||
return mysite.idapp;
|
return mysite.idapp;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -5364,7 +5364,7 @@ UserSchema.statics.addNewSite = async function (idappPass, body) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// cerca un IdApp Libero
|
// cerca un IdApp Libero
|
||||||
let idapp = await Site.generateNewSite_IdApp(idappPass, body);
|
let idapp = await Site.generateNewSite_IdApp(idappPass, body, true);
|
||||||
|
|
||||||
if (idapp) {
|
if (idapp) {
|
||||||
let arrSite = await Site.find({ idapp }).lean();
|
let arrSite = await Site.find({ idapp }).lean();
|
||||||
|
|||||||
@@ -156,10 +156,13 @@ router.post('/', async (req, res) => {
|
|||||||
if (lastrec.date_reg) {
|
if (lastrec.date_reg) {
|
||||||
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 5);
|
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 5);
|
||||||
if (ris) {
|
if (ris) {
|
||||||
tools.writeIPToBan(
|
const msg = user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' +
|
||||||
user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' +
|
user.surname;
|
||||||
user.surname);
|
tools.writeIPToBan(msg);
|
||||||
await tools.snooze(10000);
|
|
||||||
|
await telegrambot.sendMsgTelegramToTheAdmin(body.idapp, 'BAN: ' + msg, true);
|
||||||
|
|
||||||
|
await tools.snooze(5000);
|
||||||
res.status(400).
|
res.status(400).
|
||||||
send({ code: server_constants.RIS_CODE_BANIP, msg: '' });
|
send({ code: server_constants.RIS_CODE_BANIP, msg: '' });
|
||||||
return 1;
|
return 1;
|
||||||
@@ -567,6 +570,7 @@ router.post('/login', (req, res) => {
|
|||||||
body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) +
|
body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) +
|
||||||
']';
|
']';
|
||||||
tools.mylogshow(msg);
|
tools.mylogshow(msg);
|
||||||
|
await telegrambot.sendMsgTelegramToTheAdmin(user.idapp, msg, true);
|
||||||
tools.writeErrorLog(msg);
|
tools.writeErrorLog(msg);
|
||||||
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
|
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
|
||||||
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
|
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
|
||||||
@@ -730,7 +734,7 @@ router.post('/updatesaldo', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdr, idapp, shared_consts.LIMIT_NOTIF_FOR_USER);
|
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdr, idapp, shared_consts.LIMIT_NOTIF_FOR_USER);
|
||||||
|
|
||||||
ris.arrrecnotif = arrrecnotif;
|
ris.arrrecnotif = arrrecnotif;
|
||||||
|
|
||||||
return res.send({ ris });
|
return res.send({ ris });
|
||||||
|
|||||||
Reference in New Issue
Block a user