3 ms·
>These are both trivial, stateless 5-line scripts Would it be possible to share these scripts? I would love to see them, they sound really helpful/useful
by iameoghan 6y ago
>These are both trivial, stateless 5-line scripts
Would it be possible to share these scripts? I would love to see them, they sound really helpful/useful
- stickfigure 6y agoSure. Here's the help system one (no longer used since intercom now supports permissions, and I opened up the help system anyway): addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) }) async function handleRequest(request) { const cookie = request.headers.get('Cookie'); if (cookie && cookie.includes('foo=bar')) { return await fetch(request); } else { return new Response('You must log in before accessing this content'); } } The encrypted URL script is actually a bit longer than "5 lines" (it has been a while) so here's a gist: https://gist.github.com/stickfigure/af592b1ce7f888c5b8a4efbe5afb9d03 https://gist.github.com/stickfigure/af592b1ce7f888c5b8a4efbe...