aboutsummaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorTianren Dong <tianrendong.dtr@gmail.com>2026-07-07 01:18:11 -0400
committerTianren Dong <tianrendong.dtr@gmail.com>2026-07-07 01:18:11 -0400
commit7fcc851d89bf1db4e188d81ca84362a3f4a8cbed (patch)
treeb830c0bedd49e5461cb30646180818167dc6ca06 /extensions
parent132c106bb924cf9ae318ba425e5607d2721f662a (diff)
Record Chrome tool authorization state explicitly
Diffstat (limited to 'extensions')
-rw-r--r--extensions/chrome-profile-bridge/browser-extension/manifest.json2
-rw-r--r--extensions/chrome-profile-bridge/index.ts13
2 files changed, 9 insertions, 6 deletions
diff --git a/extensions/chrome-profile-bridge/browser-extension/manifest.json b/extensions/chrome-profile-bridge/browser-extension/manifest.json
index fcd489f..c3753e7 100644
--- a/extensions/chrome-profile-bridge/browser-extension/manifest.json
+++ b/extensions/chrome-profile-bridge/browser-extension/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Pi Chrome Connector",
- "version": "0.15.44",
+ "version": "0.15.45",
"description": "Lets Pi control tabs in Chrome via a local connector at 127.0.0.1.",
"permissions": [
"tabs",
diff --git a/extensions/chrome-profile-bridge/index.ts b/extensions/chrome-profile-bridge/index.ts
index 8185dfb..a57d1a9 100644
--- a/extensions/chrome-profile-bridge/index.ts
+++ b/extensions/chrome-profile-bridge/index.ts
@@ -734,10 +734,13 @@ export default function (pi: ExtensionAPI): void {
return chromeToolsActive(before);
};
- const logChromeToolChange = (action: "authorized" | "revoked" | "expired", label?: string): void => {
+ const logChromeToolChange = (
+ action: "authorized" | "revoked" | "expired",
+ options: { label?: string; authorizedUntil?: number | "indefinite" } = {},
+ ): void => {
const enabled = action === "authorized";
const content = enabled
- ? `Chrome tools enabled by /chrome authorize${label ? ` (${label})` : ""}.`
+ ? `Chrome tools enabled by /chrome authorize${options.label ? ` (${options.label})` : ""}.`
: action === "expired"
? "Chrome tools disabled because /chrome authorize grant expired."
: "Chrome tools disabled by /chrome revoke.";
@@ -748,7 +751,7 @@ export default function (pi: ExtensionAPI): void {
details: {
action,
tools: [...CHROME_TOOL_NAMES],
- authorizedUntil: chromeAuthorizedUntil,
+ authorizedUntil: options.authorizedUntil,
at: Date.now(),
},
}, { triggerTurn: false });
@@ -767,7 +770,7 @@ export default function (pi: ExtensionAPI): void {
clearAuthExpiryTimer();
clearCountdownInterval();
const hadChromeTools = deactivateChromeTools();
- if (logAction && hadChromeTools) logChromeToolChange(logAction);
+ if (logAction && hadChromeTools) logChromeToolChange(logAction, { authorizedUntil: undefined });
chromeAuthorizedUntil = undefined;
persistAuth();
// Revoking control ends pi-chrome's automation for this session; tidy up the target we own.
@@ -1066,7 +1069,7 @@ Usage rules:
chromeAuthorizedUntil = until;
persistAuth();
activateChromeTools();
- logChromeToolChange("authorized", label);
+ logChromeToolChange("authorized", { label, authorizedUntil: until });
scheduleAuthExpiry(ctx, until);
ctx.ui.notify(`Chrome control authorized for ${label}.`, "info");
updateChromeStatus(ctx);