- 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: {
|
||||
type: Number
|
||||
},
|
||||
stockQty: { // in magazzino
|
||||
type: Number
|
||||
},
|
||||
quantityAvailable: {
|
||||
type: Number
|
||||
},
|
||||
|
||||
@@ -107,44 +107,46 @@ const SiteSchema = new Schema({
|
||||
},
|
||||
confpages: {
|
||||
font: { type: String, default: '' },
|
||||
col_toolbar: { type: String },
|
||||
col_bgfooter: { type: String },
|
||||
show_darkopt: { type: Boolean, default: true },
|
||||
showButtHome: { type: Boolean },
|
||||
showProfile: { type: Boolean },
|
||||
showUserMenu: { type: Boolean },
|
||||
showRegButton: { type: Boolean },
|
||||
enableReg: { type: Boolean },
|
||||
showNL: { type: Boolean },
|
||||
showMsgs: { type: Boolean },
|
||||
showNotif: { type: Boolean },
|
||||
showCoins: { type: Boolean },
|
||||
showNameSurname: { type: Boolean },
|
||||
showCompetenze: { type: Boolean },
|
||||
showConnected: { type: Boolean },
|
||||
bookingEvents: { type: Boolean },
|
||||
enableEcommerce: { type: Boolean },
|
||||
enableGroups: { type: Boolean },
|
||||
enableCircuits: { type: Boolean },
|
||||
enableProj: { type: Boolean },
|
||||
enableTodos: { type: Boolean },
|
||||
enableRegByBot: { type: Boolean },
|
||||
enableRegMultiChoice: { type: Boolean },
|
||||
enableDebugOn: { type: Boolean },
|
||||
enabledRegNeedTelegram: { type: Boolean },
|
||||
showViewEventi: { type: Boolean },
|
||||
showViewGroups: { type: Boolean },
|
||||
showViewCircuits: { type: Boolean },
|
||||
showViewUsers: { type: Boolean },
|
||||
showViewBooking: { type: Boolean },
|
||||
showViewProfile: { type: Boolean },
|
||||
enablePwa: { type: Boolean },
|
||||
col_toolbar: { type: String, default: '' },
|
||||
col_bgfooter: { type: String, default: '' },
|
||||
show_darkopt: { type: Boolean, default: false },
|
||||
showButtHome: { type: Boolean, default: false },
|
||||
showProfile: { type: Boolean, default: false },
|
||||
showUserMenu: { type: Boolean, default: true },
|
||||
showiscrittiMenu: { type: Boolean, default: false },
|
||||
showRegButton: { type: Boolean, default: false },
|
||||
enableReg: { type: Boolean, default: false },
|
||||
showNL: { type: Boolean, default: false },
|
||||
sendNewsletter: { type: Boolean, default: false },
|
||||
showMsgs: { type: Boolean, default: false },
|
||||
showNotif: { type: Boolean, default: false },
|
||||
showCoins: { type: Boolean, default: false },
|
||||
showNameSurname: { type: Boolean, default: false },
|
||||
showCompetenze: { type: Boolean, default: false },
|
||||
showConnected: { type: Boolean, default: false },
|
||||
bookingEvents: { type: Boolean, default: false },
|
||||
enableEcommerce: { type: Boolean, default: false },
|
||||
enableGroups: { type: Boolean, default: false },
|
||||
enableCircuits: { type: Boolean, default: false },
|
||||
enableProj: { type: Boolean, default: false },
|
||||
enableTodos: { type: Boolean, default: false },
|
||||
enableRegByBot: { type: Boolean, default: false },
|
||||
enableRegMultiChoice: { type: Boolean, default: false },
|
||||
enableDebugOn: { type: Boolean, default: false },
|
||||
enabledRegNeedTelegram: { type: Boolean, default: false },
|
||||
showViewEventi: { type: Boolean, default: false },
|
||||
showViewGroups: { type: Boolean, default: false },
|
||||
showViewCircuits: { type: Boolean, default: false },
|
||||
showViewUsers: { type: Boolean, default: false },
|
||||
showViewBooking: { type: Boolean, default: false },
|
||||
showViewProfile: { type: Boolean, default: false },
|
||||
enablePwa: { type: Boolean, default: false },
|
||||
lang: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
videoPromo: { type: String },
|
||||
PDFPromo: { type: String },
|
||||
videoPromo: { type: String, default: '' },
|
||||
PDFPromo: { type: String, default: '' },
|
||||
},
|
||||
confsite: {
|
||||
options: { // ConfSite
|
||||
@@ -153,7 +155,7 @@ const SiteSchema = new Schema({
|
||||
},
|
||||
},
|
||||
policy: {
|
||||
show: { type: Boolean },
|
||||
show: { type: Boolean, default: false },
|
||||
owneremail: { type: String },
|
||||
siteName: { type: String },
|
||||
ownerDataName: { type: String },
|
||||
@@ -164,17 +166,17 @@ const SiteSchema = new Schema({
|
||||
country: { type: String },
|
||||
},
|
||||
contacts: {
|
||||
facebook: { type: String },
|
||||
instagram: { type: String },
|
||||
whatsapp: { type: String },
|
||||
whatsapp_home: { type: Boolean },
|
||||
telegram: { type: String },
|
||||
youtube: { type: String },
|
||||
email: { type: String },
|
||||
address: { type: String },
|
||||
map: { type: String },
|
||||
info2: { type: String },
|
||||
cell: { type: String },
|
||||
facebook: { type: String, default: '' },
|
||||
instagram: { type: String, default: '' },
|
||||
whatsapp: { type: String, default: '' },
|
||||
whatsapp_home: { type: Boolean, default: false },
|
||||
telegram: { type: String, default: '' },
|
||||
youtube: { type: String, default: '' },
|
||||
email: { type: String, default: '' },
|
||||
address: { type: String, default: '' },
|
||||
map: { type: String, default: '' },
|
||||
info2: { type: String, default: '' },
|
||||
cell: { type: String, default: '' },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -228,7 +230,7 @@ module.exports.findAll = async function () {
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
|
||||
const myfind = { idapp, active: true };
|
||||
let myfind = { idapp, active: true };
|
||||
|
||||
let rec = await Site.findOne(myfind).lean();
|
||||
if (rec) {
|
||||
@@ -239,12 +241,28 @@ module.exports.findAllIdApp = async function (idapp) {
|
||||
// rec.confsite = {};
|
||||
|
||||
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 {};
|
||||
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
@@ -270,6 +288,28 @@ module.exports.generateNewSite_IdApp = async function (idapp, params) {
|
||||
|
||||
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)
|
||||
return mysite.idapp;
|
||||
else
|
||||
|
||||
@@ -5364,7 +5364,7 @@ UserSchema.statics.addNewSite = async function (idappPass, body) {
|
||||
|
||||
try {
|
||||
// cerca un IdApp Libero
|
||||
let idapp = await Site.generateNewSite_IdApp(idappPass, body);
|
||||
let idapp = await Site.generateNewSite_IdApp(idappPass, body, true);
|
||||
|
||||
if (idapp) {
|
||||
let arrSite = await Site.find({ idapp }).lean();
|
||||
|
||||
@@ -156,10 +156,13 @@ router.post('/', async (req, res) => {
|
||||
if (lastrec.date_reg) {
|
||||
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 5);
|
||||
if (ris) {
|
||||
tools.writeIPToBan(
|
||||
user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' +
|
||||
user.surname);
|
||||
await tools.snooze(10000);
|
||||
const msg = user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' +
|
||||
user.surname;
|
||||
tools.writeIPToBan(msg);
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheAdmin(body.idapp, 'BAN: ' + msg, true);
|
||||
|
||||
await tools.snooze(5000);
|
||||
res.status(400).
|
||||
send({ code: server_constants.RIS_CODE_BANIP, msg: '' });
|
||||
return 1;
|
||||
@@ -567,6 +570,7 @@ router.post('/login', (req, res) => {
|
||||
body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) +
|
||||
']';
|
||||
tools.mylogshow(msg);
|
||||
await telegrambot.sendMsgTelegramToTheAdmin(user.idapp, msg, true);
|
||||
tools.writeErrorLog(msg);
|
||||
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
|
||||
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
|
||||
|
||||
Reference in New Issue
Block a user