Skip to content

Instantly share code, notes, and snippets.

@louisbarclay
louisbarclay / worker.js
Created December 15, 2023 14:15
Circumvent X Substack throttling
export default {
async fetch(request) {
// Get the URL
const url = new URL(request.url);
// url.pathname will be our pathname to use in the HTML doc
// Change this to whatever your Substack subdomain is:
const subdomain = "12challenges";
const html = `<!DOCTYPE html>
// Change this to suit your case!
// IMPORTANT: make sure there is no '/' at the end of either URL
const config = {
originPage: "view.flodesk.com/emails",
}
// Function that processes requests to the URL the worker is at
async function handleRequest(request) {
// Grab the request URL's pathname, we'll use it later
const url = new URL(request.url)
<script>
const originDomainAndPath = "view.flodesk.com/emails";
const superMailerDomain = "mailer.super.so";
async function createObserver() {
// Start observing the document
observeDoc();
// Observer function
function observeDoc() {
@louisbarclay
louisbarclay / roam-worker-script.js
Created January 20, 2021 21:40
Cloudflare worker script to put Roam Research public graph at custom domain
// Config for our domain (where we want the Roam blog to live)
// and the start page (where we want our readers to land)
// Change these to suit your case!
// IMPORTANT: don't have '/' at the end of either domain or startPage
const config = {
domain: "roam.cloak.ist",
startPage: "/#/app/nudge/page/RI01qJl4P",
}
// Function that processes requests to the domain the worker is at