YunoHost-Apps / snserver_ynh

Standard Notes Syncing Server
https://standardnotes.org/
GNU Affero General Public License v3.0
6 stars 4 forks source link

Fix the extension identifier - the premium extensions do not work anymore #58

Closed tio-trom closed 2 years ago

tio-trom commented 2 years ago

After the latest updates all extensions that are "premium" seem to not work anymore for this package. See this https://github.com/standardnotes/desktop/issues/789#issuecomment-984716573

It is suggested to change the extension identifier.

FabianWilkens commented 2 years ago

At the moment the problem is only at the desktop client. But as soon as the same update is published for the web and mobile clients, there will be the same problem.

I could change the identifier as suggested. It would work for a new installed extension. But it won't update already installed extensions, because the identifier is different. And it is not possible to install the extensions on the new client with the self-hosted repo anymore. Only each extension by itself. At least with the current repo file.

tio-trom commented 2 years ago

hmm....so basically they made it a lot more difficult to self host this, or? It means that anyone who self hosted needs to start as new and reinstall the extensions?

FabianWilkens commented 2 years ago

I think so. Of course I could also be wrong. Hopefully it is somehow possible to still use a repo or something else.

tio-trom commented 2 years ago

Damn. I am using this tool for my notes, hundreds of them. I hope there is a way to still add the extensions via ynh,

FabianWilkens commented 2 years ago

There is still the option to install them one by one.

tio-trom commented 2 years ago

Hm, ok. I understand. But it would mean users have to re-add them all one by one then. Is this something you can implement to this ynh package to go around the issue?

tio-trom commented 2 years ago

Any updates on this?

tio-trom commented 2 years ago

Here's the update they wrote about the situation https://blog.standardnotes.com/33124/roadmap-update-march-2022 - maybe there needs to be a tutorial about how to do this for ynh.

FabianWilkens commented 2 years ago

I tested it again.

The server is at the latest version. The web app is still at version 3.8.25 from October 2021 and is working.

The extensions were not working on the desktop app after version 3.8.25. I just upgraded the desktop app to the latest version 3.12.1 and the same extensions are working again ( At least a few of them. ) without the subscription window.

I will try and upgrade the extensions to the latest versions. Maybe there are more working extensions without changing the identifier.

The problem is that the repo is not working anymore and that each new extension has to be installed one by one by each user. The same problem would be when the identifier is changed, then all extensions have to be removed by hand and reinstalled one by one. And at each note the editor needs to be picked again.

tio-trom commented 2 years ago

This sounds like a mess...so how do you install each extension one by one?

FabianWilkens commented 2 years ago

Like before, but you have to go into the settings. There is now the option to install extensions. You need to open the repo link in the browser and copy for each extension the latest_url link.

tio-trom commented 2 years ago

Hmm...I tried but I ma confused as to where I can do that. Can you please share some screenshots and what does it mean "copy for each extension the latest_url link"?

FabianWilkens commented 2 years ago

You can open the repo.json file in your browser or text file editor. There is for every extensions the latest_url, here highlighted in yellow. These links have to be used to install them one by one in your client app under Account settings -> General -> Advanced Settings -> Install Custom Extension

snserver_repo

tio-trom commented 2 years ago

I tried. In offline mode does not work. Meaning I have not logged in and tried. Nothing happens no extension gets enabled. I am using standard notes 3.13. I should try with an online account too maybe...

EDIT: Seems to work eventually. I'll get back to this in a bit.

tio-trom commented 2 years ago

Trying all of them now. The bold editor cannot install it says "Error downloading package details. Please check the extension link and try again." This is the link https://notesync.trom.tf/extensions/src/bold-editor.json

Same is true for code editor https://notesync.trom.tf/extensions/src/code-editor.json.

Plus Editor https://notesync.trom.tf/extensions/src/plus-editor.json

https://notesync.trom.tf/extensions/src/simple-task-editor.json

The rest seem to work.

twizzayy commented 2 years ago

This was recently posted by SN Devs:

https://docs.standardnotes.com/self-hosting/subscriptions/

There are instructions for implementing this for Docker… I have no idea how this would be implemented with Yunohost, or if there is a change that can be made as simple as the one that the SN Dev's describe for docker. Would the LDAP server play a part in making this change??

I'm fairly new to all of this, but am motivated to learn and help as much as I can.

FabianWilkens commented 2 years ago

This was recently posted by SN Devs:

https://docs.standardnotes.com/self-hosting/subscriptions/

Like discribed in this link, in the new versions of snserver and snweb, the extensions can now be installed via SQL. To activate the extentions, the following SQL querries have to be entered into phpMyAdmin (https://github.com/YunoHost-Apps/phpmyadmin_ynh) or similar.

Change <EMAIL@ADDR> in both lines to the users email address.

insert into user_roles (role_uuid , user_uuid) values ( ( select uuid from roles where name="PRO_USER" order by version desc limit 1 ) ,( select uuid from users where email="<EMAIL@ADDR>" )  ) on duplicate key update role_uuid = values(`role_uuid`);
insert into user_subscriptions set uuid = UUID() , plan_name="PRO_PLAN" , ends_at = 8640000000000000, created_at = 0 , updated_at = 0,user_uuid= (select uuid from users where email="<EMAIL@ADDR>") , subscription_id=1;

The selfhosted extensions are no longer needed, exept an old client version is used. The selfhosted extensions can be uninstalled and additional 3rd party extensions can still be installed under Setttings -> General -> Advanced Settings

Delegator9176 commented 2 years ago

Thanks @FabianWilkens for setting up all this.

I tried - as you suggested - to execute the SQL queries with phpmyadmin.

When I do so the feedback of the console is

Am I doing something wrong or does the command changed? Thanks in advance ;)

FabianWilkens commented 2 years ago

@nr458h The SQL queries were working, but the second line change in one of the last versions. You probably have done the first line already.

New

Change <EMAIL@ADDR> in both lines to the users email address.

insert into user_roles (role_uuid , user_uuid) values ( ( select uuid from roles where name="PRO_USER" order by version desc limit 1 ) ,( select uuid from users where email="<EMAIL@ADDR>" )  ) on duplicate key update role_uuid = values(`role_uuid`);
insert into user_subscriptions set uuid = UUID() , plan_name="PRO_PLAN" , ends_at = 8640000000000000, created_at = 0 , updated_at = 0,user_uuid= (select uuid from users where email="<EMAIL@ADDR>") , subscription_id=1, subscription_type="regular";

This will all work automatically in the next version, when a new user registers.

Delegator9176 commented 2 years ago

Thanks - worked fine now

FabianWilkens commented 2 years ago

New version is merged.

Selfhosted extensions are removed. And are new integrated in the client apps. New users are getting a PRO subscription and file space (Default: 100MB) automatically.