48 setIsLoadingConversations(true);
49 try {
50 const response = await fetch('/api/conversations');
51 if (response.ok) {
52 const data = await response.json();
63 setIsLoadingConversation(true);
64 try {
65 const response = await fetch(`/api/conversations/${id}`);
66 if (response.ok) {
67 const data = await response.json();
77 const loadConversationParticipants = async (conversationId: number) => {
78 try {
79 const response = await fetch(`/api/conversations/${conversationId}/participants`);
80 if (response.ok) {
81 const participants = await response.json();
105
106 try {
107 const response = await fetch(`/api/conversations/${id}`, {
108 method: 'DELETE'
109 });
131
132 try {
133 const response = await fetch('/api/chat', {
134 method: 'POST',
135 headers: {
25 const loadParticipants = async () => {
26 try {
27 const response = await fetch(`/api/conversations/${conversationId}/participants`);
28 if (response.ok) {
29 const data = await response.json();
43
44 try {
45 const response = await fetch(`/api/conversations/${conversationId}/participants/${userId}`, {
46 method: 'DELETE'
47 });
23 const loadInviteDetails = async () => {
24 try {
25 const response = await fetch(`/api/invites/${token}`);
26
27 if (!response.ok) {
45
46 try {
47 const response = await fetch(`/api/invites/${token}/accept`, {
48 method: 'POST'
49 });
32 const inviteRequest: InviteRequest = { email: email.trim() };
33
34 const response = await fetch(`/api/conversations/${conversationId}/invite`, {
35 method: 'POST',
36 headers: {
67
68// Wrap with lastlogin authentication
69export default lastlogin(app.fetch);
38 const u = new URL("./announcePeer", myBaseUrl);
39 u.search = "?id=".concat(myid);
40 fetch(u).then((resp) => {
41 return resp.json();
42 }).then((others) => {
71
72 // ---- Exchange JWT for access token ----
73 const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
74 method: "POST",
75 headers: { "Content-Type": "application/x-www-form-urlencoded" },
89
90 // ---- Query Firestore publicLenses ----
91 const pubDocRes = await fetch(
92 `https://firestore.googleapis.com/v1/projects/${projectId}/databases/(default)/documents/publicLenses/${id}`,
93 { headers: { Authorization: `Bearer ${access_token}` } },
105
106 // ---- Query Firestore private user doc ----
107 const privDocRes = await fetch(
108 `https://firestore.googleapis.com/v1/projects/${projectId}/databases/(default)/documents/users/${owner}/lenses/${id}`,
109 { headers: { Authorization: `Bearer ${access_token}` } },
262async function imageToBase64(imageUrl: string): Promise<{ data: string; mimeType: string }> {
263 try {
264 const response = await fetch(imageUrl, { timeout: 8000 });
265 if (!response.ok) {
266 throw new Error(`Failed to fetch image: ${response.status}`);
267 }
268 const arrayBuffer = await response.arrayBuffer();
309
310 const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311 const response = await fetch(url, {
312 method: "POST",
313 headers: config.headers,
2
3The simplest way to embed a Bible reader in your website or app using an iframe,
4made freely available by [fetch(bible)](https://fetch.bible/access/app/)
5
6fetch(bible) reader was created by Jon at [Gracious.Tech](https://Gracious.Tech)
5app.get("/", (c) => {
6 return c.html(
7 `<iframe src="https://app.fetch.bible" style="position:fixed;width:100vw;height:100vh;top:0;left:0;border:none;"></iframe>`,
8 );
9});
10
11export default app.fetch;