Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine the chrome/firefox profile of the client (feature) #71

Open
bjohas opened this issue May 30, 2022 · 8 comments
Open

Determine the chrome/firefox profile of the client (feature) #71

bjohas opened this issue May 30, 2022 · 8 comments
Assignees

Comments

@bjohas
Copy link

bjohas commented May 30, 2022

I am trying to get certain tabs to open in certain profiles. E.g. in chrome, chrome://version/, gives me

Profile Path | /home/user/.config/google-chrome/Profile 1

However, when I query this tab, I only get this:

$ bt text a.1.1549
a.1.1549	About Version	chrome://version/

Is there a way to access the profile? E.g.,

$ bt profile a
Profile 1

or maybe

$ bt clients
a.	localhost:4625	4302	chrome/chromium    Default
b.	localhost:4626	8583	chrome/chromium    Profile 1

Many thanks!

@bjohas
Copy link
Author

bjohas commented Oct 9, 2022

@balta2ar - any thoughts on this? I could look at this and do a PR - would that be welcome?

@balta2ar
Copy link
Owner

balta2ar commented Oct 9, 2022

Sure! But before you start writing code, as the first phase, could you do a "research" phrase where you'd look into the available APIs in different browsers and estimate where this feature may incur changes in the code? Feel free to post the relevant links and ideas here. What I mean is something like a planning stage. And then when we're on the same page, it can follow with code.

@bjohas
Copy link
Author

bjohas commented Nov 26, 2022

@balta2ar Hello again. I've looked at this. It doesn't seem to be possible to get the profile like this. However, I have another proposal.

The problem I am trying to solve is to make each instance of the brotab extension unique, so that I know which Profile it corresponds to. There doesn't seem to be unique id associated with each instance.

Would you be ok with the introduction of an option for the brotab browser extension, through which users can add a unique string to this instance? If the string is set, then, e.g., bt clients would return

$ bt clients
a.	localhost:4625	4302	chrome/chromium    string1
b.	localhost:4626	8583	chrome/chromium    string2

How does that sound?

@balta2ar
Copy link
Owner

add a unique string to this instance

How would you do that?

An alternative I've just thought about is the following. It's a bit hacky, but it doesn't require changes in brotab, only in your wrapper scripts.

In each profile that you have, you open a tab with a magic title, e.g. file:///home/user/profile1.html, then you use that magic string to figure out which mediator port corresponds to which profiles. It requires an extra tab, which should always be there, but if you are a tab hoarder like me, you wouldn't even notice 😅 What do you think?

@bjohas
Copy link
Author

bjohas commented Jul 4, 2023

Hi @balta2ar,

I lost track of responding, but I actually made some local changes and have used them since last year. I've added "storage" to the permissions:

Manifest:

"options_page": "options.html",
...
"permissions": ["nativeMessaging", "tabs", "activeTab", "<all_urls>","storage"],

Then: background.js

     chrome.storage.sync.get({
       brotab_identifier: 'profile_1'
     }, function(items) {
       instID = items.brotab_identifier;
     });
     return "chrome/chromium\t"+instID;

Via the options page options.html, the identifier can be set.

Would you be happy for me to do a PR on this?

@balta2ar
Copy link
Owner

balta2ar commented Jul 4, 2023

I guess if you have the changes locally it's no harm to make a PR :)
Do you think you could also come up with a test for this?

@bjohas
Copy link
Author

bjohas commented Jul 4, 2023

I've done a PR. As noted in the PR, this is initially for discussion. Needs more polishing/testing, and a test as well.

@bjohas
Copy link
Author

bjohas commented Sep 1, 2023

Let us know if there's anything else we should do - we're keen to get this integrated into the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants