@@ -123,22 +123,28 @@ def get_macos_config(browser: BrowserType) -> dict:
123123 raise ValueError (errmsg ) from e
124124 cookie_file = "~" / app_support / cookies_suffix
125125
126- # Slack cookies can be in two places on MacOS depending on whether it was
127- # installed from the App Store or direct download.
128- if browser is BrowserType .SLACK and not cookie_file .exists ():
129- # And this location if Slack is installed from App Store
126+ # Cookie location and keyring username in MacOS depends on whether the
127+ # application was installed from the App Store or direct download. To find
128+ # out, we simply assume it's direct download and fall back to App Store if
129+ # it's not there. Currently this distinction is only known for Slack, so
130+ # that is the only case handled here.
131+ isAppStore = False
132+ if browser is BrowserType .SLACK and not cookie_file .expanduser ().exists ():
133+ isAppStore = True
130134 cookie_file = (
131135 "~/Library/Containers/com.tinyspeck.slackmacgap/Data"
132- / app_support
133- / cookies_suffix
136+ / app_support / cookies_suffix
134137 )
135138
136139 browser_name = browser .title ()
137140 keyring_service_name = f"{ browser_name } Safe Storage"
138141
139- keyring_username = browser_name
140- if browser is BrowserType .SLACK :
141- keyring_username = "Slack App Store Key"
142+ if browser is BrowserType .SLACK and isAppStore :
143+ keyring_username = f"{ browser_name } App Store Key"
144+ elif browser is BrowserType .SLACK :
145+ keyring_username = f"{ browser_name } Key"
146+ else :
147+ keyring_username = f"{ browser_name } "
142148
143149 key_material = keyring .get_password (keyring_service_name , keyring_username )
144150 if key_material is None :
0 commit comments