From 791e18f167e24765d67031bd48a3eb026d4a0436 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Thu, 12 Sep 2024 14:49:30 +0200 Subject: [PATCH] - Mail in a Box: comandi per aggiungere/modificare/rimuovere le caselle di posta - aggiunto idMyGroup: ospiti siti di gruppi (AbitareGliIblei) --- .env.development | 2 +- .env.example.production | 2 +- .env.prod.gruppomacro | 2 +- .env.prod.pcb | 2 +- .env.test.abitaregliiblei.it | 2 +- .env.test.gruppomacro | 2 +- .env.test.pcb | 2 +- .env.test.risosrv | 2 +- .env.test2 | 2 +- .env.test_riso.pcb | 2 +- .../abitaregliiblei.it/.env.development | 2 +- _ALL_SITES/abitaregliiblei.it/.env.test | 2 +- _ALL_SITES/abitaregliiblei.it/package.json | 2 +- .../fioredellavita.riso.app/.env.development | 2 +- _ALL_SITES/fioredellavita.riso.app/.env.test | 2 +- .../fioredellavita.riso.app/package.json | 2 +- _ALL_SITES/gruppomacro.app/.env.development | 2 +- _ALL_SITES/gruppomacro.app/.env.test | 2 +- _ALL_SITES/gruppomacro.app/package.json | 2 +- _ALL_SITES/piuchebuono.app/.env.development | 2 +- _ALL_SITES/piuchebuono.app/.env.test | 2 +- _ALL_SITES/riso.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.production | 2 +- _ALL_SITES/riso.app/.env.test | 2 +- _ALL_SITES/riso.app/package.json | 2 +- package.json | 2 +- src-pwa/custom-service-worker.js | 2 +- src/index.template.html | 2 +- src/model/GlobalStore.ts | 5 + src/model/UserStore.ts | 7 +- src/rootgen/admin/confsite/confsite.ts | 3 + src/rootgen/admin/confsite/confsite.vue | 126 +++++++- src/statics/lang/it.js | 13 + src/store/Modules/costanti.ts | 3 +- src/store/Modules/fieldsTable.ts | 7 + src/store/Modules/tools.ts | 31 +- src/store/globalStore.ts | 32 +- src/views/admin/server/server.ts | 276 ++++++++++++++++-- src/views/admin/server/server.vue | 176 ++++++++++- 39 files changed, 647 insertions(+), 88 deletions(-) diff --git a/.env.development b/.env.development index 158377fa..c795895c 100755 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="19" DIRECTORY_LOCAL="newfreeplanet" diff --git a/.env.example.production b/.env.example.production index 3c5ee1ad..15dcc7d2 100755 --- a/.env.example.production +++ b/.env.example.production @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.prod.gruppomacro b/.env.prod.gruppomacro index c788e121..e27f7093 100644 --- a/.env.prod.gruppomacro +++ b/.env.prod.gruppomacro @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="18" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.prod.pcb b/.env.prod.pcb index 5f0f3ef8..73e17601 100644 --- a/.env.prod.pcb +++ b/.env.prod.pcb @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="17" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test.abitaregliiblei.it b/.env.test.abitaregliiblei.it index 0d2c108c..b4358573 100755 --- a/.env.test.abitaregliiblei.it +++ b/.env.test.abitaregliiblei.it @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="19" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test.gruppomacro b/.env.test.gruppomacro index aca51a77..7456718b 100755 --- a/.env.test.gruppomacro +++ b/.env.test.gruppomacro @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="18" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test.pcb b/.env.test.pcb index b8d1b3b3..8d1cef84 100755 --- a/.env.test.pcb +++ b/.env.test.pcb @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="17" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test.risosrv b/.env.test.risosrv index f9aeddec..0ff00b91 100755 --- a/.env.test.risosrv +++ b/.env.test.risosrv @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker_1.0.39.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test2 b/.env.test2 index d1e9ec49..a28cd203 100755 --- a/.env.test2 +++ b/.env.test2 @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/.env.test_riso.pcb b/.env.test_riso.pcb index c212e305..40281573 100755 --- a/.env.test_riso.pcb +++ b/.env.test_riso.pcb @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/abitaregliiblei.it/.env.development b/_ALL_SITES/abitaregliiblei.it/.env.development index db837025..32164efe 100755 --- a/_ALL_SITES/abitaregliiblei.it/.env.development +++ b/_ALL_SITES/abitaregliiblei.it/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="19" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/abitaregliiblei.it/.env.test b/_ALL_SITES/abitaregliiblei.it/.env.test index 979a52f8..b6b6174a 100755 --- a/_ALL_SITES/abitaregliiblei.it/.env.test +++ b/_ALL_SITES/abitaregliiblei.it/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="16" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/abitaregliiblei.it/package.json b/_ALL_SITES/abitaregliiblei.it/package.json index 68370db2..dd5d1f6f 100755 --- a/_ALL_SITES/abitaregliiblei.it/package.json +++ b/_ALL_SITES/abitaregliiblei.it/package.json @@ -1,6 +1,6 @@ { "name": "abitaregliiblei", - "version": "1.0.57", + "version": "1.0.58", "description": "Abitare Gli Iblei", "productName": "AbitareGliIblei", "author": "Paolo Arena", diff --git a/_ALL_SITES/fioredellavita.riso.app/.env.development b/_ALL_SITES/fioredellavita.riso.app/.env.development index 50b0ed1d..3f2aff46 100755 --- a/_ALL_SITES/fioredellavita.riso.app/.env.development +++ b/_ALL_SITES/fioredellavita.riso.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="15" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/fioredellavita.riso.app/.env.test b/_ALL_SITES/fioredellavita.riso.app/.env.test index 0267873a..6db17ee6 100755 --- a/_ALL_SITES/fioredellavita.riso.app/.env.test +++ b/_ALL_SITES/fioredellavita.riso.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="15" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/fioredellavita.riso.app/package.json b/_ALL_SITES/fioredellavita.riso.app/package.json index bba83673..f4832b1c 100755 --- a/_ALL_SITES/fioredellavita.riso.app/package.json +++ b/_ALL_SITES/fioredellavita.riso.app/package.json @@ -1,6 +1,6 @@ { "name": "fioredellavita", - "version": "1.0.57", + "version": "1.0.58", "description": "Fiore Della Vita", "productName": "Fiore Della Vita", "author": "Paolo Arena", diff --git a/_ALL_SITES/gruppomacro.app/.env.development b/_ALL_SITES/gruppomacro.app/.env.development index 70387af7..45b0cc2e 100755 --- a/_ALL_SITES/gruppomacro.app/.env.development +++ b/_ALL_SITES/gruppomacro.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="18" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/gruppomacro.app/.env.test b/_ALL_SITES/gruppomacro.app/.env.test index fc20a7bd..2a56f042 100755 --- a/_ALL_SITES/gruppomacro.app/.env.test +++ b/_ALL_SITES/gruppomacro.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="16" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/gruppomacro.app/package.json b/_ALL_SITES/gruppomacro.app/package.json index 74f686cd..bdb37d57 100755 --- a/_ALL_SITES/gruppomacro.app/package.json +++ b/_ALL_SITES/gruppomacro.app/package.json @@ -1,6 +1,6 @@ { "name": "gruppomacro", - "version": "1.0.57", + "version": "1.0.58", "description": "GruppoMacro", "productName": "Gruppo Macro", "author": "Paolo Arena", diff --git a/_ALL_SITES/piuchebuono.app/.env.development b/_ALL_SITES/piuchebuono.app/.env.development index 05d667ec..aa3e8e35 100755 --- a/_ALL_SITES/piuchebuono.app/.env.development +++ b/_ALL_SITES/piuchebuono.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="17" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/piuchebuono.app/.env.test b/_ALL_SITES/piuchebuono.app/.env.test index eda00445..14e936fd 100755 --- a/_ALL_SITES/piuchebuono.app/.env.test +++ b/_ALL_SITES/piuchebuono.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/riso.app/.env.development b/_ALL_SITES/riso.app/.env.development index 721c007b..fd5d5b9b 100755 --- a/_ALL_SITES/riso.app/.env.development +++ b/_ALL_SITES/riso.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.production b/_ALL_SITES/riso.app/.env.production index 04aaebc1..a8296a72 100644 --- a/_ALL_SITES/riso.app/.env.production +++ b/_ALL_SITES/riso.app/.env.production @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/riso.app/.env.test b/_ALL_SITES/riso.app/.env.test index fc20a7bd..2a56f042 100755 --- a/_ALL_SITES/riso.app/.env.test +++ b/_ALL_SITES/riso.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="1.0.57" +APP_VERSION="1.0.58" SERVICE_WORKER_FILE="service-worker.js" APP_ID="16" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/riso.app/package.json b/_ALL_SITES/riso.app/package.json index 168cd6fa..12d901fa 100755 --- a/_ALL_SITES/riso.app/package.json +++ b/_ALL_SITES/riso.app/package.json @@ -1,6 +1,6 @@ { "name": "riso", - "version": "1.0.57", + "version": "1.0.58", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "productName": "Riso", "author": "Paolo Arena", diff --git a/package.json b/package.json index 0446662b..d670ea5b 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "abitaregliiblei", - "version": "1.0.57", + "version": "1.0.58", "description": "Abitare Gli Iblei", "productName": "AbitareGliIblei", "author": "Paolo Arena", diff --git a/src-pwa/custom-service-worker.js b/src-pwa/custom-service-worker.js index 58bb105f..7b564fff 100755 --- a/src-pwa/custom-service-worker.js +++ b/src-pwa/custom-service-worker.js @@ -34,7 +34,7 @@ self.addEventListener('activate', (event) => { }); -const VersioneApp = "1.0.57"; +const VersioneApp = "1.0.58"; console.log(' [ VER-' + VersioneApp + ' ] _---------________------ PAO: this is my custom service worker'); diff --git a/src/index.template.html b/src/index.template.html index 722d852f..4fb69929 100755 --- a/src/index.template.html +++ b/src/index.template.html @@ -10,7 +10,7 @@ - + diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 1c847a15..f18a6b37 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -319,6 +319,10 @@ export interface ISites { host_testapi_ip?: string cf_token?: string cf_zoneId?: string + enable_servermail?: boolean + servermail?: string + servermailip?: string + dkim?: string portapp?: string dir?: string email_from?: string @@ -338,6 +342,7 @@ export interface ISites { contacts?: IContacts confpages: IConfPages ecomm?: IECommSettings + idMyGroup?: string } export interface INewsToSent { diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index c59ced20..ec5e77f3 100755 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -115,7 +115,7 @@ export interface IUserProfile { admin_telegram?: boolean resplist?: any workerslist?: any - dateofbirth?: Date|null + dateofbirth?: Date | null born_city_id?: number born_city_str?: string born_province?: string @@ -179,7 +179,7 @@ export interface IUserProfile { calc: ICalc } -export interface ICalc{ +export interface ICalc { numGoodsAndServices?: number } @@ -214,6 +214,7 @@ export interface IUserFields { perm?: number verified_email?: boolean verified_by_aportador?: boolean + idMyGroup?: string reported?: boolean username_who_report?: string date_report?: Date @@ -233,7 +234,7 @@ export interface IUserFields { numinvitatiattivi?: number cart?: ICart orderscart?: IOrderCart - calcstat?: ICalcStat|null + calcstat?: ICalcStat | null account?: IAccount } diff --git a/src/rootgen/admin/confsite/confsite.ts b/src/rootgen/admin/confsite/confsite.ts index d87cf49d..f82737b0 100755 --- a/src/rootgen/admin/confsite/confsite.ts +++ b/src/rootgen/admin/confsite/confsite.ts @@ -7,6 +7,8 @@ import { CTitleBanner } from '@/components/CTitleBanner' import { CMyFieldRec } from '@/components/CMyFieldRec' import { CMyFieldDb } from '@/components/CMyFieldDb' +import { toolsext } from '@src/store/Modules/toolsext' + import { useGlobalStore } from '@store/globalStore' import { costanti } from '@costanti' import { tools } from '@src/store/Modules/tools' @@ -64,6 +66,7 @@ export default defineComponent({ globalStore, saveShowDark, updateSite, + toolsext, } } }) diff --git a/src/rootgen/admin/confsite/confsite.vue b/src/rootgen/admin/confsite/confsite.vue index 0f8ef977..912a0066 100755 --- a/src/rootgen/admin/confsite/confsite.vue +++ b/src/rootgen/admin/confsite/confsite.vue @@ -71,6 +71,7 @@ + @@ -78,6 +79,85 @@ + + + + + + + + + + + + + + + + + + + + + rec.name === tofind && rec.type === 'A') let color = 'red' let ok = false - if (indrec >= 0) { - checkDomain = tofind + ' -> ' + arrDNS[indrec].content - let giusto = (paramsulServer === arrDNS[indrec].content) - color = giusto ? 'green' : 'red' - if (!giusto) { - checkDomain += ' (al posto di -> ' + paramsulServer + ')' - } else { - ok = true + try { + if (arrDNS) { + let indrec = arrDNS.findIndex((rec: any) => rec.name === tofind && rec.type === type) + if (indrec >= 0) { + checkDomain = tofind + ' -> ' + arrDNS[indrec].content + let giusto = (paramsulServer === arrDNS[indrec].content) + color = giusto ? 'green' : 'red' + if (!giusto) { + checkDomain += ' (al posto di -> ' + paramsulServer + ')' + } else { + ok = true + } + } else { + checkDomain = tofind + ' N/A' + } } - } else { - checkDomain = tofind + ' N/A' + + } catch (e) { + console.log('Error: ', e) } return { text: '' + checkDomain + '
', ok } diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 36b9eb03..f91bc617 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -362,8 +362,10 @@ export const useGlobalStore = defineStore('GlobalStore', { return userStore.my.profile.friends else if (table === 'friendsandme') return [{ username: userStore.my.username }, ...userStore.my.profile.friends] + // else if (table === 'mygroups') + // return userStore.groups else if (table === 'mygroups') - return userStore.groups + return state.mygroups else if (table === 'sendmsgs') return messageStore.last_msgs else if (table === 'sendnotifs') @@ -1923,12 +1925,16 @@ export const useGlobalStore = defineStore('GlobalStore', { const newarr = [] for (const value of myarr) { let label = value - if (table === 'mygroups') - label = value.descr - else if (table === 'circuits') + let valout = value + // if (table === 'mygroups') { + // label = value.descr + // valout = value.groupname + if (table === 'circuits') { label = value.name + } - newarr.push({ value, label }) + // console.log('value', value, 'label', label) + newarr.push({ value: valout, label }) } myarr = newarr @@ -2192,6 +2198,22 @@ export const useGlobalStore = defineStore('GlobalStore', { }) }, + async getMailInABox(cmd: string, record: any = undefined) { + + const mydata = { + cmd, + tokcheck: "php8.1_version_762321HSD121nJDokq@?!aFS.tar.gz", + record, + } + + return Api.SendReq('/admin/miab', 'POST', mydata) + .then((res) => { + return res.data + }).catch((error) => { + return false + }) + }, + } diff --git a/src/views/admin/server/server.ts b/src/views/admin/server/server.ts index 13264a79..578acd74 100755 --- a/src/views/admin/server/server.ts +++ b/src/views/admin/server/server.ts @@ -1,4 +1,4 @@ -import { defineComponent, onMounted, ref, watch, onUnmounted, nextTick } from 'vue' +import { defineComponent, onMounted, ref, computed, watch, onUnmounted, nextTick } from 'vue' import { CTitleBanner } from '../../../components/CTitleBanner' import { CDateTime } from '../../../components/CDateTime' @@ -68,11 +68,28 @@ export default defineComponent({ const optionsApi = ref([]) const arrZones = ref([]) const arrDNS = ref([]) + const arrEmails = ref([]) const optZones = ref([]) const selected = ref([]) const selZoneId = ref('') + const showNewEmail = ref(false) + const showchangePwd = ref(false) + const newEmail = ref('') + const newPassword = ref('') + const changeEmail = ref('') + const changePassword = ref('') + const isPwd = ref(true) + const emailSel = ref('') + + const isFormValid = computed(() => { + return newEmail.value && newEmail.value.includes('@') && newPassword.value.length >= 8 + }) + const isFormValidChange = computed(() => { + return emailSel.value && emailSel.value.includes('@') && changePassword.value.length >= 8 + }) + const columnsZones = [ { name: 'id', align: 'right', label: 'ID', field: 'id', visible: true }, { name: 'name', required: true, label: 'Nome', align: 'left', field: 'name', sortable: true, visible: true }, @@ -86,22 +103,24 @@ export default defineComponent({ { name: 'name', required: true, label: 'Nome', align: 'left', field: 'name', sortable: true, visible: true }, { name: 'type', required: true, label: 'Tipo', align: 'left', field: 'type', sortable: true, visible: true }, { name: 'proxied', required: true, align: 'center', label: 'Proxy', field: 'proxied', sortable: true, visible: true }, - { name: 'priority', required: true, align: 'center', label: 'Priorità', field: 'priority', sortable: true, visible: true }, + { name: 'priority', required: true, align: 'center', label: 'Pri', field: 'priority', sortable: true, visible: true }, { name: 'ttl', required: true, align: 'center', label: 'TTL', field: 'ttl', sortable: false, visible: true }, { name: 'content', required: true, label: 'Valore', align: 'left', field: 'content', sortable: true, visible: true }, + { name: 'delete', required: true, label: 'Azioni', align: 'left', field: 'delete', sortable: true, visible: true }, ]; const viscolumnsDNS = [ { name: 'name', required: true, label: 'Nome', align: 'left', field: 'name', sortable: true, visible: true, editable: true }, { name: 'type', required: true, label: 'Tipo', align: 'left', field: 'type', sortable: true, visible: true, editable: true }, { name: 'proxied', required: true, align: 'center', label: 'Proxy', field: 'proxied', sortable: true, visible: true, editable: true }, - { name: 'priority', required: true, align: 'center', label: 'Priorità', field: 'priority', sortable: true, visible: true }, + { name: 'priority', required: true, align: 'center', label: 'Pri', field: 'priority', sortable: true, visible: true }, { name: 'ttl', required: true, align: 'center', label: 'TTL', field: 'ttl', sortable: false, visible: true }, { name: 'content', required: true, label: 'Valore', align: 'left', field: 'content', sortable: true, visible: true, editable: true }, + { name: 'delete', required: true, label: 'Azioni', align: 'left', field: 'delete', sortable: true, visible: true }, ]; const pagination = { - rowsPerPage: 10, + rowsPerPage: 20, } watch(() => selectedApi.value, async (to: any, from: any) => { @@ -156,6 +175,76 @@ export default defineComponent({ arrDNS.value = await globalStore.getCloudFlareTok("getDNS", selectedApi.value, selZoneId.value) } + async function getEmails() { + arrEmails.value = [] + arrEmails.value = await globalStore.getMailInABox("getEmails", { domain: tools.getDomainSite() }) + } + + async function addEmailServer(email: string, pwd: string) { + + incaricamento.value = true + + const ris = await globalStore.getMailInABox("addEmail", { domain: tools.getDomainSite(), email, pwd }) + + if (ris) + tools.showPositiveNotif($q, ris) + else { + tools.showNegativeNotif($q, t('miab.err_addemail')) + } + + await checkDNSSite() + + incaricamento.value = false + + } + + async function setMailUserPassword(email: string, pwd: string) { + + incaricamento.value = true + + const ris = await globalStore.getMailInABox("setMailUserPassword", { domain: tools.getDomainSite(), email, pwd }) + + if (ris) + tools.showPositiveNotif($q, ris) + else { + tools.showNegativeNotif($q, t('miab.err_setmailuserpwd')) + } + + await checkDNSSite() + + incaricamento.value = false + + } + + async function removeEmails(email: String) { + $q.dialog({ + message: t('miab.deleteemail') + email + ' ?', + ok: { + label: t('dialog.yes'), + push: true, + }, + cancel: { + label: t('dialog.cancel'), + }, + title: 'Funzione:', + }).onOk(async () => { + + incaricamento.value = true + + const ris = await globalStore.getMailInABox("removeEmails", { domain: tools.getDomainSite(), email }) + + if (ris) + tools.showPositiveNotif($q, ris) + else { + tools.showNegativeNotif($q, t('miab.err_removed')) + } + + await checkDNSSite() + + incaricamento.value = false + }) + } + watch(() => selZoneId.value, async (to: any, from: any) => { if (selZoneId.value) { incaricamento.value = true @@ -375,11 +464,15 @@ export default defineComponent({ const getLabelSelApi = () => { const myrec = optionsApi.value.find((opt: any) => opt.value === selectedApi.value) return myrec ? myrec.label : '' - }; + } const getNameBySelZoneinId = () => { - const myrec = arrZones.value.find((zone: any) => zone.id === selZoneId.value) - return myrec ? myrec.name : '' - }; + if (arrZones.value) { + const myrec = arrZones.value.find((zone: any) => zone.id === selZoneId.value) + return myrec ? myrec.name : '' + } else { + return '' + } + } const getSelectedString = () => { return selected.value.length === 0 ? '' : `${selected.value[0].name} selezionata.` @@ -442,12 +535,16 @@ export default defineComponent({ const setCorrectIpsOnDNS = async () => { + incaricamento.value = true + let myrecord = { name: tools.getDomainSite() } await globalStore.getCloudFlareTok("setCorrectIpsOnDNS", selectedApi.value, selZoneId.value, null, myrecord) await checkDNSSite() + + incaricamento.value = false } @@ -469,6 +566,60 @@ export default defineComponent({ } + const delRecordDNS = async (row: any) => { + + $q.dialog({ + message: t('db.deletetherecord') + ' type = ' + row.type + ' ?', + ok: { + label: t('dialog.yes'), + push: true, + }, + cancel: { + label: t('dialog.cancel'), + }, + title: 'Funzione:', + }).onOk(async () => { + + const recupdated = await globalStore.getCloudFlareTok("delRecordDNS", selectedApi.value, selZoneId.value, row.id, null) + + if (recupdated) { + // update record + updateArrDns() + + tools.showPositiveNotif($q, t('db.deletedrecord')) + } else { + tools.showNegativeNotif($q, t('db.recfailed')) + } + }) + + } + + function getResultCheckDnsParam(title: string, recordReal: any, paramReal: string, strExpected: string) { + + let mystr = '' + try { + if (recordReal) { + const contentReal = recordReal[paramReal] + + if (strExpected !== contentReal) { + errorDNS.value = true + mystr += `${title}: NO
👉🏻 🔴 Attuale__: ${contentReal}
👉🏻 🔵 Aspettato: ${strExpected}
` + } else { + mystr += `${title}: 🟢 OK (${contentReal})
` + } + + } else { + errorDNS.value = true + mystr += `${title}: 🔴 N/A
` + } + } catch (error) { + mystr += `${title}: 🔴 N/A Errore nell\'estrazione del parametro ...
` + } + + return mystr + } + + async function checkDNSSite() { incaricamento.value = true await updateArrDns() @@ -478,35 +629,91 @@ export default defineComponent({ errorDNS.value = false const domainSite = tools.getDomainSite(); - const domains = [ - domainSite, - 'api.' + domainSite, - 'test.' + domainSite, - 'testapi.' + domainSite + const domainsData = [ + { url: domainSite, expected: globalStore.site.host_ip, type: 'A' }, + { url: 'api.' + domainSite, expected: globalStore.site.host_api_ip, type: 'A' }, + { url: 'test.' + domainSite, expected: globalStore.site.host_test_ip, type: 'A' }, + { url: 'testapi.' + domainSite, expected: globalStore.site.host_testapi_ip, type: 'A' }, + { url: 'www.' + domainSite, expected: domainSite, type: 'CNAME' } ]; - const ips = [ - globalStore.site.host_ip, - globalStore.site.host_api_ip, - globalStore.site.host_test_ip, - globalStore.site.host_testapi_ip - ]; + // Controllo DNS if (dnsPageActive.value) { let checkDomainA1 = ''; - errorDNS.value = false - for (let i = 0; i < domains.length; i++) { - let ris = tools.getHostPuntamento(arrDNS.value, domains[i], ips[i]!) - checkDomainA1 += ris.text + for (let i = 0; i < domainsData.length; i++) { + let ris = tools.getHostPuntamento(arrDNS.value, domainsData[i].url, domainsData[i].expected!, domainsData[i].type); + checkDomainA1 += ris.text; if (!ris.ok) { - errorDNS.value = true + errorDNS.value = true; } } - rischeckDNS.value = checkDomainA1 - } - incaricamento.value = false + let checkServerMailEnabled = '
'; + + if (globalStore.site.enable_servermail) { + // Controlla type MX + const mxRecord = arrDNS.value.find((record: any) => record.type === 'MX' && record.name === domainSite); + checkServerMailEnabled += getResultCheckDnsParam('Server mail enabled', mxRecord, 'content', globalStore.site.servermail!) + + // *** Controlla type TXT spf1 *** + let contentTXTspf1Expected = `v=spf1 a mx:${globalStore.site.servermail} ip4:${globalStore.site.servermailip} ~all`; + const mxRecordTXTspf1 = arrDNS.value.find((record: any) => record.type === 'TXT' && record.name === domainSite && (record.content.indexOf('v=spf1') > -1)) + + checkServerMailEnabled += getResultCheckDnsParam('TXT spf1 RECORD', mxRecordTXTspf1, 'content', contentTXTspf1Expected) + + let nameDkimtoFind = `mail._domainkey.${domainSite}`; + + // Controllo DKIM: + const mxRecordTXTDKIM = arrDNS.value.find((record: any) => record.type === 'TXT' && record.name === nameDkimtoFind) + let contentTXTDKIMExpected = `v=DKIM1; h=sha256; k=rsa; s=email; p=${globalStore.site.dkim}` + + checkServerMailEnabled += getResultCheckDnsParam('DKIM1', mxRecordTXTDKIM, 'content', contentTXTDKIMExpected) + + // Controllo DMARC: + const mxRecordTXTDMARC = arrDNS.value.find((record: any) => record.type === 'TXT' && record.name === `_dmarc.${domainSite}`) + let contentTXTMARCExpected = `v=DMARC1; p=quarantine; ruf=mailto:dmarc@${domainSite};`; + + checkServerMailEnabled += getResultCheckDnsParam('DMARC RECORD', mxRecordTXTDMARC, 'content', contentTXTMARCExpected) + + // Controlla autoconfig + const recAutoConfig = arrDNS.value.find((record: any) => record.type === 'CNAME' && record.name === `autoconfig.${domainSite}`); + checkServerMailEnabled += getResultCheckDnsParam('AutoConfig CNAME', recAutoConfig, 'content', globalStore.site.servermail!) + + // Controlla autodiscover + const recAutoDiscover = arrDNS.value.find((record: any) => record.type === 'CNAME' && record.name === `autodiscover.${domainSite}`); + checkServerMailEnabled += getResultCheckDnsParam('AutoDiscover CNAME', recAutoDiscover, 'content', globalStore.site.servermail!) + + await getEmails() + } + rischeckDNS.value = checkDomainA1 + checkServerMailEnabled + + incaricamento.value = false + } } + + async function addEmail() { + // Implementa qui la logica per aggiungere la nuova email + console.log('Aggiunta nuova email:', newEmail.value) + await addEmailServer(newEmail.value, newPassword.value) + + // Resetta i campi e chiudi il dialog + newEmail.value = '' + newPassword.value = '' + showNewEmail.value = false + } + + async function setMailUserPwd() { + // Implementa qui la logica per aggiungere la nuova email + await setMailUserPassword(emailSel.value, changePassword.value) + + // Resetta i campi e chiudi il dialog + emailSel.value = '' + changePassword.value = '' + showchangePwd.value = false + } + + onMounted(mounted) return { @@ -566,6 +773,21 @@ export default defineComponent({ globalStore, setCorrectIpsOnDNS, errorDNS, + delRecordDNS, + arrEmails, + removeEmails, + addEmail, + newEmail, + newPassword, + changeEmail, + changePassword, + showNewEmail, + showchangePwd, + isFormValid, + isPwd, + setMailUserPwd, + emailSel, + isFormValidChange, } }, }) diff --git a/src/views/admin/server/server.vue b/src/views/admin/server/server.vue index 45cb83f8..7eaaeb7a 100755 --- a/src/views/admin/server/server.vue +++ b/src/views/admin/server/server.vue @@ -71,6 +71,76 @@ @click="checkDNSSite" > +
+ + Caselle di Posta: + + + +
+ Nessuna casella di posta creata +
+ + + + + + + + {{ + email.slice(0, email.indexOf('@')) + }} + + + + + {{ email }} + + + + Leggi Email + + + + +
+ + + +
+
+
+
+
- + + + + + + + +
Aggiungi Nuova Casella Email
+
+ + + + + + + + + + + + +
+
+ + + +
Aggiorna Password Email
+
+ + + + + + + + + + + + +
+