sendNotificationREADME.md1 match
3This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
45This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!
67## Setup
ctanPackageNamesmain.tsx1 match
1export default async function(req: Request): Promise<Response> {
2const response = await fetch("https://ctan.org/json/2.0/packages");
3const packages = await response.json();
googleFeelingLuckymain.tsx6 matches
5"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
67export default async function(req: Request): Promise<Response> {
8const { searchParams } = new URL(req.url);
9const query = searchParams.get("q");
17}
1819export function search(query: string, userAgent = DEFAULT_USER_AGENT) {
20const searchUrl = createSearchUrl(query);
21return getRedirectUrl(searchUrl, userAgent);
22}
2324export function createSearchUrl(query: string, buttonName = "") {
25const searchURL = new URL("https://www.google.com/search");
26searchURL.searchParams.set("q", query);
29}
3031export async function getRedirectUrl(searchUrl: string | URL, userAgent = DEFAULT_USER_AGENT) {
32const resp = await ky.get(searchUrl, { headers: { "user-agent": userAgent } });
33const { searchParams } = new URL(resp.url);
36}
3738export async function signSearchUrl(searchUrl: string | URL) {
39const signedURL = new URL(searchUrl);
40const params = await getSearchParams();
43}
4445export async function getSearchParams(userAgent = DEFAULT_USER_AGENT) {
46await initParser();
47const html = await ky.get("https://www.google.com", { headers: { "user-agent": userAgent } }).text();
fetchWorkermain.tsx2 matches
6workerURL.searchParams.set("worker", "1");
78export async function fetchWorker(opts: {
9url: string;
10handler?: string;
83}
8485export function setupWorker() {
86let handler: (req: Request) => Promise<Response>;
87
userAgentsmain.tsx1 match
102];
103104export function getRandomUserAgent() {
105const i = Math.floor(Math.random() * USER_AGENTS.length);
106return USER_AGENTS[i];
9});
1011export default async function handler(request: Request) {
12if (request.method !== "POST") {
13return html(`
magentaMarlinmain.tsx1 match
2import { set } from "https://esm.town/v/std/set?v=11";
34export async function signGuestBook(message) {
5guestBook.unshift(message);
6await set("guestBook", guestBook);
codepen_debugmain.tsx1 match
1import { parseCodepen } from "https://esm.town/v/g/parseCodepen";
23export default async function(req: Request): Promise<Response> {
4const url = new URL(req.url);
5const id = url.pathname.slice(1);
1export default function(req: Request) {
2const url = new URL(req.url);
3if (!url.searchParams.has("url")) {