aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/tools/tools/dmarc_reports/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/websites/tools/tools/dmarc_reports/app.js')
-rw-r--r--modules/private/websites/tools/tools/dmarc_reports/app.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/modules/private/websites/tools/tools/dmarc_reports/app.js b/modules/private/websites/tools/tools/dmarc_reports/app.js
index 7fe67d0..8e8a6c4 100644
--- a/modules/private/websites/tools/tools/dmarc_reports/app.js
+++ b/modules/private/websites/tools/tools/dmarc_reports/app.js
@@ -2,7 +2,7 @@ const app = new Vue({
2 el: '#app', 2 el: '#app',
3 data: { 3 data: {
4 info: null, 4 info: null,
5 summaries: [], 5 summaries: null,
6 selectedSummary: null, 6 selectedSummary: null,
7 filterGreen: true, 7 filterGreen: true,
8 filterDomain: null, 8 filterDomain: null,
@@ -10,16 +10,31 @@ const app = new Vue({
10 //filterDate: (new Date()).toISOString().substring(0, 7), 10 //filterDate: (new Date()).toISOString().substring(0, 7),
11 filterDate: null, 11 filterDate: null,
12 reverse: true, 12 reverse: true,
13 anonymous: true,
13 }, 14 },
14 created: async function () { 15 created: async function () {
15 let that = this; 16 let that = this;
16 17
17 try { 18 if ('anonymous' in localStorage) {
18 this.info = await this.getInfo(); 19 this.anonymous = JSON.parse(localStorage.anonymous);
19 this.summaries = this.info.summaries; 20 }
20 } catch (error) {} 21 this.fetchAll();
21 }, 22 },
22 methods: { 23 methods: {
24 fetchAll: async function() {
25 try {
26 this.info = await this.getInfo();
27 this.summaries = this.info.summaries;
28 } catch (error) {
29 this.info = null;
30 this.summaries = null;
31 }
32 },
33 toggleAnonymous: function() {
34 this.anonymous = !this.anonymous;
35 localStorage.anonymous = this.anonymous;
36 this.fetchAll();
37 },
23 filtered: function () { 38 filtered: function () {
24 let that = this; 39 let that = this;
25 let filtered = this.summaries.filter(function (summary) { 40 let filtered = this.summaries.filter(function (summary) {
@@ -53,7 +68,7 @@ const app = new Vue({
53 return mindate === this.filterDate || maxdate === this.filterDate; 68 return mindate === this.filterDate || maxdate === this.filterDate;
54 }, 69 },
55 printDate: function (date) { 70 printDate: function (date) {
56 return (new Date(date)).toISOString(); 71 return (new Date(date)).toISOString().replace("T", " ").replace(/\..*Z$/, " UTC");
57 }, 72 },
58 getColor: function (element) { 73 getColor: function (element) {
59 if (element.dkimresult === "fail" && element.spfresult === "fail") { 74 if (element.dkimresult === "fail" && element.spfresult === "fail") {
@@ -67,7 +82,8 @@ const app = new Vue({
67 } 82 }
68 }, 83 },
69 getInfo: function (event) { 84 getInfo: function (event) {
70 return fetch('api.php').then(function (response) { 85 let anonymous = this.anonymous ? "anonymous=1" : "";
86 return fetch(`api.php?${anonymous}`).then(function (response) {
71 if (response.status != 200) { return; } 87 if (response.status != 200) { return; }
72 return response.text().then(function (body) { 88 return response.text().then(function (body) {
73 return JSON.parse(body); 89 return JSON.parse(body);
@@ -75,7 +91,8 @@ const app = new Vue({
75 }); 91 });
76 }, 92 },
77 getDetails: function (serial) { 93 getDetails: function (serial) {
78 return fetch(`api.php?serial=${serial}`).then(function (response) { 94 let anonymous = this.anonymous ? "&anonymous=1" : "";
95 return fetch(`api.php?serial=${serial}${anonymous}`).then(function (response) {
79 if (response.status != 200) { return; } 96 if (response.status != 200) { return; }
80 return response.text().then(function (body) { 97 return response.text().then(function (body) {
81 return JSON.parse(body); 98 return JSON.parse(body);