File size: 595 Bytes
46d9e41
 
 
 
 
 
5d3283b
 
46d9e41
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Runs in oauth.html, the page Hugging Face redirects the sign-in popup to.
import { completeSignIn } from "./hf-auth.js";

const title = document.getElementById("title");
const msg = document.getElementById("msg");
try {
  const r = await completeSignIn();
  title.textContent = `Signed in${r.name ? ` as ${r.name}` : ""}`;
  title.className = "ok";
  msg.textContent = "You can close this window and go back to LocalWebAgent.";
  setTimeout(() => window.close(), 700);
} catch (err) {
  title.textContent = "Sign-in didn't work";
  title.className = "bad";
  msg.textContent = err.message;
}