gitladen7 / protonmail-webextension

Unofficial webextension for ProtonMail
48 stars 16 forks source link

new proton domain available not listed in preferred protomail domain #23

Open laopewastaken opened 2 years ago

laopewastaken commented 2 years ago

proton enabled their new domain proton.me. ( https://mail.proton.me/u/0/inbox )

but is not available in the preferred protomail domain option yet. ZMHACsSzNQ

62On61dr90 commented 2 years ago

Would it be possible to make the list editable?

vaindil commented 2 years ago

I created a new signed version for Firefox that updates the domain list to include mail.proton.me (fork here). Download it from the link below, unzip it, and drag the .xpi file onto your Add-ons page in Firefox to install it. I built a Chromium version as well but I didn't test it.

tholeb commented 2 years ago

I created a new signed version for Firefox that updates the domain list to include mail.proton.me (fork here). Download it from the link below, unzip it, and drag the .xpi file onto your Add-ons page in Firefox to install it. I built a Chromium version as well but I didn't test it.

Hi, for chrome, the manifest is outdated. Need to have version 3, and only 1=one background.service_worker (instead of background.scripts).

Btw, how have you built the extension ? Last time I tried I had a lot of npm errors

VirtualHorror commented 1 year ago

@vaindil I seem to be getting a warning on MS Edge v110.0.1

Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details.

I'm able to use the extension but that message seems to be just a warning

Additionally why don't you publish the extension on Chrome web store or MS Edge Web Store? It would be very useful for a lot of users. Currently MS Edge displays a notification every time the application is opened mentioning that the extension is in developer mode and it hasn't been closed. There is no way to dismiss the notification permanently - you can either close the dialogue box, or set it to remind you the next time you open the application or in the next 2 weeks...

vaindil commented 1 year ago

@VirtualHorror That warning is related to the Manifest V2 -> V3 transition. I've followed the news about that but not much about the actual developer aspects of it since I only tinker with extensions in my free time, so I'm not sure how much work it would be to transition this to V3.

I spent a few hours trying to get this extension running locally about a month ago, but I was unable to do so. React doesn't have any way of creating a debug build without using a server, and I couldn't debug through a prod build because each build takes forever and it's just much more difficult to do.

I'm sure there's some easy step I missed, but I couldn't figure out how this extension was even developed in the first place, so I gave up.

I'd be happy to maintain the project at least for now if I could figure that out, but I don't want to put it on any stores without actually understanding how to run it locally.

VirtualHorror commented 1 year ago

@vaindil

That warning is related to the Manifest V2 -> V3 transition. I've followed the news about that but not much about the actual developer aspects of it since I only tinker with extensions in my free time, so I'm not sure how much work it would be to transition this to V3.

I see

I spent a few hours trying to get this extension running locally about a month ago, but I was unable to do so. React doesn't have any way of creating a debug build without using a server, and I couldn't debug through a prod build because each build takes forever and it's just much more difficult to do.

You mention React doesn't have any way of creating a debug built without using a server and the builds take a lot of time, would accessibility to a VPS or something of that sort speed up the process? If yes, what resources (in terms of RAM, CPU cores and storage) would it need? I could probably spin up a droplet on https://digitalocean.com if that helps.

VirtualHorror commented 1 year ago

Additionally the unread count badge doesn't seem to be working (The notification works but unread count doesn't)

Any clue why?

Scallywer commented 1 year ago

So I've actually tried to start the transition to v3 on my fork in devel branch but without fully understanding what and how stuff was used in initial development, it's really hard to do this. Even official instructions are not enough and soo many dependencies are deprecated that its needs a huge refactor.

FYI no store will accept the extension if it's not on v3.

Scallywer commented 1 year ago

I did manage to build it on my development VM but it got corrupted and I have not found time to rebuild it again.

vaindil commented 1 year ago

@Scallywer If you have instructions (or a vague idea) of what I need to do to build it, I'm happy to do as much of the V3 transition work and dependency upgrades as I can. I just couldn't figure out how to properly run it in dev mode since React doesn't allow the creation of standalone dev builds, and an extension has to be a standalone set of files (as far as I can tell).

Scallywer commented 1 year ago

@vaindil It's hard to got though, it's a mountain of compilation warnings and security updates which IMHO need to be done first. And ofc anytime you update a dependency something can break. Once all that is resolved, then we'd be familiar with the code enough so that we can make the changes needed for v3 transition.

To answer your question about dev builds, easiest way is to use a Linux VM with vanilla chromium, enable dev mode, and point to the extension in a folder (as we do now, since it's not available in the store). Then after you make changes, you can build and try. Chrome as such has a decent debugger for plugins and error messages are sufficient to point in the right direction... You can also always use breakpoints to debug (since react, as any js framework does not support realtime debugging).

vaindil commented 1 year ago

@Scallywer Sorry, the specific part I couldn't figure out was actually building React for dev mode, since that doesn't seem to be an option. I had to create a full prod build every time, which made debugging virtually impossible (and the builds took like 45 seconds each). If there's no better way, then frankly I'm not interested in maintaining it, because that'd be hell to try to work on. If there's somehow a way to point the browser the React dev server that npm start spins up, then I could work with that, but it doesn't seem possible.

Scallywer commented 1 year ago

Looking at package.json there seems to be a script to build react only : "scripts": { "start": "react-scripts start", "start:background": "webpack --env.NODE_ENV=development --mode=development", "clean": "rimraf .zip build .env", "purgecss": "purgecss --css build/static/css/.css --out build/static/css/ --content public/index.html src///*.tsx src/*/.tsx", "build:production:react": "cross-env GENERATE_SOURCEMAP=false INLINE_RUNTIME_CHUNK=false react-scripts build", "build:production:background": "webpack --mode=production", "build:production": "cross-env node scripts/setEnv.js && npm run build:production:react && npm run build:production:background && npm run purgecss", "build:firefox": "cross-env npm run build:production && node scripts/manifest.js firefox", "build:chromium": "cross-env npm run build:production && node scripts/manifest.js chromium", "build": "npm run build:firefox", "test": "react-scripts test", "eject": "react-scripts eject", "deploy": "node scripts/deploy.js", "lint": "eslint --ext .js,.ts,.tsx ."

Scallywer commented 1 year ago

Downloading a clean Ubuntu image for VMWare now, will try another clean compile from my branch...

VirtualHorror commented 1 year ago

Maybe https://stackblitz.com could help with pointing the browser to the react dev server that npm start spins up?

Scallywer commented 1 year ago

@VirtualHorror Tried it, uses Turbo and Turbo does not like old stuff, like at all :)

Scallywer commented 1 year ago

npm install --verbose verbose preInstall Validate "package.json" warn preInstall No description field warn preInstall No repository field warn preInstall No license field ┌ [1/4] 🔍 Resolving dependencies └ Completed in 0.707s verbose Skipping audit ┌ [2/4] 🚚 Fetching dependencies │ info pruneDeps Excluding 5 dependencies. For more information use --verbose. │ ├─ node_modules/chokidar/node_modules/fsevents@1.2.13 │ ├─ node_modules/fsevents@2.0.7 │ ├─ node_modules/jest-haste-map/node_modules/fsevents@1.2.13 │ ├─ node_modules/sass/node_modules/fsevents@2.3.2 │ └─ node_modules/watchpack/node_modules/fsevents@2.3.2 │ verbose fetchDeps All good, nothing to fetch └ Completed in 0.002s ┌ [3/4] 🔗 Linking dependencies └ Completed in 0.002s info security We found install scripts which turbo skips for security reasons. For more information see https://turbo.sh/install-scripts. ├─ core-js@2.6.12 ├─ core-js@3.29.0 └─ es5-ext@0.10.62

VirtualHorror commented 1 year ago

Additionally the unread count badge doesn't seem to be working (The notification works but unread count doesn't) Any clue why?

Seems to be a problem in /src/background/services/emailFetcherService.ts: image

unread.Count is not dispatched here, or not received in /src/background/helpers/updateBadge.ts: image

Any idea on how I can fix that?

VirtualHorror commented 1 year ago

No, but I found a workaround in /src/background/services/emailFetcherService.ts: image

By changing the value to -1 does it display the number of unread emails?

VirtualHorror commented 1 year ago

Yes, but it is a workaround, every mail check lasts longer!

Every mail check lasts longer as in it takes a while to update the unread count even after an email has been marked as read?

Please test, if it works by removing "Locations" here: image

Will give it a try

VirtualHorror commented 1 year ago

Yes, please test to remove "Locations" here: image

Do I leave the change made to state.LastUnreadCount = -1; in /src/background/services/emailFetcherService.ts that you had shared earlier while making this change you suggested now?

VirtualHorror commented 1 year ago

No, that could be the fix.

Alright, will remove the state.LastUnreadCount = -1; changing it back to what it was originally.

I'll make the change in line 90 to for (const unread of eventResponse.Unread) { and see if that works

VirtualHorror commented 1 year ago

It does'nt!

Am I doing something wrong?

VirtualHorror commented 1 year ago

So what do I need to modify to have the unread count on the extension work?

state.LastUnreadCount = -1;, for (const unread of eventResponse.Unread) { or include both the snippets?

VirtualHorror commented 1 year ago

state.LastUnreadCount = -1; is the workaround. for (const unread of eventResponse.Unread) does not work.

Got it, thanks!