theguywhosucks commited on
Commit
ae3a709
·
verified ·
1 Parent(s): 4f771b1

Upload 17 files

Browse files
Files changed (2) hide show
  1. dashboardlogic.js +5 -10
  2. server.js +0 -21
dashboardlogic.js CHANGED
@@ -363,17 +363,12 @@ async function deleteFile(id) {
363
 
364
  try {
365
  loading(true);
366
- const resp = await fetch('/api/delete', {
367
- method: 'POST',
368
- headers: { 'Content-Type': 'application/json' },
369
- body: JSON.stringify({
370
- user_id: currentUser,
371
- password: currentPassword,
372
- filename: file.name,
373
- }),
374
  });
375
- if (!resp.ok) throw new Error('Delete HTTP ' + resp.status);
376
- const result = await resp.json();
377
 
378
  console.log('Deleted:', file.name);
379
 
 
363
 
364
  try {
365
  loading(true);
366
+ const client = await Client.connect("pockit-cloud/main");
367
+ const result = await client.predict("/delete_file_secure", {
368
+ user_id: currentUser,
369
+ password: currentPassword,
370
+ filename: file.name,
 
 
 
371
  });
 
 
372
 
373
  console.log('Deleted:', file.name);
374
 
server.js CHANGED
@@ -91,27 +91,6 @@ app.post("/api/upload", upload.single("file"), async (req, res) => {
91
  }
92
  });
93
 
94
- app.post("/api/delete", async (req, res) => {
95
- const { user_id, password, filename } = req.body || {};
96
-
97
- if (!user_id || !password || !filename) {
98
- return res.status(400).json({ error: "Missing user_id, password, or filename" });
99
- }
100
-
101
- try {
102
- const client = await Client.connect("pockit-cloud/main", { hf_token: HF_TOKEN });
103
- const result = await client.predict("/delete_file_secure", {
104
- user_id,
105
- password,
106
- filename,
107
- });
108
- res.json({ data: result.data });
109
- } catch (err) {
110
- console.error("Delete error:", err);
111
- res.status(500).json({ error: "Delete failed", details: err.message });
112
- }
113
- });
114
-
115
  app.use(express.static("."));
116
 
117
  app.listen(PORT, () => {
 
91
  }
92
  });
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  app.use(express.static("."));
95
 
96
  app.listen(PORT, () => {