theguywhosucks commited on
Commit
ab9086c
·
verified ·
1 Parent(s): 69a0412

Upload 17 files

Browse files
Files changed (1) hide show
  1. dashboardlogic.js +8 -2
dashboardlogic.js CHANGED
@@ -487,13 +487,19 @@ async function handleUpload(input) {
487
  if (!client) {
488
  client = await Client.connect("pockit-cloud/main", opts);
489
  }
490
- const job = await client.submit("/upload_file_secure", {
 
 
 
 
 
 
 
491
  user_id: currentUser,
492
  password: currentPassword,
493
  filepath: file,
494
  custom_name: file.name,
495
  });
496
- const result = await job.result();
497
  console.debug('Upload response:', result);
498
  console.log('Uploaded:', file.name);
499
  // Update storage
 
487
  if (!client) {
488
  client = await Client.connect("pockit-cloud/main", opts);
489
  }
490
+ // Connect exactly as per docs; only pass token if present
491
+ const token = getWriteToken() || getReadToken() || '';
492
+ if (!client) {
493
+ client = token
494
+ ? await Client.connect("pockit-cloud/main", { hf_token: token })
495
+ : await Client.connect("pockit-cloud/main");
496
+ }
497
+ const result = await client.predict("/upload_file_secure", {
498
  user_id: currentUser,
499
  password: currentPassword,
500
  filepath: file,
501
  custom_name: file.name,
502
  });
 
503
  console.debug('Upload response:', result);
504
  console.log('Uploaded:', file.name);
505
  // Update storage