mirror of
https://github.com/Lomanic/presence-button-web
synced 2024-11-22 13:37:29 +00:00
🐕🎰 Checkpoint
./server.js:933874/10600
This commit is contained in:
parent
dafc13e090
commit
6e81ebcf6e
21
server.js
21
server.js
@ -104,7 +104,7 @@ request.post(
|
|||||||
},
|
},
|
||||||
function(error, response, body) {
|
function(error, response, body) {
|
||||||
console.log(body);
|
console.log(body);
|
||||||
const token = JSON.parse(body)["access_token"];
|
const accessToken = JSON.parse(body)["access_token"];
|
||||||
const loop = () => {
|
const loop = () => {
|
||||||
console.log("loop", lastClosed);
|
console.log("loop", lastClosed);
|
||||||
if (lastSeen < new Date() - 2 * 60 * 1000 && lastClosed < lastSeen) {
|
if (lastSeen < new Date() - 2 * 60 * 1000 && lastClosed < lastSeen) {
|
||||||
@ -112,7 +112,24 @@ request.post(
|
|||||||
lastClosed = new Date();
|
lastClosed = new Date();
|
||||||
//lastNofified = new Date();
|
//lastNofified = new Date();
|
||||||
//https.post ... send message to Fuz process.env.MATRIXROOM
|
//https.post ... send message to Fuz process.env.MATRIXROOM
|
||||||
|
request.put(
|
||||||
|
{
|
||||||
|
url:
|
||||||
|
"https://" +
|
||||||
|
process.env.MATRIXUSERNAME.substring(
|
||||||
|
process.env.MATRIXUSERNAME.indexOf(":") + 1
|
||||||
|
) +
|
||||||
|
"/_matrix/client/r0/rooms/" + process.env.MATRIXROOM + "/send/m.room.message/" + String(millis()) + "?access_token=" + accessToken + "&limit=1",
|
||||||
|
body: JSON.stringify({
|
||||||
|
msgtype: "m.text",
|
||||||
|
body: process.env.MATRIXMESSAGE
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(error, response, body) {}
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
db,
|
db,
|
||||||
|
Loading…
Reference in New Issue
Block a user