[push type] add ping parameter
This commit is contained in:
		
							parent
							
								
									9d079eeec0
								
							
						
					
					
						commit
						7fa1cb83af
					
				
					 3 changed files with 9 additions and 6 deletions
				
			
		|  | @ -20,6 +20,7 @@ router.get("/api/push/:pushToken", async (request, response) => { | |||
|     try { | ||||
|         let pushToken = request.params.pushToken; | ||||
|         let msg = request.query.msg || "OK"; | ||||
|         let ping = request.query.ping; | ||||
| 
 | ||||
|         let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [ | ||||
|             pushToken | ||||
|  | @ -34,9 +35,7 @@ router.get("/api/push/:pushToken", async (request, response) => { | |||
|         bean.time = R.isoDateTime(dayjs.utc()); | ||||
|         bean.status = UP; | ||||
|         bean.msg = msg; | ||||
| 
 | ||||
|         // TODO: HOW TO?
 | ||||
|         //bean.ping
 | ||||
|         bean.ping = ping; | ||||
| 
 | ||||
|         await R.store(bean); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| <template> | ||||
|     <div class="input-group mb-3"> | ||||
|     <div class="input-group"> | ||||
|         <input | ||||
|             :id="id" | ||||
|             ref="input" | ||||
|  |  | |||
|  | @ -48,6 +48,10 @@ | |||
|                             <div v-if="monitor.type === 'push' " class="my-3"> | ||||
|                                 <label for="push-url" class="form-label">{{ $t("Push URL") }}</label> | ||||
|                                 <CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" /> | ||||
|                                 <div class="form-text"> | ||||
|                                     You should call this url every {{ monitor.interval }} seconds.<br /> | ||||
|                                     Optional parameters: msg, ping | ||||
|                                 </div> | ||||
|                             </div> | ||||
| 
 | ||||
|                             <!-- Keyword --> | ||||
|  | @ -105,6 +109,7 @@ | |||
|                                 </div> | ||||
|                             </template> | ||||
| 
 | ||||
|                             <!-- Interval --> | ||||
|                             <div class="my-3"> | ||||
|                                 <label for="interval" class="form-label">{{ $t("Heartbeat Interval") }} ({{ $t("checkEverySecond", [ monitor.interval ]) }})</label> | ||||
|                                 <input id="interval" v-model="monitor.interval" type="number" class="form-control" required min="20" step="1"> | ||||
|  | @ -279,8 +284,7 @@ export default { | |||
|         }, | ||||
| 
 | ||||
|         pushURL() { | ||||
| 
 | ||||
|             return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?msg=OK"; | ||||
|             return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?msg=OK&ping="; | ||||
|         } | ||||
| 
 | ||||
|     }, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue