14};
15
16export function sendMail(to, subject, html) {
17 transport.sendMail({ ...options, to, subject, html });
18
1Simple function to provide the Email sending capability. The internal is limited to the `Pro` version only.
4import { html } from "https://esm.town/v/stevekrouse/html?v=5";
5
6export async function valReadme({ val, title }: {
7 val: { author: string; name: string };
8 title?: string;
15}
16
17export function serveReadme({ val, title }: {
18 val: { author: string; name: string };
19 title?: string;
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "shanghai"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
1export default async function (interval: Interval) {
2
3}
5const botProtectionAnswer = "0";
6
7export default async function(req: Request): Promise<Response> {
8 // Get the data from URL's query params
9 const url = new URL(req.url);
26}
27
28async function sendEmail(userContact, userData) {
29 userContact = decodeURIComponent(userContact);
30 // Email body should have userData part only if it's present in query params
41}
42
43function validateInputs(botProtectionInput, userContact) {
44 let isValid = true;
45 let errorMsg = "";
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "toowoomba city, australia"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
357
358 let next = PUA_START;
359 function nextAvailableCodePoint() {
360 while (usedCodes.has(next)) {
361 next += 1;
482};
483
484function bufferToBase64(buffer: ArrayBuffer) {
485 let binary = "";
486 const bytes = new Uint8Array(buffer);
493}
494
495export default async function(
496 req: Request,
497): Promise<Response> {
4
5// formats date in SQLITE format YYYY-MM-DD
6function formatDate(date: string) {
7 let [month, day, year] = date.split("/");
8 if (month.length == 1) month = "0" + month;
12
13// insert newsletter metadata in sqlite
14async function insertRow(articleNumber: number, title: string, date: string) {
15 try {
16 await sqlite.execute({
24
25// check if newsletter id exists
26async function checkNewsletterPresent(articleNumber: number) {
27 const data = await sqlite.execute({
28 sql: `SELECT EXISTS(SELECT 1 FROM newsletter WHERE article_number=:articleNumber)`,
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",