-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeepalive.user.js
More file actions
34 lines (31 loc) · 1.02 KB
/
keepalive.user.js
File metadata and controls
34 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name UW Session Keepalive
// @namespace https://raymond.li/
// @version 0.1
// @license GNU GPL v3
// @description Automatically sends a POST request to LEARN every hour to keep your session alive.
// @author Raymond Li <[email protected]>
// @match https://learn.uwaterloo.ca/*
// @grant none
// @updateURL https://github.com/Raymo111/uwaterloo-userscripts/raw/master/keepalive.user.js
// @downloadURL https://github.com/Raymo111/uwaterloo-userscripts/raw/master/keepalive.user.js
// ==/UserScript==
var initialLoad = true;
function learn_keepalive() {
if (initialLoad) {
initialLoad = false;
return;
}
fetch("/d2l/lp/auth/session/extend", {
method: "POST",
body: ""
}).then(res => {
console.log("Session extended:", res);
});
}
(function() {
'use strict';
if (window.location.href.indexOf("https://learn.uwaterloo.ca/d2l") !== -1) {
setInterval(learn_keepalive(), 1000 * 60 * 60);
}
})();