pi-chrome 0.15.44 → 0.15.45
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.
|
@@ -734,10 +734,13 @@ export default function (pi: ExtensionAPI): void {
|
|
|
734
734
|
return chromeToolsActive(before);
|
|
735
735
|
};
|
|
736
736
|
|
|
737
|
-
const logChromeToolChange = (
|
|
737
|
+
const logChromeToolChange = (
|
|
738
|
+
action: "authorized" | "revoked" | "expired",
|
|
739
|
+
options: { label?: string; authorizedUntil?: number | "indefinite" } = {},
|
|
740
|
+
): void => {
|
|
738
741
|
const enabled = action === "authorized";
|
|
739
742
|
const content = enabled
|
|
740
|
-
? `Chrome tools enabled by /chrome authorize${label ? ` (${label})` : ""}.`
|
|
743
|
+
? `Chrome tools enabled by /chrome authorize${options.label ? ` (${options.label})` : ""}.`
|
|
741
744
|
: action === "expired"
|
|
742
745
|
? "Chrome tools disabled because /chrome authorize grant expired."
|
|
743
746
|
: "Chrome tools disabled by /chrome revoke.";
|
|
@@ -748,7 +751,7 @@ export default function (pi: ExtensionAPI): void {
|
|
|
748
751
|
details: {
|
|
749
752
|
action,
|
|
750
753
|
tools: [...CHROME_TOOL_NAMES],
|
|
751
|
-
authorizedUntil:
|
|
754
|
+
authorizedUntil: options.authorizedUntil,
|
|
752
755
|
at: Date.now(),
|
|
753
756
|
},
|
|
754
757
|
}, { triggerTurn: false });
|
|
@@ -767,7 +770,7 @@ export default function (pi: ExtensionAPI): void {
|
|
|
767
770
|
clearAuthExpiryTimer();
|
|
768
771
|
clearCountdownInterval();
|
|
769
772
|
const hadChromeTools = deactivateChromeTools();
|
|
770
|
-
if (logAction && hadChromeTools) logChromeToolChange(logAction);
|
|
773
|
+
if (logAction && hadChromeTools) logChromeToolChange(logAction, { authorizedUntil: undefined });
|
|
771
774
|
chromeAuthorizedUntil = undefined;
|
|
772
775
|
persistAuth();
|
|
773
776
|
// Revoking control ends pi-chrome's automation for this session; tidy up the target we own.
|
|
@@ -1066,7 +1069,7 @@ Usage rules:
|
|
|
1066
1069
|
chromeAuthorizedUntil = until;
|
|
1067
1070
|
persistAuth();
|
|
1068
1071
|
activateChromeTools();
|
|
1069
|
-
logChromeToolChange("authorized", label);
|
|
1072
|
+
logChromeToolChange("authorized", { label, authorizedUntil: until });
|
|
1070
1073
|
scheduleAuthExpiry(ctx, until);
|
|
1071
1074
|
ctx.ui.notify(`Chrome control authorized for ${label}.`, "info");
|
|
1072
1075
|
updateChromeStatus(ctx);
|
package/package.json
CHANGED