Toperlock/sing-box-subscribe

[feature request]: Add a Pre-generated selector group node to include all nodes of the subscribe

muink opened this issue · 4 comments

{
    "subscribes":[
        {
            "url": "https://5gtocdocao.com/api/v1/client/subscribe?token=xx",
            "tag": "airport1_tag",
            "enabled": true,
            "emoji": 0,
            "subgroup": "🙃 5gtocdocao", //Add a selector group node to contain all nodes currently subscribed
            "prefix": "❤️node_name prefix - ",
            "User-Agent":"clashmeta",
        }
    ],
    "auto_set_outbounds_dns":{
        "proxy": "",
        "direct": ""
    },
    "save_config_path": "./config.json",
    "auto_backup": false,
    "exclude_protocol":"ssr",
    "config_template": "",
    "Only-nodes": false
}
  1. Add a option subscribes[*].subgroup for providers.json
    • When subscribes[*].subgroup == "", Pre-generated is disabled.
    • When subscribes[*].subgroup == "🙃 5gtocdocao", the following node will be generated:
{
	"type": "selector",
	"tag": "🙃 5gtocdocao",
	"outbounds": [
		"❤️node_name prefix - node01",
		"❤️node_name prefix - node02"
	]
}
  1. And subscribes[*].subgroup available under Only-nodes: false|true

You don't understand the meaning of "tag": "airport1_tag".
I'll give you an example of provider.json and config_template.
(I think you don't understand the meaning of the tag, so I'll leave it to the default. But the value of this tag is related to the content of config_template)

image

config_template_5gtocdocao_tun_VN.json

{
    "subscribes":[
        {
            "url": "https://gist.githubusercontent.com/Toperlock/b1ca381c32820e8c79669cbbd85b68ac/raw/dafae92fbe48ff36dae6e5172caa1cfd7914cda4/gistfile1.txt",
            "tag": "🙃 5gtocdocao",
            "enabled": true,
            "emoji": 1,
            "prefix": "",
            "User-Agent":"v2rayng"
        },
        {
            "url": "URL",
            "tag": "tag_2",
            "enabled": false,
            "emoji": 0,
            "prefix": "❤️",
            "User-Agent":"clashmeta"
        }
    ],
    "auto_set_outbounds_dns":{
        "proxy": "",
        "direct": ""
    },
    "save_config_path": "./config.json",
    "auto_backup": false,
    "exclude_protocol":"ssr",
    "config_template": "https://github.com/Toperlock/sing-box-subscribe/files/13825122/config_template_no_groups_tun_VN.json",
    "Only-nodes": false
}

eg2: Keep the tags in providers.json unchanged

config_template_5gtocdocao_tun_VN_2.json

{
    "subscribes":[
        {
            "url": "https://gist.githubusercontent.com/Toperlock/b1ca381c32820e8c79669cbbd85b68ac/raw/dafae92fbe48ff36dae6e5172caa1cfd7914cda4/gistfile1.txt",
            "tag": "tag_1",
            "enabled": true,
            "emoji": 1,
            "prefix": "",
            "User-Agent":"v2rayng"
        },
        {
            "url": "URL",
            "tag": "tag_2",
            "enabled": false,
            "emoji": 0,
            "prefix": "❤️",
            "User-Agent":"clashmeta"
        }
    ],
    "auto_set_outbounds_dns":{
        "proxy": "",
        "direct": ""
    },
    "save_config_path": "./config.json",
    "auto_backup": false,
    "exclude_protocol":"ssr",
    "config_template": "https://github.com/Toperlock/sing-box-subscribe/files/13825163/config_template_no_groups_tun_VN_2.json",
    "Only-nodes": false
}

The way to parse using the vercel server is as follows:

https://sing-box-subscribe.vercel.app/config/https://gist.githubusercontent.com/Toperlock/b1ca381c32820e8c79669cbbd85b68ac/raw/dafae92fbe48ff36dae6e5172caa1cfd7914cda4/gistfile1.txt/&file=https://github.com/Toperlock/sing-box-subscribe/files/13825163/config_template_no_groups_tun_VN_2.json

In short, you need to write your own config_template and quote it correctly

RESULT:
image

{
	"type": "selector",
	"tag": "🙃 5gtocdocao",
	"outbounds": [
		"{airport1_tag}"
	]
}

I know what "tag": "airport1_tag" means.
I hope to auto generate bare nodes containing selector node without using config_template
Like this:

{
	"type": "selector",
	"tag": "🙃 5gtocdocao",
	"outbounds": [
		"❤️node_name prefix - node01",
		"❤️node_name prefix - node02"
	]
},
{
	"type": "shadowsocks",
	"tag": "❤️node_name prefix - node01",
	"server": "abcdefghijklmn.com",
	"server_port": 34567,
	"method": "aes-128-gcm",
	"password": "12345678"
},
{
	"type": "shadowsocks",
	"tag": "❤️node_name prefix - node02",
	"server": "abcdefghijklmn.com",
	"server_port": 34567,
	"method": "aes-128-gcm",
	"password": "12345678"
}

try the latest content.

Worked! Thanks lot of.