Skip to content

Commit

Permalink
update maintenance script & gitignore test.html (#173)
Browse files Browse the repository at this point in the history
* fix json

* remove lost members

* gitignore test.html

* Revert "remove lost members"

This reverts commit 51ff5d2.

* update maintenance workflow to run on main

* ensure browser closes

* revert action

* Maintain Webring

Maintain Webring

* Discard changes to members.json

* re-fix members json, remove bypass for site that is offline

* Maintain Webring

Maintain Webring

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
mrhappyma and github-actions[bot] authored Oct 10, 2024
1 parent ae9c8cb commit 9fd2787
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 317 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.vercel
test.html
33 changes: 16 additions & 17 deletions maintain.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ const webringLink = "https://webring.hackclub.com"
// webring link is present in the rendered HTML with stripped out comments

async function checkWithBrowser(url, webringLink) {
const browser = await puppeteer.launch({ headless: "new" })
const page = await browser.newPage()

await page.goto(url)

let content = await page.content()

content = content.replace(/<!--[\s\S]*?-->/g, "")

writeFileSync("test.html", content)

const containsLink = content.replace(/\s/g, "").includes(webringLink)

await browser.close()

return containsLink
const browser = await puppeteer.launch({ headless: "new" });
const page = await browser.newPage();

try {
await page.goto(url);
let content = await page.content();
content = content.replace(/<!--[\s\S]*?-->/g, "");
writeFileSync("test.html", content);
const containsLink = content.replace(/\s/g, "").includes(webringLink);
return containsLink;
} catch (error) {
console.error(`Error checking URL ${url}:`, error);
throw error;
} finally {
await browser.close();
}
}

async function main() {
Expand Down Expand Up @@ -123,7 +123,6 @@ async function main() {
console.error(chalk.red(` - ${e}`))
}
}

writeFileSync("public/members.json", JSON.stringify(activeMembers))
}

Expand Down
Loading

0 comments on commit 9fd2787

Please sign in to comment.