ensure logged in script

master
Bel LaPointe 2022-01-10 10:25:00 -05:00
parent f4c4e9cfbc
commit 7f770b1a00
2 changed files with 42 additions and 0 deletions

23
testdata/ensure_logged_in.js vendored Normal file
View File

@ -0,0 +1,23 @@
// ==UserScript==
// @name NTGVision Logged In
// @namespace https://ntgvision.com/ *
// @description Ensure Login
// @include https://ntgvision.com/ *
// ==/UserScript==
// login on the login page
if (window.location.pathname == "/Account/Login") {
console.log("should login to login page")
setTimeout(() => {
var buttons = document.getElementsByTagName("button")
for(var i=0; i < buttons.length; i++) {
if (buttons[i].innerText.toLowerCase() == "login")
buttons[i].click()
}
}, 10000)
}
// refresh every hour
setTimeout(() => {
location.reload()
}, 1000 * 60 * 60)

19
testdata/scrape_cookies.sh vendored Normal file
View File

@ -0,0 +1,19 @@
#! /bin/bash
main() {
set -e
set -o pipefail
local cookie_original="/Users/breel/Library/Application Support/Firefox/Profiles/rek8wrhm.default-release/cookies.sqlite"
f=$(mktemp)
cleanup() ( rm -f "$f"; )
trap cleanup EXIT
cp "$cookie_original" "$f"
echo 'select name, value, expiry from moz_cookies where host like "%ntgvision%";' | sqlite3 "$f"
echo f=$f
}
if [ "$0" == "$BASH_SOURCE" ]; then
main "$@"
fi