From 6346565a1c248c5f302e6605eea01b8dde8d208f Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sat, 10 Apr 2021 20:28:19 +0200 Subject: [PATCH] Trying out cookie system --- src/platforms/csetforetell-fetch.js | 2 +- src/platforms/goodjudmentopen-fetch.js | 6 +++--- src/platforms/hypermind-fetch.js | 2 +- src/utils/addToHistory.js | 2 ++ src/utils/rebuildNetliftySiteWithNewData.js | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/platforms/csetforetell-fetch.js b/src/platforms/csetforetell-fetch.js index e7d7f5f..e1f6c80 100644 --- a/src/platforms/csetforetell-fetch.js +++ b/src/platforms/csetforetell-fetch.js @@ -176,5 +176,5 @@ async function csetforetell_inner(cookie){ export async function csetforetell(){ let cookie = process.env.CSETFORETELL_COOKIE || getCookie("csetforetell") - await applyIfCookieExists(csetforetell_inner, cookie) + await applyIfCookieExists(cookie, csetforetell_inner) } diff --git a/src/platforms/goodjudmentopen-fetch.js b/src/platforms/goodjudmentopen-fetch.js index 0c874c0..a062c19 100644 --- a/src/platforms/goodjudmentopen-fetch.js +++ b/src/platforms/goodjudmentopen-fetch.js @@ -180,7 +180,7 @@ async function goodjudgmentopen_inner(cookie) { console.log(`Took ${difference / 1000} seconds, or ${difference / (1000 * 60)} minutes.`) } -export async function goodjudmentopen(){ - let cookie = process.env.GOODJUDGMENTOPENCOOKIE || getCookie("goodjudgmentopen") - await applyIfCookieExists(goodjudgmentopen_inner, cookie) +export async function goodjudgmentopen(){ + let cookie = process.env.GOODJUDGMENTOPENCOOKIE || getCookie("goodjudmentopen") + await applyIfCookieExists(cookie, goodjudgmentopen_inner) } diff --git a/src/platforms/hypermind-fetch.js b/src/platforms/hypermind-fetch.js index 4f9dc8a..054d0d8 100644 --- a/src/platforms/hypermind-fetch.js +++ b/src/platforms/hypermind-fetch.js @@ -220,5 +220,5 @@ async function hypermind_inner(cookie) { export async function hypermind() { let cookie = process.env.HYPERMINDCOOKIE || getCookie("hypermind") - await applyIfCookieExists(hypermind_inner, cookie) + await applyIfCookieExists(cookie, hypermind_inner) } \ No newline at end of file diff --git a/src/utils/addToHistory.js b/src/utils/addToHistory.js index 5dbd282..1d69cdf 100644 --- a/src/utils/addToHistory.js +++ b/src/utils/addToHistory.js @@ -2,7 +2,9 @@ import { writeFileSync } from "fs" import { mongoReadWithReadCredentials, upsert } from "./mongo-wrapper.js" let mongoRead = mongoReadWithReadCredentials let isEmptyArray = arr => arr.length == 0 + export async function addToHistory(){ + // throw new Error("Not today") let currentJSON = await mongoRead("metaforecasts") // console.log(currentJSON) let historyJSON = await mongoRead("metaforecast_history") diff --git a/src/utils/rebuildNetliftySiteWithNewData.js b/src/utils/rebuildNetliftySiteWithNewData.js index 4d93c4a..b37a7d5 100644 --- a/src/utils/rebuildNetliftySiteWithNewData.js +++ b/src/utils/rebuildNetliftySiteWithNewData.js @@ -10,5 +10,5 @@ export async function rebuildNetlifySiteWithNewData_inner(cookie){ export async function rebuildNetlifySiteWithNewData(){ let cookie = process.env.REBUIDNETLIFYHOOKURL || getCookie("netlify"); - await applyIfCookieExists(rebuildNetlifySiteWithNewData_inner, cookie) + await applyIfCookieExists(cookie, rebuildNetlifySiteWithNewData_inner) } \ No newline at end of file