@magpie-community/opencode-workbuddy-auth 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +14 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -15,7 +15,6 @@ import { homedir } from "node:os"
|
|
|
15
15
|
import { isAbsolute, join } from "node:path"
|
|
16
16
|
import { gzipSync } from "node:zlib"
|
|
17
17
|
|
|
18
|
-
const APP_VERSION = "2.0.0" // the version WorkBuddy's sign-in page is opened with
|
|
19
18
|
const POLL_MS = 1000
|
|
20
19
|
const SIGN_IN_MS = 5 * 60 * 1000
|
|
21
20
|
const EARLY_MS = 60 * 1000 // a token this close to its end is refreshed before a request
|
|
@@ -1755,7 +1754,12 @@ async function browserSignIn(site) {
|
|
|
1755
1754
|
if (!state?.state || !state?.authUrl) throw new Error(`${site.name} gave no sign-in page`)
|
|
1756
1755
|
const url = new URL(state.authUrl)
|
|
1757
1756
|
if (url.protocol !== "https:") throw new Error(`${site.name}'s sign-in page isn't https`)
|
|
1758
|
-
|
|
1757
|
+
// the desktop app's own version, as WorkBuddy desktop opens it
|
|
1758
|
+
// (openAuthUrl: version = CLIENT_INFO_PLUGIN_VERSION, the app's version).
|
|
1759
|
+
// The China build's page hides 企业微信 (WeCom) for a version under 5.8.0
|
|
1760
|
+
// (its signin-callback chunk: platform workbuddy and version >= "5.8.0"),
|
|
1761
|
+
// so the 2.0.0 sent before offered no WeCom sign-in (shenyebuwu on Discord)
|
|
1762
|
+
url.searchParams.set("version", site.app)
|
|
1759
1763
|
url.searchParams.set("loginSessionId", hex())
|
|
1760
1764
|
return {
|
|
1761
1765
|
url: url.toString(),
|
|
@@ -3909,6 +3913,14 @@ function makePlugin(site) {
|
|
|
3909
3913
|
const { runsOutAt, runsOut, ...counts } = more
|
|
3910
3914
|
const w = { ...creditWindow("Extra credits", counts), aside: true, ...(runsOutAt ? { runsOutAt, runsOut } : {}) }
|
|
3911
3915
|
out.windows.splice(out.windows.indexOf(credits) + 1, 0, w)
|
|
3916
|
+
// and, as with the split's, the soonest of them to lapse is
|
|
3917
|
+
// the account's too, on the window that stops it: routing
|
|
3918
|
+
// reads none set aside, so an account whose extra credits
|
|
3919
|
+
// expire first went unknown to it (Kayphoon on Discord)
|
|
3920
|
+
const at = runsOutAt ? Date.parse(runsOutAt) : 0
|
|
3921
|
+
const was = credits.runsOutAt ? Date.parse(credits.runsOutAt) : 0
|
|
3922
|
+
if (at > 0 && (!was || at < was)) Object.assign(credits, { runsOutAt, runsOut })
|
|
3923
|
+
else if (at > 0 && at === was) credits.runsOut = (credits.runsOut ?? 0) + runsOut
|
|
3912
3924
|
}
|
|
3913
3925
|
} catch {}
|
|
3914
3926
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-workbuddy-auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./opencode.mjs",
|