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

Wireguard config import broken on minified Lua (Experimental Feature) #127

Closed
TheBlueJester opened this issue Jan 2, 2023 · 2 comments
Closed

Comments

@TheBlueJester
Copy link

Hey!

I understand that the Minify feature is experimental, I don't expect it to work flawlessly.
Just trying to help out with this issue report.

When Minify is ON trying to import Wireguard configs gives the following 2 errors:
1: "Failed to import filename.conf: Name contains invalid characters"
2: "Some parameters failed validation"

If you turn Minify OFF and try to import the same file it will work.
You can then turn Minify ON and Wireguard will run properly with the already imported configuration.

I don't know how the Minify works currently, if it just runs the entire code through a published library and if there is the ability to skip particular sections of the code?

But even just putting a note about turning it off and then back on in the Wireguard instructions would be a pretty reasonable solution to me.

Thanks for all the hard work!

Wireguard Issue

@seud0nym
Copy link
Owner

seud0nym commented Jan 3, 2023

Thank you, I do appreciate the report.

The problem is that the code that removes invalid characters from the filename to create a valid interface name contained a character sequence that the minification code interpreted as a comment, so it removes that sequence and breaks the check. I just had to re-order the characters to fix it.

The fixed extras script is available now. You can download and install it with:

./tch-gui-unhide -x wireguard -y

There are no changes to tch-gui-unhide or the minifier, so you don't need to download a new installer.

I don't know how the Minify works currently, if it just runs the entire code through a published library and if there is the ability to skip particular sections of the code?

There are 2 phases, because the issue is that it is dealing with 3 different languages: mainly Lua, but there is embedded HTML and JavaScript as well. The first phase is a simple optimisation of the HTML and JavaScript code (removing line breaks, extra spaces, comments, etc.) that can't be done by a library because it is embedded in the Lua code as Lua strings, and contains Lua escape characters which would break an optimiser. This is the main reason it is experimental, and the main source of minification bugs (as in the issue you found). The second phase is minification of the Lua code by a published library. That is pretty solid and I haven't had any issues with that at all.

@TheBlueJester
Copy link
Author

I can happily report that it's solved the issue for me, hopefully for everyone 👍

Extracting the HTML and JavaScript sounds like a pain in the butt.
I am familiar with them, but I can't imagine my ideas wouldn't have already been thought of by someone with your level of experience :P

Anyway, thanks for all your hard work!
I've very much enjoyed playing around with these modems.

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

No branches or pull requests

2 participants