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

postMessage on disconnected port #75

Closed
Krzmbrzl opened this issue Oct 25, 2019 · 12 comments · Fixed by JabRef/jabref#5530
Closed

postMessage on disconnected port #75

Krzmbrzl opened this issue Oct 25, 2019 · 12 comments · Fixed by JabRef/jabref#5530

Comments

@Krzmbrzl
Copy link

I just installed JabFox and I have installed JabRef via jabref_5.0.0-1_amd64.deb from https://builds.jabref.org/master/.

However I don't see any additional menu or something like this in Firefox (v70.0 (64-bit)) and when I look into the JabFox preferences, it says

Error: Attempt to postMessage on disconnected port

for the connection status.

@tobiasdiez
Copy link
Member

Could you please make sure that /usr/lib/mozilla/native-messaging-hosts/ contains jabref.json and that this file points to the correct installation folder. Thanks!

@Krzmbrzl
Copy link
Author

Krzmbrzl commented Oct 25, 2019

It look like this:

{                                                                                                                                                     
  "name": "org.jabref.jabref",                                                                                                                        
  "description": "JabRef",                                                                                                                            
  "path": "/opt/jabref/lib/jabrefHost.py",                                                                                                            
  "type": "stdio",                                                                                                                                    
  "allowed_extensions": [                                                                                                                             
    "@jabfox"                                                                                                                                         
  ]                                                                                                                                                   
}  

and /opt/jabref/lib/jabrefHost.py does indeed exist. However only root can access it. Could that be the problem?

EDIT: And the file is named org.jabref.jabref.json (the second jabref is intentional) and not just jabref.json. Is this intended?

@tobiasdiez
Copy link
Member

Can you try and give yourself (i.e the local user) access rights to /opt/jabref/lib/. Alternatively, it might work if you run firefox with admin rights. @LyzardKing do you have an idea what went wrong? The same problems appears also on mac: #77

@LyzardKing
Copy link
Collaborator

The user shouldn't have access to it, so that shouldn't be the problem here..
It's installed in /opt by sudo, so it should be owned by root.
I'll try and install and see what's happening.

@LyzardKing
Copy link
Collaborator

Changing the permissions is not the right thing to do. It would also break a multi user system.
But I'm not sure what the issue is...It's not working, but it's nothing I changed..
The path is correct, and it should still work.
It's very strange.

@tobiasdiez
Copy link
Member

Is the python script still marked executable?

@Krzmbrzl
Copy link
Author

Krzmbrzl commented Oct 27, 2019

Alternatively, it might work if you run firefox with admin rights

It appears as if Firefox is very stubborn and won't start with admin rights. Tried a few tricks but still I am unable to start firefox with root privileges.

Okay I seem to have figured out what the problem is: I can get JabFox to work, if I grant execution privileges for other to jabrefHost.py. Not the before the execution flag wasn't set at all (or maybe it got removed during me messing around with the file's ownership).

I don't know if that is possible during the installation of a firefox addon but my suggestion would be to create a new pseudo-group for the addon, assign this group to all jabFox associated files and grant execution privileges to group on the respective files...

EDIT: Or you could assign firefox's group to the files as ultimately I guess it is firefox accessing these files as far as the OS is concerned 🤔

@LyzardKing
Copy link
Collaborator

@tobiasdiez The python script is not set as executable.
That's the solution needed.
I don't know where the regression happened..

@LyzardKing
Copy link
Collaborator

Testing now to see if it's enough to chmod in the source for both the deb and the snap.
Once I confirm I'll upload a PR

@LyzardKing
Copy link
Collaborator

@Krzmbrzl Does the latest build fix the issue?

@Krzmbrzl
Copy link
Author

I set the permissions manually and it's working now. Didn't try the new build... But if the changed permissions are now included I'd say it should work just fine.

@diabl0w
Copy link

diabl0w commented Nov 13, 2019

I am getting really confused and frustrated.... I installed https://aur.archlinux.org/packages/jabref-latest/ and then installed this addon through Mozilla's addon website... is this not the proper way to do it? I have the same message as OP, but the json file does not exist at all rather than just having the wrong permissions

EDIT: I manually downloaded the json https://github.com/JabRef/jabref/blob/master/buildres/linux/org.jabref.jabref.json into the proper directories (native-messaging-host), used both org.jabref.jabref.json as well as jabref.json, set the correct permissions, changed the appropriate "path" inside the file, and now I sometimes get an icon in the url bar. But its still not working

For example, on this repo's main github page, I can get the icon and when I click it, it says that it is importing into my library, but then nothing shows up in my library. So that doesnt work. Then, actual websites like pubmed, I dont even get the icon at all. The addon still has the disconnect port message in the addon preferences in firefox

EDIT2: Finally fixed it... had to change the allowed extensions from "browserextension@jabref.org" to "@jabfox"

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

Successfully merging a pull request may close this issue.

4 participants