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

Optional json sub #890

Merged
merged 8 commits into from
May 19, 2024
Merged

Conversation

thenorthatlantic
Copy link
Contributor

Added a simple 'env' option to allow for optional JSON configuration in subscriptions.

add V2RAY_USE_JSON
check V2RAY_USE_JSON
add V2RAY_USE_JSON
@M03ED
Copy link
Collaborator

M03ED commented Mar 25, 2024

may i ask why you avoid using custom config ?
also you can do same thing with adding /v2ray to end of your sub link

@thenorthatlantic
Copy link
Contributor Author

@M03ED it's advantageous to have that option as optional.
In v2rayNG, custom configurations lacks the QR code share feature.
When using the /v2ray sub, users encounter difficulty accessing the template page.

I also had an idea of checking if V2RAY_SUBSCRIPTION_TEMPLATE was not set to "false" and providing JSON, but I wasn't sure if that would conflict with other parts of the code. If you believe that checking V2RAY_SUBSCRIPTION_TEMPLATE wouldn't cause problems, I will modify the code accordingly, so there is no need to add extra option in env.

@M03ED
Copy link
Collaborator

M03ED commented Mar 25, 2024

@M03ED it's advantageous to have that option as optional.

This can't be called an advantage
Costum configs have way more advantages
Using fragment and mux for single config instead of all configs, allow insecure , make ir domains direct and lot's of more options you can have
You can use custom config and set these settings for your users easily or you need to have physical access to there mobile to do them manually

In v2rayNG, custom configurations lacks the QR code share feature.

Share sub link instead of config

@mikeesierrah
Copy link
Contributor

@M03ED You are right custom configs are way better and I prefer them

But I understand his pov and he does have point
I hope marzban doesn't lose flexibility
by forcing a feature that some people might not want to have , for any reason,
And it's not like it will mess with GUI , it's a part of env

@M03ED
Copy link
Collaborator

M03ED commented Mar 25, 2024

@M03ED You are right custom configs are way better and I prefer them

But I understand his pov and he does have point I hope marzban doesn't lose flexibility by forcing a feature that some people might not want to have , for any reason, And it's not like it will mess with GUI , it's a part of env

we discuss about this before , check #782

@M03ED
Copy link
Collaborator

M03ED commented Mar 25, 2024

check this one too
XTLS/Xray-core#3076 (comment)

@fodhelper
Copy link
Contributor

fodhelper commented Mar 28, 2024

Custom config added to future version of v2rayN (not released yet), we will need something like this for v2rayN, because custom config will disable it's url-test/real-delay
but for v2rayNG, i see no important reason

@SaintShit
Copy link
Contributor

Personally, I prefer custom json config to be disabled by default. I like this configuration variable, but the implementation is a little bit wrong.
Please rename the variable to "USE_CUSTOM_JSON_DEFAULT" and set it's default value to False. Also, add some detail on the variable comments that what this supposed to do.

@@ -93,7 +94,7 @@ def get_subscription_user_info(user: UserResponse) -> dict:

elif re.match('^v2rayNG/(\d+\.\d+\.\d+)', user_agent):
version_str = re.match('^v2rayNG/(\d+\.\d+\.\d+)', user_agent).group(1)
if LooseVersion(version_str) >= LooseVersion("1.8.16"):
if LooseVersion(version_str) >= LooseVersion("1.8.16") and V2RAY_USE_JSON.lower() != "false":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that this is a boolean variable, so comparing this way is not suitable.

@SaintShit
Copy link
Contributor

custom json is also supported in Streisand, we should add support for it too.

@thenorthatlantic
Copy link
Contributor Author

@SaintShit Thank you for your guidance; I attempted to follow your advice.
Unfortunately, Streisand doesn't have an app version in its user-agent.

@M03ED
Copy link
Collaborator

M03ED commented Apr 4, 2024

@SaintShit Thank you for your guidance; I attempted to follow your advice.
Unfortunately, Streisand doesn't have an app version in its user-agent.

You can add it like v2rayng

@SaintShit SaintShit merged commit 43a669c into Gozargah:dev May 19, 2024
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

Successfully merging this pull request may close these issues.

5 participants