|  | @ -5,7 +5,7 @@ var timezone = require('dayjs/plugin/timezone') | 
			
		
	
		
		
			
				
					|  |  | dayjs.extend(utc) |  |  | dayjs.extend(utc) | 
			
		
	
		
		
			
				
					|  |  | dayjs.extend(timezone) |  |  | dayjs.extend(timezone) | 
			
		
	
		
		
			
				
					|  |  | const axios = require("axios"); |  |  | const axios = require("axios"); | 
			
		
	
		
		
			
				
					
					|  |  | const {tcping, ping} = require("../util-server"); |  |  | const {tcping, ping, checkCertificate} = require("../util-server"); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | const {R} = require("redbean-node"); |  |  | const {R} = require("redbean-node"); | 
			
		
	
		
		
			
				
					|  |  | const {BeanModel} = require("redbean-node/dist/bean-model"); |  |  | const {BeanModel} = require("redbean-node/dist/bean-model"); | 
			
		
	
		
		
			
				
					|  |  | const {Notification} = require("../notification") |  |  | const {Notification} = require("../notification") | 
			
		
	
	
		
		
			
				
					|  | @ -74,6 +74,9 @@ class Monitor extends BeanModel { | 
			
		
	
		
		
			
				
					|  |  |                     }) |  |  |                     }) | 
			
		
	
		
		
			
				
					|  |  |                     bean.msg = `${res.status} - ${res.statusText}` |  |  |                     bean.msg = `${res.status} - ${res.statusText}` | 
			
		
	
		
		
			
				
					|  |  |                     bean.ping = dayjs().valueOf() - startTime; |  |  |                     bean.ping = dayjs().valueOf() - startTime; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     if (this.url.startsWith("https")) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         Monitor.sendCertInfo(checkCertificate(res), io, this.id, this.user_id); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |                     if (this.type === "http") { |  |  |                     if (this.type === "http") { | 
			
		
	
		
		
			
				
					|  |  |                         bean.status = 1; |  |  |                         bean.status = 1; | 
			
		
	
	
		
		
			
				
					|  | @ -189,6 +192,14 @@ class Monitor extends BeanModel { | 
			
		
	
		
		
			
				
					|  |  |         io.to(userID).emit("avgPing", monitorID, avgPing); |  |  |         io.to(userID).emit("avgPing", monitorID, avgPing); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					|  |  |  |  |  |      * | 
			
		
	
		
		
			
				
					|  |  |  |  |  |      * @param checkCertificateResult : Object return result of checkCertificate | 
			
		
	
		
		
			
				
					|  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |      static async sendCertInfo(checkCertificateResult, io, monitorID, userID) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         io.to(userID).emit("certInfo", monitorID, checkCertificateResult); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					|  |  |      * Uptime with calculation |  |  |      * Uptime with calculation | 
			
		
	
		
		
			
				
					|  |  |      * Calculation based on: |  |  |      * Calculation based on: | 
			
		
	
	
		
		
			
				
					|  | 
 |