Versions
- Open: VersionChanges from v24 to v25+1-0⦚ 19 unchanged lines ⦚}
const hash = shortHash(contents);const previousHash = await blob.getJSON(KEY);if (!previousHash) {⦚ 13 unchanged lines ⦚⦚ 19 unchanged lines ⦚}// Derive hashes and compareconst hash = shortHash(contents);const previousHash = await blob.getJSON(KEY);if (!previousHash) {⦚ 13 unchanged lines ⦚ - Open: VersionChanges from v23 to v24+1-1import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";
const KEY = "website-contents-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";⦚ 29 unchanged lines ⦚import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";const URL = "https://www.vipshek.com/blog/product-engineer";const KEY = "website-contents-hash";const SUBJECT = "New contents detected";⦚ 29 unchanged lines ⦚ - Open: VersionChanges from v22 to v23+1-1import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";
const KEY = "new-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";⦚ 30 unchanged lines ⦚import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";const KEY = "website-contents-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";⦚ 30 unchanged lines ⦚ - Open: VersionChanges from v21 to v22+6-3⦚ 7 unchanged lines ⦚export const detectNewWebsiteContents = async () => {
let hash;try {const res = await fetch(URL, { redirect: "follow" });if (res.status !== 200) {console.log(`bad status code: ${res.status}`);}const contents = await res.text();hash = shortHash(contents);} catch (e) {console.log(`couldn't fetch: ${e}`);}const previousHash = await blob.getJSON(KEY);if (!previousHash) {await blob.setJSON(KEY, hash);} else if (hash !== previousHash) {await blob.setJSON(KEY, hash);await email({⦚ 7 unchanged lines ⦚⦚ 7 unchanged lines ⦚export const detectNewWebsiteContents = async () => {// Fetch contentslet contents;try {const res = await fetch(URL, { redirect: "follow" });if (res.status !== 200) {console.log(`bad status code: ${res.status}`);}contents = await res.text();} catch (e) {console.log(`couldn't fetch: ${e}`);}const hash = shortHash(contents);const previousHash = await blob.getJSON(KEY);if (!previousHash) {console.log(`no previous hash found. storing hash ${hash}`);await blob.setJSON(KEY, hash);} else if (hash !== previousHash) {console.log(`new hash found (prev: ${previousHash}, new: ${hash}). updating storage and emailing.`);await blob.setJSON(KEY, hash);await email({⦚ 7 unchanged lines ⦚ - Open: VersionChanges from v20 to v21+1-1import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";
const KEY = "miso-schedule-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";⦚ 27 unchanged lines ⦚import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";const KEY = "new-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";⦚ 27 unchanged lines ⦚ - Open: VersionChanges from v19 to v20+15-11⦚ 7 unchanged lines ⦚export const detectNewWebsiteContents = async () => {
try {const res = await fetch(URL, { redirect: "follow" });if (res.status !== 200) {console.log(`bad status code: ${res.status}`);}const contents = await res.text();const hash = shortHash(contents);const previousHash = await blob.getJSON(KEY);if (hash !== previousHash) {await blob.setJSON(KEY, hash);await email({subject: SUBJECT,text: `New website contents were detected at ${URL}`,});} else {console.log(`found matching hash ${hash}`);}} catch (e) {console.log(`couldn't fetch: ${e}`);}};⦚ 7 unchanged lines ⦚export const detectNewWebsiteContents = async () => {let hash;try {const res = await fetch(URL, { redirect: "follow" });if (res.status !== 200) {console.log(`bad status code: ${res.status}`);}const contents = await res.text();hash = shortHash(contents);} catch (e) {console.log(`couldn't fetch: ${e}`);}const previousHash = await blob.getJSON(KEY);if (!previousHash) {await blob.setJSON(KEY, hash);} else if (hash !== previousHash) {await blob.setJSON(KEY, hash);await email({subject: SUBJECT,text: `New website contents were detected at ${URL}`,});} else {console.log(`found matching hash ${hash}`);}}; - Open: VersionChanges from v18 to v19+1-1⦚ 6 unchanged lines ⦚const SUBJECT = "New contents detected";
export const detectNewMisoSchedule = async () => {try {const res = await fetch(URL, { redirect: "follow" });⦚ 19 unchanged lines ⦚⦚ 6 unchanged lines ⦚const SUBJECT = "New contents detected";export const detectNewWebsiteContents = async () => {try {const res = await fetch(URL, { redirect: "follow" });⦚ 19 unchanged lines ⦚ - Open: VersionChanges from v17 to v18+6-1import { blob } from "https://esm.town/v/std/blob";
import shortHash from "npm:short-hash";const KEY = "miso-schedule-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";export const detectNewMisoSchedule = async () => {⦚ 7 unchanged lines ⦚const previousHash = await blob.getJSON(KEY);if (hash !== previousHash) {console.log(`file contents changed. previous: ${previousHash}, new: ${hash}`);await blob.setJSON(KEY, hash);} else {console.log(`found matching hash ${hash}`);⦚ 5 unchanged lines ⦚import { blob } from "https://esm.town/v/std/blob";import { email } from "https://esm.town/v/std/email?v=9";import shortHash from "npm:short-hash";const KEY = "miso-schedule-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";const SUBJECT = "New contents detected";export const detectNewMisoSchedule = async () => {⦚ 7 unchanged lines ⦚const previousHash = await blob.getJSON(KEY);if (hash !== previousHash) {await blob.setJSON(KEY, hash);await email({subject: SUBJECT,text: `New website contents were detected at ${URL}`,});} else {console.log(`found matching hash ${hash}`);⦚ 5 unchanged lines ⦚ - Open: Version+25-0import { blob } from "https://esm.town/v/std/blob";import shortHash from "npm:short-hash";const KEY = "miso-schedule-hash";const URL = "https://cdn.misoenergy.org/Definitive%20Planning%20Phase%20Schedule629192.pdf";export const detectNewMisoSchedule = async () => {try {const res = await fetch(URL, { redirect: "follow" });if (res.status !== 200) {console.log(`bad status code: ${res.status}`);}const contents = await res.text();const hash = shortHash(contents);const previousHash = await blob.getJSON(KEY);if (hash !== previousHash) {console.log(`file contents changed. previous: ${previousHash}, new: ${hash}`);await blob.setJSON(KEY, hash);} else {console.log(`found matching hash ${hash}`);}} catch (e) {console.log(`couldn't fetch: ${e}`);}};
Updated: July 5, 2024