182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
15 e.preventDefault();
16 try {
17 const response = await fetch('/login', {
18 method: 'POST',
19 headers: { 'Content-Type': 'application/json' },
43
44 try {
45 const response = await fetch('/upload', {
46 method: 'POST',
47 body: formData
50 if (data.success) {
51 alert('File uploaded successfully');
52 fetchUploadedFiles();
53 }
54 } catch (error) {
59 const generateLoginCode = async () => {
60 try {
61 const response = await fetch('/generate-code', { method: 'POST' });
62 const data = await response.json();
63 setGeneratedCode(data.code);
67 };
68
69 const fetchUploadedFiles = async () => {
70 try {
71 const response = await fetch('/files');
72 const data = await response.json();
73 setUploadedFiles(data);
74 } catch (error) {
75 console.error('Failed to fetch files', error);
76 }
77 };
79 useEffect(() => {
80 if (isAdmin) {
81 fetchUploadedFiles();
82 }
83 }, [isAdmin]);
269 }
270
271 // Fetch files
272 if (request.method === 'GET' && new URL(request.url).pathname === '/files') {
273 const result = await sqlite.execute(`
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {
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({
10 const handleDownload = async () => {
11 try {
12 const response = await fetch('/download', {
13 method: 'POST',
14 headers: { 'Content-Type': 'application/json' },
121 }
122
123 // Fetch video using Instagram's public API
124 const igResponse = await fetch(url);
125 const html = await igResponse.text();
126
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({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({