YunoHost-Apps / synapse_ynh

Matrix server (synapse) package for YunoHost
https://matrix.org/
GNU General Public License v3.0
79 stars 42 forks source link

improve config panel #356

Closed Gredin67 closed 9 months ago

Gredin67 commented 1 year ago

TODO :

Gredin67 commented 1 year ago

!testme

yunohost-bot commented 1 year ago

Alrighty! Test Badge

Gredin67 commented 1 year ago

!testme

Gredin67 commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:carousel_horse: Test Badge

Gredin67 commented 1 year ago

@Josue-T it's starting to work, but I don't know what to do with e2e_enabled_by_default, which is not a boolean in homeserver.yaml, but

        [client.experience.e2e_enabled_by_default]
        ask = "End-to-End Encryption by default for locally-created Rooms"
        type = "select"
        choices = ["all", "invite", "off"]
        bind = "encryption_enabled_by_default_for_room_type:/etc/matrix-__APP__/homeserver.yaml"

You use e2e_enabled_by_default in many places that I don't necessarily understand. Can you sort this out?

Gredin67 commented 1 year ago

correct parameter handling should be double-checked for (non-exhaustive)

    allow_registration
    turn_allow_guests
    sso_enabled
    password_enabled
Gredin67 commented 1 year ago

@thardev can you check /scripts/config to see if it fits latest config_panel standards? And also check/add sed stuff for allowed_local_3pids and auto_join_rooms

Gredin67 commented 1 year ago

!testme close #284 close #315 close #350

yunohost-bot commented 1 year ago

:v: Test Badge

Josue-T commented 1 year ago

@Josue-T it's starting to work, but I don't know what to do with e2e_enabled_by_default, which is not a boolean in homeserver.yaml, but

        [client.experience.e2e_enabled_by_default]
        ask = "End-to-End Encryption by default for locally-created Rooms"
        type = "select"
        choices = ["all", "invite", "off"]
        bind = "encryption_enabled_by_default_for_room_type:/etc/matrix-__APP__/homeserver.yaml"

You use e2e_enabled_by_default in many places that I don't necessarily understand. Can you sort this out?

Well, I think this settings was probably dropped by #311 in the yaml config. I think the new settings that you added is ok we can drop the old one.

Gredin67 commented 1 year ago

@thardev can you check /scripts/config to see if it fits latest config_panel standards? And also check/add sed stuff for allowed_local_3pids and auto_join_rooms

and we still require the contribution of @thardev on the lists

Gredin67 commented 1 year ago

was probably dropped by #311 in the yaml config

it is still required here as a boolean "im.vector.riot.e2ee": {"default": __E2E_ENABLED_BY_DEFAULT__ } Can we somehow drop this?

Josue-T commented 1 year ago

was probably dropped by #311 in the yaml config

it is still required here as a boolean "im.vector.riot.e2ee": {"default": __E2E_ENABLED_BY_DEFAULT__ } Can we somehow drop this?

Oh I forgot this part. Well, we probably need to do some test to understand how it works between theses settings. It's quite complicated when we have settings like the same on the client and on the service side, I don't really know the priority between the client and the server.

Gredin67 commented 1 year ago

oops I merged just after you did, bad timing..

Gredin67 commented 1 year ago

Main settings tab: main_settings

With registration disabled: registration_disabled

Bottom: main_privacy_ux

Gredin67 commented 1 year ago

resources: resources

Gredin67 commented 1 year ago

Advanced: advanced

Gredin67 commented 1 year ago

@Josue-T @thardev I won't be able to work further on this, to handle yaml lists in config panel and at upgrade, someone could get inspiration from:

Gredin67 commented 1 year ago

!testme

Josue-T commented 1 year ago

@Josue-T @thardev I won't be able to work further on this, to handle yaml lists in config panel and at upgrade, someone could get inspiration from:

* https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh/blob/expose-config-panel/scripts/config#L16-L114

* https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh/blob/expose-config-panel/scripts/upgrade#L274-L293

Hello,

Really thanks for the PR, but I'm just too busy, I won't be able to work on this pull request personally.

Josue-T commented 1 year ago

Would be also really good if we add also this in the config panel as we can't enable at all currently.

Gredin67 commented 1 year ago

@rosbeef while you're at contributing, would you mind adding setters/getters for all settings requiring a yaml list? Something like here, but should be simpler. Basically everywhere I ping @thardev in this PR.

rosbeef commented 1 year ago

I would, but I'm a bit stressed those days, fires are starting every days kms around my location. As soon as i get in peace I do.

thardev commented 1 year ago

Sorry @Gredin67 I could not help a lot here, I'm quite busy recently, hopefully I can help to review some stuff but those complex sed setters/getters I'm afraid I won't be able to help :(

Gredin67 commented 1 year ago

I would, but I'm a bit stressed those days, fires are starting every days kms around my location. As soon as i get in peace I do.

@rosbeef hope the fires were not too bad for you those days... Are you up to finishing this PR ?

Gredin67 commented 1 year ago

!testme

yunohost-bot commented 1 year ago

Fingers crossed! Test Badge

rosbeef commented 1 year ago

Hi, sorry i had no time. Fire didn't come to my side thanks

What do you mean about if I'm up to finish? If i can Include all yaml config getter setter?

Winter is coming now, I have to prepare it then I will have a bit more time. Like at start of June.

I'm a bit alone in my collaboration, i' m not sure about how much time I have to spend on open source project to not disturbe more than help.

Gredin67 commented 1 year ago

What do you mean about if I'm up to finish? If i can Include all yaml config getter setter?

yes there 4 or 5 settings requiring using setters/getters sed or yq or whatever. I'm not sure I will find time either, so I'm thinking of merging without those settings. So if nobody works on it within the next days I'll remove them.

Thatoo commented 1 year ago

Could we include Automatic double-puppeting for bridge users in the config panel?

Gredin67 commented 1 year ago

I would add this in a separate PR, as it seems more complicated than just exposing a parameter in homeserver.yaml

Le 23 avril 2023 22:31:22 GMT+02:00, Thatoo @.***> a écrit :

Could we include Automatic double-puppeting for bridge users in the config panel?

-- Reply to this email directly or view it on GitHub: https://github.com/YunoHost-Apps/synapse_ynh/pull/356#issuecomment-1519149718 You are receiving this because you were mentioned.

Message ID: @.***> -- Sent from /e/ Mail.

Gredin67 commented 1 year ago

What do you mean about if I'm up to finish? If i can Include all yaml config getter setter?

yes there 4 or 5 settings requiring using setters/getters sed or yq or whatever. I'm not sure I will find time either, so I'm thinking of merging without those settings. So if nobody works on it within the next days I'll remove them.

@rosbeef by any chance would you have time to have a look at thiese setters/getters ? If yes we could merge this full config panel rather than the limited #374

rosbeef commented 1 year ago

Sorry i did not follower the modification stream. I can do something now, but on which file i can start. I understand that setters|getters are required when multiple replace on one file is required, is thatright ? indicated on top of this pr

rosbeef commented 1 year ago

Seems good. Please report bugs

Gredin67 commented 1 year ago

I could upgrade and open the config panel. :rocket: Did not test the sed you proposed yet. @Josue-T should we merge testing in this branch ?

rosbeef commented 1 year ago

I thought it better an I think that i implement on a bad way the tags fields. But i can modify that on Saturday, and make possible to do manage multiple values.

rosbeef commented 1 year ago

"J'ai galéré", Please test. I tested the sed individualy and the config panel inside yunohost. ~~the only problem i have is that synapse does not start even if the config is well generated. maybe because i have 2 synapse instance on the same server. sed is not replacing well the multiple spaces on start of the pattern line. it replace with only 1 space instead of the 4 i specified inside the regex.~~

rosbeef commented 12 months ago

Ok @Gredin67 , now it is ok to merge in testing. synapse start, config panel get and set values. the only things i did not test is the final usage ( if escaped values are well interpreted by synapse on the end user side.)

Gredin67 commented 11 months ago

if you have a list of those variables and corresponding escaped values, we could ask on synapse's github or matrix room

Gredin67 commented 11 months ago

after upgrade from a previous commit of this branch, I get :

An error prevents the configuration panel from being displayed:

Corrupted TOML read from /etc/yunohost/apps/synapse/config_panel.toml (reason: Reserved escape sequence used (line 49 column 1 char 1948))

Please report this error to the YunoHost team to get it fixed!
Gredin67 commented 11 months ago

see https://toml.io/en/v1.0.0#comment

Gredin67 commented 11 months ago

I got

Gredin67 commented 11 months ago

Should be :

auto_join_rooms:
  - "#example:example.com"

allowed_local_3pids:

  • if not solvable, a workaround would be to ask people to write ^[^@]+@matrix\\.org$ in the panel field

I tested the workaround and it writes properly in the config file. It should be explained in the help field of the panel if applicable.

Gredin67 commented 11 months ago

Apart from the small bug, The msisdn/email handling is great ! Thanks for the awesome job!

Gredin67 commented 11 months ago

I tested the workaround with email registration restricted to a domain name, it worked ! But at upgrade I had a strange behaviour : values regarding register only with given format were reset to default in the config file although they showed as personalized in the config panel fields. Maybe a cashing issue in my browser..

rosbeef commented 11 months ago

I think it is values in old config are not escaped. So in update it require to rewrite value with escaped caracteres. I think sed will do the trick one more time.

I will try it as soon as I can sit in front of a big screen. Or maybe better apply escape characters in the getter.

rosbeef commented 11 months ago

hey i had some time, i hope we can finalize that :) but i have some comments.

i tested msisdn and email with \ in config panel and it works why to put \\ ? i corrected help with \ back

why to put a bind option in the config toml for auto_join_rooms as we use getter setters ?

in install and update script why auto_join_rooms parameter is set to #auto_join_rooms: $server_name by default ? this value is arbitrary at my eyes and correspond to nothing.

in install and update script too Maybe set next values to null and do not allow open registration in install script
allowed_local_3pids_email="" allowed_local_3pids_msisdn="" yunohost basic users are using ldap integrated directory, and advances users know how to configure the registrations.

Gredin67 commented 11 months ago

i tested msisdn and email with \ in config panel and it works why to put \ ? i corrected help with \ back

With my workaround, I tested that the config panel was generating the right syntax AND that registration was limited to a given email domain name. Did you test that registration was effectively working with this syntax? If yes I would agree with you solution.

But we have to think about people that edit the config file in CLI following the config template instructions/syntax. What happens if they write '^[^@]+@matrix\.org$' I think then '^[^@]+@matrix\\.org$' would be displayed in the config panel field.

Gredin67 commented 11 months ago

This is working config_panel_ I had a strange bug (after upgrade I think), screenshot is taken after applying the config on the right, it is not applied in the config file workaround_synapse_config_panel Maybe settings should be re-applied after upgrade, see what I had to do here : https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh/blob/master/scripts/upgrade#L269-L294