From cf722d23a7faf1675740feeafc1c3a782346abf6 Mon Sep 17 00:00:00 2001 From: qcrao Date: Thu, 11 Jul 2024 22:56:37 +0800 Subject: [PATCH] solve public functions by Claude.ai --- manifest.json | 1 + popup.html | 1 + utils.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 utils.js diff --git a/manifest.json b/manifest.json index 0534372..3d62bff 100644 --- a/manifest.json +++ b/manifest.json @@ -21,6 +21,7 @@ "matches": ["*://chat.openai.com/*"], "js": [ "globals.js", + "utils.js", "addCheckboxes.js", "bulkDeleteConversations.js", "bulkArchiveConversations.js" diff --git a/popup.html b/popup.html index b7ece00..9b3f271 100644 --- a/popup.html +++ b/popup.html @@ -64,5 +64,6 @@ + diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..3f5456c --- /dev/null +++ b/utils.js @@ -0,0 +1,14 @@ +function getUserInfo() { + return new Promise((resolve) => { + chrome.identity.getProfileUserInfo({ accountStatus: "ANY" }, (userInfo) => { + if (chrome.runtime.lastError) { + console.error(chrome.runtime.lastError); + resolve(null); + } else { + resolve(userInfo); + } + }); + }); +} + +window.getUserInfo = getUserInfo;