[GH-ISSUE #73] No code formatting for Manage Sites --> Advanced #5820

Closed
opened 2026-03-01 17:07:14 +03:00 by kerem · 8 comments
Owner

Originally created by @pksml85 on GitHub (Feb 1, 2023).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/73

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!

Originally created by @pksml85 on GitHub (Feb 1, 2023). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/73 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!
kerem 2026-03-01 17:07:14 +03:00
Author
Owner

@0xJacky commented on GitHub (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".

<!-- gh-comment-id:1413098201 --> @0xJacky commented on GitHub (Feb 2, 2023): We use [gonginx](https://github.com/tufanbarisyildirim/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".
Author
Owner

@tufanbarisyildirim commented on GitHub (Apr 3, 2023):

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

<!-- gh-comment-id:1494041089 --> @tufanbarisyildirim commented on GitHub (Apr 3, 2023): Hi @pksml85 can I have your example config file to improve [gonginx](https://github.com/tufanbarisyildirim/gonginx)?
Author
Owner

@0xJacky commented on GitHub (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.

<!-- gh-comment-id:1502893707 --> @0xJacky commented on GitHub (Apr 11, 2023): Added in [defd814](https://github.com/0xJacky/nginx-ui/commit/defd81461e7fe70a98a10dabea46f3e5a08f22a3). 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.
Author
Owner

@pksml85 commented on GitHub (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

<!-- gh-comment-id:1528894406 --> @pksml85 commented on GitHub (Apr 29, 2023): > Hi @pksml85 can I have your example config file to improve [gonginx](https://github.com/tufanbarisyildirim/gonginx)? Hi @tufanbarisyildirim. Sorry for the delay... but here is the example. GoNginx destroys my location blocks. Here is [my original config code](https://pastebin.com/aXW7e8tC) and here is the [mangled code from GoNginx](https://pastebin.com/tjFakDHE)
Author
Owner

@0xJacky commented on GitHub (Apr 30, 2023):

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

<!-- gh-comment-id:1528923306 --> @0xJacky commented on GitHub (Apr 30, 2023): Try to upgrade nginx-ui to v1.8.3? This issue might be fixed in previous version.
Author
Owner

@tufanbarisyildirim commented on GitHub (May 8, 2023):

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

<!-- gh-comment-id:1538220873 --> @tufanbarisyildirim commented on GitHub (May 8, 2023): Hi @0xJacky and @pksml85 can you please test this https://github.com/tufanbarisyildirim/gonginx/pull/18 (issue-17 is the branch) to see if it works for your nginx conf? Thanks again for finding it!
Author
Owner

@0xJacky commented on GitHub (May 8, 2023):

Thanks @tufanbarisyildirim , now it works perfactly!

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

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

<!-- gh-comment-id:1538337572 --> @0xJacky commented on GitHub (May 8, 2023): Thanks @tufanbarisyildirim , now it works perfactly! ![截屏2023-05-08 下午9 08 52](https://user-images.githubusercontent.com/13096985/236832738-aa7e0b15-2667-45e6-8b60-c05f29234dce.png) ![截屏2023-05-08 下午9 09 01](https://user-images.githubusercontent.com/13096985/236832804-343b11ff-3f9a-4816-b07d-60094c090ba9.png)
Author
Owner

@tufanbarisyildirim commented on GitHub (May 8, 2023):

Thanks for that quick confirmation @0xJacky !

<!-- gh-comment-id:1538703619 --> @tufanbarisyildirim commented on GitHub (May 8, 2023): Thanks for that quick confirmation @0xJacky !
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#5820
No description provided.