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

Fix Persepolis connection issues with Manifest v3 #57

Open
JafarAkhondali opened this issue Mar 5, 2024 · 5 comments
Open

Fix Persepolis connection issues with Manifest v3 #57

JafarAkhondali opened this issue Mar 5, 2024 · 5 comments

Comments

@JafarAkhondali
Copy link
Member

No description provided.

@khaled-0
Copy link
Contributor

khaled-0 commented Mar 6, 2024

Progress
image

It seems like persopolis creates / overwrites pdmchromewrapper.json somewhere. And the extension Id's doesn't match
For now I've created com.persepolis.pdmchromewrapperv3.json with new extension id

{"name": "com.persepolis.pdmchromewrapperv3", "type": "stdio", "path": "/home/khaled/.config/persepolis_download_manager/persepolis_run_shell", "description": "Integrate Persepolis with chromium using WebExtensions", "allowed_origins": ["chrome-extension://celnpdgacgkldkephdonlhjncjiaifdp/"]}

Changed honsName in backgrund.js to const hostName = 'com.persepolis.pdmchromewrapperv3';

And patched some broken api (dirty fix) to check the connection.
It seems to work

https://github.com/persepolisdm/persepolis/blob/658fed8601d6defd79f38923c3e0905b0d8bf63f/persepolis/scripts/browser_integration.py#L158
There must be another way instead of hardcoding the extension id ?? right??

Found a way

edit manifest to include

  "key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoCgWSDIitikIuLvTLERSUeSSRobagH6W9yZNsC+1+3XVX8Ae83ZPGbjuHhb4J2vQzSDfr2TiWeLya2z54JH2KCVTHdr++Mf8xlykobf83/HTu2LcQzI7RPb53KWgGMrEszuRQdxhSeYwogCR6BDQaRqRmBbsAg40VuLI53KtXrvESu3gNtDdIpG/S1EIxK6VnwXL+UXxVmPQxQ0tFyTX5R0tyBdbKAx7UwT9z8fQN4PP4QBHFzU4Pqrln66evdYb5NpZw9RAZxhLW4chk4kK2BMz4Ym10J1yOjvZ4w9MBHJsIn38EJSfYSDWOlUReZNoQXHN4J6UhMQbuWEZO6SbVwIDAQAB",

And the id will be same as current persopolis extension
The key is the public key of current extension btw. Got by running chrome.runtime.getManifest().key

@JafarAkhondali
Copy link
Member Author

Hello Khaled,
Thanks for your help!

I believe the ID (not sure about the "key") changes with different installations on different systems. The Id that have been hardcoded before, was obtained after install extension from the web store, in the browser. Also, I forgot to mention that the manifest.json here is not required and must be removed. Firefox and chrome have different manifest, only the code is shared. you can see it in: https://github.com/persepolisdm/Persepolis-WebExtension/blob/master/packager.sh

@JafarAkhondali
Copy link
Member Author

If you achieve a stable connection, try to debug other features of extension on both browsers. Like these features:

  1. Automatic download canceling and sending it to Persepolis
  2. (context menu) Download All links
  3. (context menu) Download selected links

@khaled-0
Copy link
Contributor

khaled-0 commented Mar 7, 2024

Hello Khaled, Thanks for your help!

I believe the ID (not sure about the "key") changes with different installations on different systems. The Id that have been hardcoded before, was obtained after install extension from the web store, in the browser. Also, I forgot to mention that the manifest.json here is not required and must be removed. Firefox and chrome have different manifest, only the code is shared. you can see it in: https://github.com/persepolisdm/Persepolis-WebExtension/blob/master/packager.sh

hey , yeah the key here is for debugging purposes only
by including the key, the extension id stays the same as hardcoded in persopolis(the web store's id)
This was the problem the native messaging was broken.
I doubt there's any other issue about the connection as I've got a pretty stable one. But I'll test and update further along the way. #58

When packaging the extension and uploading it to the store , the key will be same as defined in persopolis without that manifest.json var anyway.

@khaled-0
Copy link
Contributor

khaled-0 commented Mar 7, 2024

Hey, When you can, please review #58
I'll began cleaning / refactoring some stuffs after your review.
Thanks

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

No branches or pull requests

2 participants