22The first timestamp should be 0.`;
2324async function processAudio(audio_uri) {
25const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
26const opts = { cache_age: 60 * 60 * 24 * 7 };
9192// Render site
93export default async function(req: Request): Promise<Response> {
94const url = new URL(req.url);
95const audio_uri = url.searchParams.get("url");
400let currentChapterIndex = 0;
401402function updateText() {
403const currentTime = audioPlayer.currentTime;
404let segmentToDisplay = null;
515const updateInterval = 1000 / 40;
516517function updateLoop(timestamp) {
518if (timestamp - lastUpdateTime > updateInterval) {
519updateText();
httpValErrorCatchermain.tsx13 matches
6// Checks for minimum response size and presence of <html> tag.
78export default async function main(req: Request): Promise<Response> {
9const url = new URL(req.url);
10const valName = url.searchParams.get("val");
17// Dynamically import the specified val
18const module = await import(`https://esm.town/v/${valName}`);
19const valFunction = module.default;
2021if (typeof valFunction !== "function") {
22throw new Error("Imported val is not a function");
23}
2425// Execute the imported val function
26const response = await valFunction(req);
27const originalHtml = await response.text();
2842}
4344function injectErrorHandlingScript(html: string): string {
45const script = `
46<script>
47window.onerror = function(message, source, lineno, colno, error) {
48window.parent.postMessage({ messageType: "valBrowserRuntimeError", errorString: "window.onerror: " + message }, "*");
49};
50window.addEventListener('unhandledrejection', function(event) {
51window.parent.postMessage({ messageType: "valBrowserRuntimeError", errorString: "unhandledrejection: " + event.reason }, "*");
52});
53console.error = function(...args) {
54window.parent.postMessage({ messageType: "valBrowserRuntimeError", errorString: "console.error: " + args.join(' ') }, "*");
55};
56window.addEventListener('load', function() {
57setTimeout(function() {
58window.parent.postMessage({ messageType: "success" }, "*");
59}, 3000);
65}
6667function createErrorResponse(errorString: string): Response {
68const errorHtml = `
69<html>
crypto_prices_infomain.tsx1 match
55};
5657export default async function(interval) {
58const cryptoPrices = await getCryptoPrices();
59const formatted = formatCryptoPrices(cryptoPrices);
smallboatsapimain.tsx1 match
42console.log(jsonTable);
4344export default async function(req: Request): Promise<Response> {
45return new Response(JSON.stringify(jsonTable), {
46headers: { "Content-Type": "application/json" },
sqliteExplorerAppREADME.md1 match
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
1export default async function(req: Request) {
2return Response.json({ test: "Hello, world!", "import.meta.url": import.meta.url });
3}
streamwishmain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23function unpack(p, a, c, k) {
4while (c--) {
5if (k[c]) {
9return p;
10}
11function mat(r, l) {
12return r.exec(l);
13}
14export async function streamwish(ctx) {
15const _embed = await fetch(ctx.url);
16const embed = await _embed.text();
4const baseUrl = "https://d000d.com";
5import { blob } from "https://esm.town/v/std/blob";
6export async function doodstream(ctx: Context) {
7let url = ctx.url;
8if (ctx.url.includes("primewire")) {
68}
6970export async function format(ctx) {
71const url = ctx;
72return {
90};
91}
92export async function streamtape(ctx) {
93// const _ = await blob.get("streamtapeLimit");
94// if (Number(_) > 100000) throw new Error("limit reached");
128}
129130export async function streamium(ctx) {
131const _embed = await fetch(ctx.url);
132// https://pump.watchfree.ax/start-play?imdbid=tt11389872&name=apple&season=&episode=
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function(req: Request): Promise<Response> {
4if (req.method === "OPTIONS") {
5return new Response(null, {
htmlExamplemain.tsx1 match
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3const query = new URL(req.url).searchParams;
4