1export const dailySlackRoundup = async () => {
2 const res = await fetch(process.env.BRAINBOT_WEBHOOK_URL, {
3 method: "POST",
4 body: JSON.stringify({
33
34 try {
35 const response = await fetch("/book", {
36 method: "POST",
37 headers: { "Content-Type": "application/json" },
58
59 useEffect(() => {
60 async function fetchWritings() {
61 try {
62 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
69 setWritings(result.rows);
70 } catch (error) {
71 console.error("Error fetching writings:", error);
72 }
73 }
74
75 fetchWritings();
76 }, []);
77
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
12
13 useEffect(() => {
14 fetchFiles();
15 }, [currentPath]);
16
17 const fetchFiles = async () => {
18 try {
19 const response = await fetch(`/list-files?path=${encodeURIComponent(currentPath)}`);
20 const fileList = await response.json();
21 setFiles(fileList.sort((a, b) => {
26 }));
27 } catch (error) {
28 console.error('Error fetching files:', error);
29 }
30 };
34
35 try {
36 const response = await fetch('/create-folder', {
37 method: 'POST',
38 headers: { 'Content-Type': 'application/json' },
44
45 if (response.ok) {
46 fetchFiles();
47 setNewFileName('');
48 }
61
62 try {
63 const response = await fetch('/upload-file', {
64 method: 'POST',
65 body: formData
67
68 if (response.ok) {
69 fetchFiles();
70 }
71 } catch (error) {
89 const deleteItem = async (itemName, isFolder) => {
90 try {
91 const response = await fetch('/delete-item', {
92 method: 'POST',
93 headers: { 'Content-Type': 'application/json' },
100
101 if (response.ok) {
102 fetchFiles();
103 setSelectedFiles([]);
104 }
12
13 useEffect(() => {
14 fetchFiles();
15 }, [currentPath]);
16
17 const fetchFiles = async () => {
18 try {
19 const response = await fetch(`/list-files?path=${encodeURIComponent(currentPath)}`);
20 const fileList = await response.json();
21 setFiles(fileList.sort((a, b) => {
26 }));
27 } catch (error) {
28 console.error('Error fetching files:', error);
29 }
30 };
34
35 try {
36 const response = await fetch('/create-folder', {
37 method: 'POST',
38 headers: { 'Content-Type': 'application/json' },
44
45 if (response.ok) {
46 fetchFiles();
47 setNewFileName('');
48 }
61
62 try {
63 const response = await fetch('/upload-file', {
64 method: 'POST',
65 body: formData
67
68 if (response.ok) {
69 fetchFiles();
70 }
71 } catch (error) {
89 const deleteItem = async (itemName, isFolder) => {
90 try {
91 const response = await fetch('/delete-item', {
92 method: 'POST',
93 headers: { 'Content-Type': 'application/json' },
100
101 if (response.ok) {
102 fetchFiles();
103 setSelectedFiles([]);
104 }
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({