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

No code formatting for Manage Sites --> Advanced #73

Closed
pksml85 opened this issue Feb 1, 2023 · 8 comments · Fixed by #97
Closed

No code formatting for Manage Sites --> Advanced #73

pksml85 opened this issue Feb 1, 2023 · 8 comments · Fixed by #97
Labels
enhancement New feature or request

Comments

@pksml85
Copy link

pksml85 commented Feb 1, 2023

First of all, thanks for getting Issue #69 tackled so quickly! Much appreciated.

When I go to Manage Sites --> Modify --> Advanced, my nginx code is automatically formatted. I have a rather complicated configuration for my site (complicated at least in the eyes of the parser), and the auto formatting breaks my config. (While I can modify my site config through Manage Configs, it's a bit more of a hassle.)

So my proposal is when clicking the 'Advanced' toggle button in Manage Sites, don't automatically format the code. This way advanced users won't have their config messed up. (I also really like white space in my config for ease of understanding and I lose this with auto formatting.)

You might consider having a button at the bottom of the screen to auto format like you do for Manage Configs for those who would like to use it. This would greatly improve usability. Thanks!

@0xJacky
Copy link
Owner

0xJacky commented Feb 2, 2023

We use gonginx to build the configuration content from the JSON object (ngx object). The ngx object is parsed by gonginx. When you edit the configuration in basic mode, you are actually editing the ngx object. When you click the "Advance" toggle button, the ngx object is sent to the backend, and the configuration content is rendered in the frontend, with automatic code formatting. However, gonginx may not always work as expected and cause issues in your environment.

I plan to add a setting option in the preference page that will force the use of advance mode in the site editing page, implementing your proposal. However, this will result in the loss of some functions in basic mode, such as "Encrypting the website with Let's Encrypt".

@0xJacky 0xJacky added the enhancement New feature or request label Feb 9, 2023
@tufanbarisyildirim
Copy link

Hi @pksml85 can I have your example config file to improve gonginx?

@0xJacky 0xJacky mentioned this issue Apr 8, 2023
Merged
16 tasks
0xJacky added a commit that referenced this issue Apr 11, 2023
@0xJacky
Copy link
Owner

0xJacky commented Apr 11, 2023

Added in defd814.

The system now will save your preference of edior mode. For example, after enabling advanced mode, the next time you enter the editor for this domain, it will use advanced mode by default with no code formatting.

But we still hope you can give us more information of the problems you met, thanks.

@0xJacky 0xJacky closed this as completed Apr 11, 2023
@0xJacky 0xJacky linked a pull request Apr 12, 2023 that will close this issue
Merged
16 tasks
@pksml85
Copy link
Author

pksml85 commented Apr 29, 2023

Hi @pksml85 can I have your example config file to improve gonginx?

Hi @tufanbarisyildirim. Sorry for the delay... but here is the example. GoNginx destroys my location blocks.

Here is my original config code and here is the mangled code from GoNginx

@0xJacky
Copy link
Owner

0xJacky commented Apr 30, 2023

Try to upgrade nginx-ui to v1.8.3? This issue might be fixed in previous version.

@tufanbarisyildirim
Copy link

Hi @0xJacky and @pksml85 can you please test this tufanbarisyildirim/gonginx#18 (issue-17 is the branch) to see if it works for your nginx conf? Thanks again for finding it!

@0xJacky 0xJacky reopened this May 8, 2023
@0xJacky
Copy link
Owner

0xJacky commented May 8, 2023

Thanks @tufanbarisyildirim , now it works perfactly!

截屏2023-05-08 下午9 08 52

截屏2023-05-08 下午9 09 01

@tufanbarisyildirim
Copy link

Thanks for that quick confirmation @0xJacky !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants