Pragalbha-Patil / mongodb-compass-dark-mode

Oh my eyes! Don't worry, enable Dark mode in MongoDB Compass in just few simple steps.
2 stars 0 forks source link

Error: Embedded Dark Reader cannot access a cross-origin resource #1

Closed essare closed 2 years ago

essare commented 2 years ago

After I have executed the command to enable dark mode: bash <(wget -qO- https://raw.githubusercontent.com/Pragalbha-Patil/mongodb-compass-dark-mode/main/install.sh)

I was unable to use mongodb-compass app. I open Dev-Tools and see this error in the console:

darkreader.js:241
Error: Embedded Dark Reader cannot access a cross-origin resource file:///usr/lib/mongodb-compass/resources/app.asar/src/app/index.html/images/svg/aggregations-zero.svg Overview your URLs and CORS policies or use `DarkReader.setFetchMethod(fetch: (url) => Promise<Response>))`. See if using `DarkReader.setFetchMethod(window.fetch)` before `DarkReader.enable()` works.
    at darkreader.js:171
    at step (darkreader.js:69)
    at Object.next (darkreader.js:50)
    at darkreader.js:43
    at new Promise (<anonymous>)
    at __awaiter (darkreader.js:39)
    at throwCORSError (darkreader.js:169)
    at darkreader.js:194
    at step (darkreader.js:69)
    at Object.next (darkreader.js:50)
(anonymous)@darkreader.js:241

MongoDB Compass version: 1.28.1

And there is a big issue with the install.sh here is what happened: I executed the command in my home directory ~ and it cloned mongodb-compass-dark-mode/ into my ~/mongodb-compass-dark-mode/ and the script started to create a backup file: sudo mv /usr/lib/mongodb-compass/resources/app.asar app.asar.old this command is actually moving the /usr/lib/mongodb-compass/resources/app.asar into ~/mongodb-compass-dark-mode/ because the script is being executed from that directory and when it finishes is just deletes ~/mongodb-compass-dark-mode/and the backup file is also deleted !! so the command of creating the backup file should be corrected to this: sudo mv /usr/lib/mongodb-compass/resources/app.asar /usr/lib/mongodb-compass/resources/app.asar.old

so now I've lost my original app.asar file but got it from my other machine where mongo-compass is also installed.

Pragalbha-Patil commented 2 years ago

Hi, Thanks for this. I managed to find time from my busy schedule to ensure the code is updated to work with version 1.13.1 and it does! Thanks for pointing out the issue, I've fixed it now.

Cheers.