dsh-multi-router 0.5.5 → 0.5.7

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.
@@ -5393,7 +5393,7 @@ function workbuddyToken(token) {
5393
5393
  try {
5394
5394
  const [head, body, signature, extra] = token.split(".");
5395
5395
  const header = JSON.parse(Buffer.from(head, "base64url")), payload = JSON.parse(Buffer.from(body, "base64url"));
5396
- if (extra || !signature || header.alg !== "RS256" || payload.iss !== "https://www.codebuddy.cn/auth/realms/copilot" || typeof payload.sub !== "string" || !payload.sub) throw Error();
5396
+ if (extra || !signature || header.alg !== "RS256" || !["https://www.codebuddy.cn/auth/realms/copilot", "https://www.workbuddy.cn/auth/realms/copilot"].includes(payload.iss) || typeof payload.sub !== "string" || !payload.sub) throw Error();
5397
5397
  return payload;
5398
5398
  } catch {
5399
5399
  throw Object.assign(Error("HTTP 401 invalid_workbuddy_cn_token"), { status: 401 });
@@ -5402,7 +5402,7 @@ function workbuddyToken(token) {
5402
5402
  async function workbuddyPost(url, headers, signal, fetchImpl) {
5403
5403
  let response;
5404
5404
  try {
5405
- response = await fetchImpl(url, { method: "POST", headers: { "Content-Type": "application/json", "Accept-Encoding": "identity", ...headers }, body: "{}", signal });
5405
+ response = await fetchImpl(url, { method: "POST", headers: { "Content-Type": "application/json", "Accept-Encoding": "identity", ...headers }, body: "{}", signal, redirect: "error" });
5406
5406
  } catch {
5407
5407
  throw Object.assign(Error("workbuddy_checkin_network"), { transient: !signal?.aborted });
5408
5408
  }
@@ -5446,6 +5446,11 @@ function createWorkBuddyCheckin(credential, { fetchImpl = (...args) => fetch(...
5446
5446
  };
5447
5447
  return {
5448
5448
  identity: async () => ({ account: (await login()).uid }),
5449
+ validate: async (signal) => {
5450
+ const state = await post("checkin-activity-status", await login(), signal);
5451
+ if (![0, 200].includes(state?.code) || !state.data || typeof state.data.today_checked_in !== "boolean") throw Error("workbuddy_status_invalid");
5452
+ return { valid: true };
5453
+ },
5449
5454
  claim: async (signal) => {
5450
5455
  let submitted = false;
5451
5456
  try {
@@ -5491,6 +5496,7 @@ function createWorkBuddyCheckin(credential, { fetchImpl = (...args) => fetch(...
5491
5496
 
5492
5497
  export {
5493
5498
  qoderPluginDataDir,
5499
+ readLimitedText,
5494
5500
  supportsCheckin,
5495
5501
  Checkins,
5496
5502
  jsonCredential,
@@ -5498,7 +5504,8 @@ export {
5498
5504
  createAccountClient,
5499
5505
  claimTraeCheckin,
5500
5506
  createQoderCheckin,
5507
+ workbuddyToken,
5501
5508
  refreshWorkBuddyCheckinCredential,
5502
5509
  createWorkBuddyCheckin
5503
5510
  };
5504
- //# sourceMappingURL=chunk-EGLF4CWD.js.map
5511
+ //# sourceMappingURL=chunk-U2MU2M5C.js.map