diff --git a/go.sh b/go.sh index 1c799a5..1a793d0 100755 --- a/go.sh +++ b/go.sh @@ -4,9 +4,9 @@ access_token=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlYiI6IkpiMnhrdzVWNUh0WE1XMU account_id=acc_00009OeBcb40RrGoHJQAwD dedupe_id=$RANDOM-lol current_pot_value=$(http "https://api.monzo.com/pots" "Authorization: Bearer $access_token" | jq ".pots[] | select(.id==\"$pot_id\") | .balance") -echo "there's currently $current_pot_value in the amex pot" +echo "there's currently $current_pot_value pennies in the amex pot" current_balance=$(($(node index.js) * 100)) -echo "the amex balance is $current_balance" +echo "the amex balance is $current_balance pennies" increase=$((current_balance - current_pot_value)) echo "that's an increase of $increase pennies" @@ -23,4 +23,4 @@ http --form PUT "https://api.monzo.com/pots/$pot_id/deposit" \ echo "transaction complete!!" current_pot_value=$(http "https://api.monzo.com/pots" "Authorization: Bearer $access_token" | jq ".pots[] | select(.id==\"$pot_id\") | .balance") -echo "there's now $current_pot_value in the pot ^_^" +echo "there's now $current_pot_value pennies in the pot ^_^" diff --git a/index.js b/index.js index 1a84c0e..5b64132 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,11 @@ -let pup = require("puppeteer") +let pup = require("puppeteer"); -void (async function() { - let puppy = await pup.launch({ headless: false }) +(async function() { + let puppy = await pup.launch({ + headless: !false, + args: ['--no-sandbox'], + timeout: 5000 + }) let bone = await puppy.newPage() await bone.goto( "https://global.americanexpress.com/login/en-GB?noRedirect=true&DestPage=%2Fdashboard" @@ -10,6 +14,10 @@ void (async function() { await bone.type(".eliloUserId input", "snootgirl22") await bone.waitForSelector(".eliloPassword input") await bone.type(".eliloPassword input", "magicfriend22") + await new Promise(resolve => setTimeout(resolve), 2000) + await bone.mouse.move(10, 20) + await bone.mouse.down() + await bone.mouse.up() await bone.click("[type=submit]") await bone.waitForSelector(".summary-container") await bone.waitForSelector( @@ -33,4 +41,7 @@ void (async function() { console.log(currentBalance) await puppy.close() -})() +})().catch(x => { + console.error(x) + process.exit(1) +}) diff --git a/package-lock.json b/package-lock.json index 5a893a6..edf3379 100644 --- a/package-lock.json +++ b/package-lock.json @@ -675,9 +675,9 @@ } }, "mime": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.2.tgz", - "integrity": "sha512-zJBfZDkwRu+j3Pdd2aHsR5GfH2jIWhmL1ZzBoc+X+3JEti2hbArWcyJ+1laC1D2/U/W1a/+Cegj0/OnEU2ybjg==" + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.3.tgz", + "integrity": "sha512-QgrPRJfE+riq5TPZMcHZOtm8c6K/yYrMbKIoRfapfiGLxS8OTeIfRhUGW5LU7MlRa52KOAGCfUNruqLrIBvWZw==" }, "mime-db": { "version": "1.40.0", @@ -914,9 +914,9 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "puppeteer": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.15.0.tgz", - "integrity": "sha512-D2y5kwA9SsYkNUmcBzu9WZ4V1SGHiQTmgvDZSx6sRYFsgV25IebL4V6FaHjF6MbwLK9C6f3G3pmck9qmwM8H3w==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.17.0.tgz", + "integrity": "sha512-3EXZSximCzxuVKpIHtyec8Wm2dWZn1fc5tQi34qWfiUgubEVYHjUvr0GOJojqf3mifI6oyKnCdrGxaOI+lWReA==", "requires": { "debug": "^4.1.0", "extract-zip": "^1.6.6", diff --git a/package.json b/package.json index d109c8e..4df423b 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,6 @@ "license": "ISC", "dependencies": { "amex": "0.0.1", - "puppeteer": "^1.15.0" + "puppeteer": "^1.17.0" } }