1export default async function(req: Request) {
2const sourceUrl = `https://${new URL(req.url).hostname}`;
313];
1415function generateHtml(characters, sourceUrl) {
16return `<!DOCTYPE html>
17<html lang="en">
60];
6162async function initializeDatabase() {
63await sqlite.execute(`
64CREATE TABLE IF NOT EXISTS schema_meta (
152`;
153154function extractJson(rawContent: string): any {
155const jsonMatch = rawContent.match(/```json\n([\s\S]*?)\n```/);
156if (jsonMatch && jsonMatch[1]) {
160}
161162function generateHtml(sourceUrl: string) {
163const apiBaseUrl = sourceUrl.endsWith("/") ? `${sourceUrl}api` : `${sourceUrl}/api`;
164437438<script>
439(function() {
440const API_BASE_URL = '${apiBaseUrl}';
441const gameWindow = document.getElementById('game-window');
bsides-redirectmain.tsx1 match
1export default async function(req: Request): Promise<Response> {
2return Response.redirect("file:///var/flag/flag.txt.");
3}
1export default handler;
2export async function handler(request) {
3const uri = new URL(request.url);
4let url = uri.searchParams.get("url");
252627export function findRSS(url, res = undefined) {
28const feeds = [];
29function add(title, link) {
30feeds.push({
31"title": title,
1213const CONDUCT_POST_MORTEM_PROMPT = `
14You are the Monolith's core analyst. You will receive a JSON object containing a user's work history, including protocols and logged outputs from timed work blocks. Your function is to conduct a post-mortem analysis.
151. Calculate and present key performance indicators: total time focused, number of blocks completed, and average output per block where applicable.
162. Provide a dispassionate summary of performance, noting patterns of consistency or deviation.
21// --- APPLICATION SCAFFOLDING & UI ---
2223function generateHtml(sourceUrl) {
24const safeSourceUrl = sourceUrl.endsWith("/") ? sourceUrl : `${sourceUrl}/`;
25return `<!DOCTYPE html>
219220<script>
221(function() {
222const STORE_KEY = 'monolith_data_v1';
223const API_URL = '${safeSourceUrl}';
231const setStore = data => localStorage.setItem(STORE_KEY, JSON.stringify(data));
232233function formatDuration(ms) {
234if (!ms) return '0h 0m';
235const totalMinutes = Math.floor(ms / 60000);
239}
240241function renderProtocols() {
242const listEl = $('#protocol-list');
243if (!listEl) return;
273}
274275function renderModal(content) {
276const modalContainer = $('#modal-container');
277modalContainer.innerHTML = \`<div class="modal-overlay"><div class="modal-content">\${content}</div></div>\`;
279}
280281function closeModal() {
282$('#modal-container').classList.add('hidden');
283$('#modal-container').innerHTML = '';
284}
285286async function handleNewProtocolSubmit(e) {
287e.preventDefault();
288const form = e.target;
318}
319320function showNewProtocolForm() {
321renderModal(\`
322<h2>Define New Protocol</h2>
334}
335336function startWorkBlock(protocolId) {
337const protocol = state.protocols.find(p => p.id === protocolId);
338if (!protocol) return;
347}
348349function showFocusMode(protocolText) {
350const appContainer = $('#app-container');
351appContainer.classList.add('hidden');
375}
376
377function endWorkBlock() {
378if (!state.activeWorkBlock) return;
379clearInterval(state.activeWorkBlock.timerInterval);
419}
420
421async function showPostMortem() {
422renderModal('<h2>Conducting Post-Mortem Analysis...</h2>');
423try {
457}
458459function bindEventListeners() {
460$('#new-protocol-btn').addEventListener('click', showNewProtocolForm);
461$('#post-mortem-btn').addEventListener('click', showPostMortem);
480}
481482function init() {
483state = getStore();
484renderProtocols();
494495// --- BACKEND LOGIC ---
496export default async function(req: Request) {
497const url = new URL(req.url);
498const action = url.searchParams.get("action");
untitled-2418main.tsx5 matches
38];
3940async function initializeDatabase() {
41await sqlite.execute(`
42CREATE TABLE IF NOT EXISTS schema_meta (
99`;
100101function extractJson(rawContent: string): any {
102const jsonMatch = rawContent.match(/```json\n([\s\S]*?)\n```/);
103if (jsonMatch && jsonMatch[1]) {
109110// --- HTML & FRONTEND ---
111function generateHtml(sourceUrl: string) {
112return `<!DOCTYPE html>
113<html lang="en">
385386<script>
387(function() {
388const API_BASE_URL = '${sourceUrl.endsWith("/") ? sourceUrl : sourceUrl + "/"}';
389const gameWindow = document.getElementById('game-window');
408};
409410// Main render function based on application state
411const render = async (state) => {
412switch (state.view) {
simpletrickmain.tsx4 matches
7// --- DATABASE INITIALIZATION ---
8// Establishes the necessary database tables upon initial val execution.
9async function initializeDatabase() {
10await sqlite.batch([
11`CREATE TABLE IF NOT EXISTS users (
9798// --- HTML & FRONTEND ---
99function generateHtml(sourceUrl: string) {
100return `
101<!DOCTYPE html>
220221<script>
222(function() {
223const topicDisplay = document.getElementById('topic-display');
224const trickContainer = document.getElementById('trick-container');
229let isGenerating = false;
230231async function fetchAndDisplayTrick() {
232if (isGenerating) return;
233isGenerating = true;
1718// --- DATABASE INITIALIZATION & SEEDING ---
19async function initializeDatabase() {
20await sqlite.batch([
21`CREATE TABLE IF NOT EXISTS tours (
238239// --- UI: HTML & FRONTEND ---
240function generateHtml(baseURL: string) {
241return `<!DOCTYPE html>
242<html lang="en">
313</div>
314<script>
315(function() {
316// --- STATE MANAGEMENT ---
317const state = {
342const USER_ID_KEY = 'geo_narrate_user_id';
343344function showLoader(show) { elements.loader.classList.toggle('hidden', !show); }
345function showError(message) {
346console.error(message);
347elements.errorMessage.textContent = message;
350}
351352async function apiRequest(endpoint, options) {
353const response = await fetch(\`\${API_BASE}\${endpoint}\`, options);
354if (!response.ok) {
360361// --- RENDERING LOGIC ---
362function renderTourList() {
363let content = '<h2>Nearby Tours</h2>';
364if (state.nearbyTours.length === 0) {
385}
386387function renderTourDetail(tour) {
388state.currentTour = tour;
389const isPurchased = state.purchasedTours.has(tour.id);
427428// --- CORE LOGIC & EVENT HANDLERS ---
429async function init() {
430showLoader(true);
431state.audioPlayer = elements.audioPlayer;
454}
455456function setupMapAndFetchTours() {
457const { latitude, longitude } = state.userCoords;
458state.map = L.map(elements.mapContainer).setView([latitude, longitude], 14);
464}
465466async function fetchPurchasedTours() {
467try {
468const response = await apiRequest(\`/purchases/\${state.userId}\`, { method: 'GET' });
474}
475476async function fetchNearbyTours(lat, lon) {
477try {
478const response = await apiRequest('/tours', {
498}
499500async function purchaseTour(tourId) {
501showLoader(true);
502try {
514}
515
516async function playNarration(poi) {
517showLoader(true);
518elements.player.classList.remove('hidden');
1718// --- DATABASE INITIALIZATION & SEEDING ---
19async function initializeDatabase() {
20await sqlite.batch([
21`CREATE TABLE IF NOT EXISTS tours (
247248// --- HTML & FRONTEND ---
249function generateHtml(baseURL: string) {
250return `<!DOCTYPE html>
251<html lang="en">
306307<script>
308(function() {
309const API_BASE = '${baseURL}api';
310const USER_ID_KEY = 'geo_narrate_user_id';
329const $ = id => document.getElementById(id);
330331function showLoader(show) {
332if (show) {
333$('affirmation').textContent = affirmations[Math.floor(Math.random() * affirmations.length)];
336}
337338async function apiRequest(endpoint, options) {
339const response = await fetch(\`\${API_BASE}\${endpoint}\`, options);
340if (!response.ok) {
345}
346347async function init() {
348audioPlayer = $('audio-player');
349showLoader(true);
363}
364
365function setupMap(lat, lon) {
366map = L.map('map').setView([lat, lon], 14);
367L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
371}
372373async function fetchPurchasedTours() {
374try {
375const response = await apiRequest(\`/purchases/\${userId}\`, { method: 'GET' });
381}
382383async function fetchNearbyTours(lat, lon) {
384try {
385const response = await apiRequest('/tours', {
396}
397398function renderTours(tours) {
399const listEl = $('tour-list');
400listEl.innerHTML = '<h2>Nearby Tours</h2>';
422}
423424function selectTour(tour) {
425currentTour = tour;
426const listEl = $('tour-list');
446}
447448function renderPoiList(tour) {
449const poiListEl = $('poi-list');
450poiListEl.innerHTML = '<h3>Points of Interest</h3>';
459}
460461async function purchaseTour(tourId) {
462showLoader(true);
463try {
476}
477
478async function playNarration(poi) {
479showLoader(true);
480$('player').classList.remove('hidden');
502}
503504function showError(message) {
505console.error(message);
506showLoader(false);
birdfactsindex.html19 matches
258const API_BASE = window.location.origin;
259
260async function getRandomBird() {
261const region = document.getElementById('regionInput').value.trim();
262const lat = document.getElementById('latInput').value.trim();
277}
278
279async function getBirdByName() {
280const birdName = document.getElementById('birdNameInput').value.trim();
281if (!birdName) {
288}
289
290async function fetchAndDisplayBird(url) {
291const loading = document.getElementById('loading');
292const results = document.getElementById('results');
315}
316
317function displayBirdFact(bird) {
318const results = document.getElementById('results');
319
368}
369
370async function getQuickFacts() {
371const count = document.getElementById('countSelect').value;
372const category = document.getElementById('categorySelect').value;
403}
404
405async function getFactsStats() {
406try {
407const response = await fetch(`${API_BASE}/api/facts/stats`);
419}
420
421async function triggerCollection() {
422if (!confirm('This will trigger a manual facts collection. It may take a few minutes. Continue?')) {
423return;
447}
448
449function displayQuickFacts(data) {
450const results = document.getElementById('results');
451
502}
503
504function displayFactsStats(stats) {
505const results = document.getElementById('results');
506
549results.insertBefore(statsCard, results.firstChild);
550}
551function getMyLocation() {
552if (!navigator.geolocation) {
553alert('Geolocation is not supported by this browser');
601}
602
603async function getTopSuperlativeFacts() {
604const count = document.getElementById('superlativeCountSelect').value;
605
630}
631
632async function getSuperlativeStats() {
633try {
634const response = await fetch(`${API_BASE}/api/facts/superlative/stats`);
646}
647
648function displaySuperlativeFacts(data) {
649const results = document.getElementById('results');
650
718}
719
720function displayTopSuperlativeFacts(data) {
721const results = document.getElementById('results');
722
745}
746
747function displaySuperlativeStats(stats) {
748const results = document.getElementById('results');
749
808results.insertBefore(statsCard, results.firstChild);
809}
810async function testLLMSimple() {
811const loading = document.getElementById('loading');
812const results = document.getElementById('results');
835}
836
837function displaySimpleLLMTest(data) {
838const results = document.getElementById('results');
839
920results.insertBefore(testCard, results.firstChild);
921}
922async function testLLMFiltering() {
923if (!confirm('This will run a comprehensive test of the LLM filtering system. It may take 2-3 minutes. Continue?')) {
924return;
989}
990
991async function showAPIResponse() {
992try {
993const response = await fetch(`${API_BASE}/api/birds/random`);