mirror of
				https://api.glitch.com/git/presence-button
				synced 2025-10-31 23:35:34 +00:00 
			
		
		
		
	🏫😇 Checkpoint
./server.js:933874/10760
This commit is contained in:
		
							parent
							
								
									f35b91eb2e
								
							
						
					
					
						commit
						83b99ffea6
					
				
							
								
								
									
										11
									
								
								server.js
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								server.js
									
									
									
									
									
								
							| @ -108,10 +108,12 @@ request.post( | ||||
|     const accessToken = JSON.parse(body)["access_token"]; | ||||
|     const loop = () => { | ||||
|       console.log("loop", lastClosed); | ||||
|       if (fuzIsOpen && lastSeen < new Date() - closingTimeout && lastClosed < lastSeen) { | ||||
|       if ( | ||||
|         fuzIsOpen && | ||||
|         lastSeen < new Date() - closingTimeout && | ||||
|         lastClosed < lastSeen | ||||
|       ) { | ||||
|         // the Fuz is newly closed, notify on matrix and write file to survive reboot
 | ||||
|         lastClosed = new Date(); | ||||
|         //lastNofified = new Date();
 | ||||
|         //https.post ... send message to Fuz process.env.MATRIXROOM
 | ||||
|         request.put( | ||||
|           { | ||||
| @ -138,13 +140,14 @@ request.post( | ||||
|           function(error, response, body2) { | ||||
|             if (!error) { | ||||
|               try { | ||||
|                 lastClosed = new Date(); | ||||
|                 fs.writeFileSync( | ||||
|                   db, | ||||
|                   JSON.stringify({ fuzIsOpen, lastSeen, lastClosed }) | ||||
|                 ); | ||||
|               } catch (err) {} | ||||
|             } | ||||
|             console.log(body2) | ||||
|             console.log(body2); | ||||
|             setTimeout(loop, 10 * 1000); | ||||
|           } | ||||
|         ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user