Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Liang-Shih Lin <liangshihlin@proton.me> Co-authored-by: Dominik Engelhardt <dominikengelhardt@ymail.com> Co-authored-by: Jay V <air@live.ca> Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
18 lines
590 B
TypeScript
18 lines
590 B
TypeScript
import { Global } from "../global"
|
|
import { lazy } from "../util/lazy"
|
|
import path from "path"
|
|
|
|
export const AuthCopilot = lazy(async () => {
|
|
const file = Bun.file(path.join(Global.Path.state, "plugin", "copilot.ts"))
|
|
const response = fetch("https://raw.githubusercontent.com/sst/opencode-github-copilot/refs/heads/main/auth.ts")
|
|
.then((x) => Bun.write(file, x))
|
|
.catch(() => {})
|
|
|
|
if (!file.exists()) {
|
|
const worked = await response
|
|
if (!worked) return
|
|
}
|
|
const result = await import(file.name!).catch(() => {})
|
|
if (!result) return
|
|
return result.AuthCopilot
|
|
})
|