389
390export function setCookie(key: string, value: string) {
391 fetch("/", {
392 method: "POST",
393 body: JSON.stringify({ cookie: { key, value } }),
389 const profileId = parseInt(params.get('profile') || '1', 10);
390
391 // Fetch profile data
392 const profileResult = await sqlite.execute(
393 `SELECT * FROM ${profileTable} WHERE id = ?`,
401 const profile = profileResult.rows[0];
402
403 // Fetch visit count for the profile
404 const visitsResult = await sqlite.execute(
405 `SELECT COUNT(*) as visit_count FROM ${visitsTable} WHERE profile_id = ?`,
409 const visitCount = visitsResult.rows[0]?.visit_count || 0;
410
411 // Fetch friends (for demo, just show some fake friends)
412 const demoFriends = [
413 { id: 2, display_name: "Chris" },
420 ];
421
422 // Fetch comments
423 const commentsResult = await sqlite.execute(
424 `SELECT c.*, p.display_name as author_name
34 "integrity": "sha512-OF8fFQSkbL7vJY9rfuegK1R7sPgQ6kFMkDamiEccNUvieQ+3urzfDFI616oPl8V7T9zRmnTkSjMOImYCAVRVuw==",
35 "dependencies": [
36 "@libsql/isomorphic-fetch",
37 "@libsql/isomorphic-ws",
38 "js-base64",
39 "node-fetch"
40 ]
41 },
42 "@libsql/isomorphic-fetch@0.3.1": {
43 "integrity": "sha512-6kK3SUK5Uu56zPq/Las620n5aS9xJq+jMBcNSOmjhNf/MUvdyji4vrMTqD7ptY7/4/CAVEAYDeotUz60LNQHtw=="
44 },
95 "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw=="
96 },
97 "fetch-blob@3.2.0": {
98 "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
99 "dependencies": [
105 "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
106 "dependencies": [
107 "fetch-blob"
108 ]
109 },
128 "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="
129 },
130 "node-fetch@3.3.2": {
131 "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
132 "dependencies": [
133 "data-uri-to-buffer",
134 "fetch-blob",
135 "formdata-polyfill"
136 ]
44});
45
46// HTTP vals expect an exported "fetch handler"
47// This is how you "run the server" in Val Town with Hono
48export default app.fetch;
19 };
20 // console.log(req.headers);
21 await fetch(API, {
22 method: "POST",
23 body: JSON.stringify(data),
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
2
3export default {
4 fetch: handleRequest
5}
6
2
3export default {
4 fetch: handleRequest
5}
6
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS