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

Incompatibility with latest AUR notion-app package #467

Closed
jamezrin opened this issue Apr 22, 2021 · 32 comments
Closed

Incompatibility with latest AUR notion-app package #467

jamezrin opened this issue Apr 22, 2021 · 32 comments
Labels
bug Something isn't working right

Comments

@jamezrin
Copy link
Member

I am the maintainer of the notion-app AUR package and I have made changes to the final install that makes it incompatible with the current notion-enhancer.

What I believe is happening right now is that when notion-enhancer is applied, it tries to patch the binary /opt/notion-app/notion, resulting in a corrupted binary.

I am aware that notion-enhancer is not ready for 2.0.13+ but I think the problems of compatibility with the AUR package could be solved changing https://github.com/notion-enhancer/notion-enhancer/blob/dev/pkg/helpers.js and https://github.com/notion-enhancer/notion-enhancer/blob/dev/pkg/apply.js to the current installation.

As of now, I am extracting the resources right out of the windows build and recreating the electron package myself using these resources. I make some changes to that source code myself so I'm not sure if that will make it outright incompatible with notion-enhancer's patches.

Anyway, I will try to get notion-enhancer to successfully patch notion-app and will submit it as a PR.

@jamezrin jamezrin added the bug Something isn't working right label Apr 22, 2021
@dragonwocky
Copy link
Member

already fixed by #460, but not merging at the moment as there are too many different versions/conflicts and I'm focusing on build the web version at the moment before I figure those out.

@Nek-12 would it be possible to release your PR directly to AUR without merging?

@Nek-12
Copy link
Contributor

Nek-12 commented Apr 23, 2021

already fixed by #460, but not merging at the moment as there are too many different versions/conflicts and I'm focusing on build the web version at the moment before I figure those out.

@Nek-12 would it be possible to release your PR directly to AUR without merging?

Well I can try and patch the script manually, no problems with that. I'll get to work soon.

@materemias
Copy link

@dragonwocky I am afraid #460 doesn't resolve the issue @jamezrin mentions since it addresses a change that affected a previous version (and concerned only the shell launcher which is a no more) in the new version /opt/notion-app/notion is a binary entry point and enhancer tries to patch it. Thanks for all your works (including @Nek-12 )

@dragonwocky
Copy link
Member

dragonwocky commented Apr 23, 2021

@materemias ah, I see, sorry. missed that.
@Nek-12 see how you go.

I'll fix this properly eventually, after I've released the extension, but until then I'm recommending most Linux users to just go with https://github.com/davidbailey00/notion-linux since it doesn't have any of the patching problems everywhere else does atm afaict. Don't think it supports Arch, though.

@Nek-12
Copy link
Contributor

Nek-12 commented Apr 24, 2021

@dragonwocky
Well, I'm sorry for my misunderstanding of the issue. So with the new details on the situation this means there is no need for me to release the fix promptly, so I'll probably leave it as it is. It may become obsolete soon after all.

@dragonwocky
Copy link
Member

dragonwocky commented Apr 24, 2021

@jamezrin apologies if this is a silly question, I haven't had a lot of experience with how the AUR works. Would it be worth considering working with @davidbailey00 to create a single, universal Linux port of Notion so there could be consistent releases of Notion and simpler support by things like the enhancer?

@materemias
Copy link

The current release of notion-app (AUR) doesn't work with notion-enhancer (AUR) so it would be cool if they could get on the same page, @Nek-12 can you sync with @jamezrin?

@valin4tor
Copy link
Contributor

valin4tor commented Apr 25, 2021

I'll fix this properly eventually, after I've released the extension, but until then I'm recommending most Linux users to just go with davidbailey00/notion-linux since it doesn't have any of the patching problems everywhere else does atm afaict.

This is probably because I haven't updated it to support the latest Notion versions at this time - new versions require a native dependency which I'm not able to cross-compile for ARM platforms, although I doubt many people are using ARM-based Linux at the moment so I could just drop support for it.

I'm also unsure if I'm in the best position to continue maintaining notion-linux as I no longer use either Linux (as a desktop OS) or Notion - I use Craft and Windows/macOS nowadays - although that's a different matter to the issue being discussed here

@jamezrin
Copy link
Member Author

jamezrin commented Apr 25, 2021

@jamezrin apologies if this is a silly question, I haven't had a lot of experience with how the AUR works. Would it be worth considering working with @davidbailey00 to create a single, universal Linux port of Notion so there could be consistent releases of Notion and simpler support by things like the enhancer?

Definitely, but as far as I know notion-linux builds on top of notion 2.0.11 instead of 2.0.16 (which the AUR package currently builds)
When notion-app AUR package was at 2.0.11 notion-enhancer worked perfectly, the incompatibility comes from the update from 2.0.11 to 2.0.16.

I'll fix this properly eventually, after I've released the extension, but until then I'm recommending most Linux users to just go with davidbailey00/notion-linux since it doesn't have any of the patching problems everywhere else does atm afaict.

This is probably because I haven't updated it to support the latest Notion versions at this time - new versions require a native dependency which I'm not able to cross-compile for ARM platforms, although I doubt many people are using ARM-based Linux at the moment so I could just drop support for it.

I'm also unsure if I'm in the best position to continue maintaining notion-linux as I no longer use either Linux (as a desktop OS) or Notion - I use Craft and Windows/macOS nowadays - although that's a different matter to the issue being discussed here

Bummer 😿 notion-linux is so awesome, are you open for contributions even if you might not be able to test them?

@valin4tor
Copy link
Contributor

Bummer 😿 notion-linux is so awesome, are you open for contributions even if you might not be able to test them?

Yes! Anyway, I can still test stuff in a VM, just it's a little more awkward than running Linux as my primary OS.

Sidenote, I think the latest version of Notion builds fine on x86, but building the notion-enhanced package is the problem as discussed in this issue (as well as packages for the ARM architecture) and I could probably get notion-enhancer builds working with the changes in #460 - see also valin4tor/notion-linux#38

@valin4tor
Copy link
Contributor

@jamezrin apologies if this is a silly question, I haven't had a lot of experience with how the AUR works. Would it be worth considering working with @davidbailey00 to create a single, universal Linux port of Notion so there could be consistent releases of Notion and simpler support by things like the enhancer?

The main difference between them is how the packaging is done / the directory in which the application is installed - otherwise they are more or less the same already.

The AUR is inherently tied to Arch, and I'm using electron-installer-redhat and electron-installer-debian to produce packages but there is no official electron-installer-arch, so I'm not sure what else could be done realistically to make the packages more similar, unless we both install notion to /opt for example.

@jamezrin
Copy link
Member Author

@jamezrin apologies if this is a silly question, I haven't had a lot of experience with how the AUR works. Would it be worth considering working with @davidbailey00 to create a single, universal Linux port of Notion so there could be consistent releases of Notion and simpler support by things like the enhancer?

The main difference between them is how the packaging is done / the directory in which the application is installed - otherwise they are more or less the same already.

The AUR is inherently tied to Arch, and I'm using electron-installer-redhat and electron-installer-debian to produce packages but there is no official electron-installer-arch, so I'm not sure what else could be done realistically to make the packages more similar, unless we both install notion to /opt for example.

When working in the AUR, the preferred approach normally is to build the package ourselves and install directly to the pkgdir instead of building a rpm, deb, etc package. When a user installs something from the AUR, most of the time it's going to build from source, or adapt a deb or rpm package to work on Arch.

Taking a look at notion-linux, we do things in pretty much the same way, the biggest difference I see is that notion-linux is using electron-packager and notion-app AUR package is using electron-builder instead.

@jamezrin
Copy link
Member Author

jamezrin commented Apr 25, 2021

I got notion-enhancer to work with 2.0.16 of AURs notion-app, but it's worse than I expected. This is after applying the fixes listed at https://www.notion.so/dragonwocky/hack-v0-10-2-to-work-with-notion-s-v2-0-13-app-a4ab1267e67b4126b6448641ca4a0041

I had to do some changes for it to be able to patch 2.0.16 and I don't know if I messed something else up, but this is how the main window looks

115999882-059e6c00-a5ee-11eb-8258-f885affc708e

I guess it's better for now to stay on 2.0.11 @materemias

@materemias
Copy link

this looks extra borked :) hopefully it's not that hard to fix... can you write down how you got here? I would try to fix it

@valin4tor
Copy link
Contributor

valin4tor commented Apr 25, 2021

Aha, I remember encountering this same issue after applying the fixes outlined here to notion-linux - looks like this is a generic Linux problem

@jamezrin
Copy link
Member Author

jamezrin commented Apr 25, 2021

Actually, after trying to run it again it didn't have this problem, I don't know... It's weird.

this looks extra borked :) hopefully it's not that hard to fix... can you write down how you got here? I would try to fix it

Do a clean install of AURs notion-app, clone https://github.com/jamezrin/notion-enhancer and inside that directory run node bin.js apply -y. That will apply the enhancer to /opt/notion-app/app.

The electron binary still looks for the asar file, so the desktop launcher will not work. To workaround it, install electron11 and run electron11 /opt/notion-app/app

That should get you an enhanced 2.0.16. I tried packing that /opt/notion-app/app directory again and move the patched asar back to resources but require calls to files outside the asar do not seem to work, so they would need to be embedded in the asar.

I see a good solution to this, which is to make another AUR package that has notion-enhancer applied before the repackage phase, that should work pretty good. I'm still thinking if I should do it considering the instability and graphical problems that might arise, but it's that or nothing.

@materemias
Copy link

I see a good solution to this, which is to make another AUR package that has notion-enhancer applied before the repackage phase, that should work pretty good. I'm still thinking if I should do it considering the instability and graphical problems that might arise, but it's that or nothing.

I will try that and report back how it works, having a separate aur package seems to be a good idea

@materemias
Copy link

@jamezrin this seems all cool on my side, I guess it also depends on what enhancements are enabled...
besides of what you explained only one additional step is required: to adjust the rights on /opt/notion-app to let enhancer write it
image

@jamezrin
Copy link
Member Author

jamezrin commented Apr 25, 2021

Alright, I'm going to go ahead and create a new AUR package which will integrate notion-enhancer. It seems to work pretty okay for me as well. It's going to be much easier this way, but I see 2 improvements notion-enhancer could benefit from:

  • Alongside detecting the path notion is installed to, allow the user to pass a CLI argument to override the path to the install directory
  • Repackage the application after extracting and requireing the loader file, including notion-enhancer's code inside the asar. I know that placing that app directory inside resources works but I'm not too keen about these files not being contained, I don't know.

@dragonwocky
Copy link
Member

dragonwocky commented May 1, 2021

I got notion-enhancer to work with 2.0.16 of AURs notion-app, but it's worse than I expected.

@jamezrin that specific issue is actually an old bug that seems to pop up again every time I think I've fixed it... on some (but not all) launches of the notion app it applies some extra CSP headers somewhere the break the custom protocol the enhancer uses for adding css, which is why things look messed up. I have actually found a working solution for this (replace enhancement:// with notion://enhancer/), but it's part of the reworked installer that isn't ready for use yet.

Repackage the application after extracting and requireing the loader file, including notion-enhancer's code inside the asar. I know that placing that app directory inside resources works but I'm not too keen about these files not being contained, I don't know.

The https://github.com/notion-enhancer/notion-enhancer/tree/rework branch does take steps towards this, containing notion-enhancer's code inside the app dir. I'm still figuring out repackaging as an asar - there needs to be a good way to detect if the enhancer is there or not so that the notion-enhancer check and notion-enhancer remove commands will work.

Alongside detecting the path notion is installed to, allow the user to pass a CLI argument to override the path to the install directory

https://github.com/notion-enhancer/notion-enhancer/blob/rework/bin.js#L41

@dklymenk
Copy link

dklymenk commented May 8, 2021

I wasn't able to patch latest version of notion-app from AUR using instructions by @jamezrin.

The latest version I managed to patch and run successfully is 2.0.8-4.

I'm pretty sure I was able to apply notion enhancer successfully to a latest version back in early April, but I couldn't get any of the April versions enhanced successfully now for some reason.

@rx10
Copy link

rx10 commented May 28, 2021

@dklymenk i think it might be because you have the folder .notion-enhancer in your home directory and some config files and cache of notion and notion-enhancer.
i overcame this issue by following these steps:
i deleted the folders /opt/notion-app, ~/.notion-enhancer, ~/.config/Notion
and, i also ran npm uninstall notion-enhancer.
then i followed the steps by jamezrin and they seemed to work fine. it might be just for me tho, let me know if it worked.
at first you might run into some errors to install some packages but just run npm install and you'll be good to go. also, don't forget to change the permissions for the folder /opt/notion-app such that notion-enhancer can access it.

Regards

@rx10
Copy link

rx10 commented May 28, 2021

also, @jamezrin there is a small error in the code in your fork of notion-enhancer, specifically in pkg/apply.js
image
here the command shows /opt/notion-app/app in my case and running the command wouldn't do anything as in the new version, there is no file called app in /opt/notion-app. i just wanted to let you know, i apologize if i've been intrusive.

@jamezrin
Copy link
Member Author

also, @jamezrin there is a small error in the code in your fork of notion-enhancer, specifically in pkg/apply.js
image
here the command shows /opt/notion-app/app in my case and running the command wouldn't do anything as in the new version, there is no file called app in /opt/notion-app. i just wanted to let you know, i apologize if i've been intrusive.

yeah, I'm not surprised things like that are not what one would expect. the fork is a messy draft just to get notion-enhancer to work.

I appreciate your feedback but I plan on retiring that repo for something better, so that people don't have to do all these manual steps by themselves.

I'm talking about https://github.com/jamezrin/notion-app-enhanced-PKGBUILD/, but it's non-functional at the moment, I'm going to try again this weekend and see if I can finally get it to work.

@rx10
Copy link

rx10 commented May 28, 2021

also, @jamezrin there is a small error in the code in your fork of notion-enhancer, specifically in pkg/apply.js
image
here the command shows /opt/notion-app/app in my case and running the command wouldn't do anything as in the new version, there is no file called app in /opt/notion-app. i just wanted to let you know, i apologize if i've been intrusive.

yeah, I'm not surprised things like that are not what one would expect. the fork is a messy draft just to get notion-enhancer to work.

I appreciate your feedback but I plan on retiring that repo for something better, so that people don't have to do all these manual steps by themselves.

I'm talking about https://github.com/jamezrin/notion-app-enhanced-PKGBUILD/, but it's non-functional at the moment, I'm going to try again this weekend and see if I can finally get it to work.

I understand, and I am looking forward to an enhanced notion package in the aur! go arch!

@jamezrin
Copy link
Member Author

I have released a new AUR package that has notion-enhanced embedded in the build process, it is available at https://aur.archlinux.org/packages/notion-app-enhanced/ and you just have to install it, it should work without any extra steps.

Please let me know if the package works correctly for you all, I highly recommend using it instead of applying notion-enhancer manually.

@materemias
Copy link

materemias commented May 29, 2021

I have released a new AUR package that has notion-enhanced embedded in the build process, it is available at https://aur.archlinux.org/packages/notion-app-enhanced/ and you just have to install it, it should work without any extra steps.

Please let me know if the package works correctly for you all, I highly recommend using it instead of applying notion-enhancer manually.

Thanks for that @jamezrin it builds properly, glitches I have found: window buttons are gone regardless if integrated titlebar is enabled or not and themes seem not to apply to main window

image

image

edit: only integrated buttons are wrong, I think there is an unnecessary fix applied somewhere, since git repo's dev branch applied had no such side effect

@jamezrin
Copy link
Member Author

jamezrin commented May 29, 2021

edit: only integrated buttons are wrong, I think there is an unnecessary fix applied somewhere, since git repo's dev branch applied had no such side effect

this is something I have experienced before, after a while it fixed itself (???)

I got notion-enhancer to work with 2.0.16 of AURs notion-app, but it's worse than I expected. This is after applying the fixes listed at https://www.notion.so/dragonwocky/hack-v0-10-2-to-work-with-notion-s-v2-0-13-app-a4ab1267e67b4126b6448641ca4a0041

I had to do some changes for it to be able to patch 2.0.16 and I don't know if I messed something else up, but this is how the main window looks

115999882-059e6c00-a5ee-11eb-8258-f885affc708e

I guess it's better for now to stay on 2.0.11 @materemias

@materemias
Copy link

I will keep monitoring, do themes apply for you?

@jamezrin
Copy link
Member Author

jamezrin commented May 29, 2021

I will keep monitoring, do themes apply for you?

nope, they don't seem to work.

EDIT: Actually, they do, I just didn't know they triggered on the Notion appearance setting.
Looking damn fine for me:
image

@materemias
Copy link

yep, it just started to work for me... don't know why

@jamezrin
Copy link
Member Author

jamezrin commented Jul 4, 2021

No longer relevant, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right
Projects
None yet
Development

No branches or pull requests

7 participants