mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #73] No code formatting for Manage Sites --> Advanced #7164
Labels
No labels
Q/A
bug
casdoor
dependencies
docker
documentation
duplicate
enhancement
help wanted
invalid
lego
platform:openwrt
platform:windows
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-ui#7164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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!
@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".
@tufanbarisyildirim commented on GitHub (Apr 3, 2023):
Hi @pksml85 can I have your example config file to improve gonginx?
@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.
@pksml85 commented on GitHub (Apr 29, 2023):
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 commented on GitHub (Apr 30, 2023):
Try to upgrade nginx-ui to v1.8.3? This issue might be fixed in previous version.
@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!
@0xJacky commented on GitHub (May 8, 2023):
Thanks @tufanbarisyildirim , now it works perfactly!
@tufanbarisyildirim commented on GitHub (May 8, 2023):
Thanks for that quick confirmation @0xJacky !