Старое имя NL_YT_TG_ONLY не совпадало с правилами: это полный туннель, RU идёт напрямую. JSON в базовой подписке включён. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
abca41fd35
commit
e5bebab5d2
4 files changed
+205
No files matched your search
@@ -290,6 +290,48 @@ if [ -z "${host_uuid}" ]; then
|
||||
fi
|
||||
|
||||
users_changed=0
|
||||
|
||||
# Клиентский Xray JSON. Имя Except-RU: весь tcp/udp в proxy, RU/private/торренты и
|
||||
# проверки IP в direct. Блок remnawave панель снимает до выдачи клиенту и
|
||||
# подставляет этот хост как outbound с тегом proxy.
|
||||
if [ -n "${RW_XRAY_TEMPLATE_FILE:-}" ] && [ -f "${RW_XRAY_TEMPLATE_FILE}" ]; then
|
||||
want_tpl=$(jq -c . "${RW_XRAY_TEMPLATE_FILE}")
|
||||
tpl_list=$(api GET /subscription-templates/)
|
||||
tpl_uuid=$(printf '%s' "${tpl_list}" | jq -r --arg n "${RW_XRAY_TEMPLATE_NAME}" '
|
||||
.response.templates[]? | select(.name == $n and .templateType == "XRAY_JSON") | .uuid' | head -1)
|
||||
if [ -z "${tpl_uuid}" ]; then
|
||||
tpl_body=$(jq -n --arg n "${RW_XRAY_TEMPLATE_NAME}" --argjson j "${want_tpl}" \
|
||||
'{name: $n, templateType: "XRAY_JSON", templateJson: $j}')
|
||||
tpl_resp=$(api POST /subscription-templates/ -d "${tpl_body}")
|
||||
tpl_uuid=$(printf '%s' "${tpl_resp}" | jq -r '.response.uuid // empty')
|
||||
if [ -z "${tpl_uuid}" ]; then
|
||||
echo "Не удалось создать шаблон ${RW_XRAY_TEMPLATE_NAME}" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} создан" >&2
|
||||
users_changed=1
|
||||
else
|
||||
tpl_full=$(api GET "/subscription-templates/${tpl_uuid}")
|
||||
current_tpl=$(printf '%s' "${tpl_full}" | jq -cS '.response.templateJson // {}')
|
||||
wanted_tpl=$(jq -cS . "${RW_XRAY_TEMPLATE_FILE}")
|
||||
if [ "${current_tpl}" != "${wanted_tpl}" ]; then
|
||||
upd=$(jq -n --arg u "${tpl_uuid}" --argjson j "${want_tpl}" '{uuid: $u, templateJson: $j}')
|
||||
api PATCH /subscription-templates/ -d "${upd}" >/dev/null
|
||||
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} обновлён" >&2
|
||||
users_changed=1
|
||||
else
|
||||
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} уже совпадает" >&2
|
||||
fi
|
||||
fi
|
||||
bound=$(printf '%s' "${hosts_json}" | jq -r --arg u "${host_uuid}" '.response[]? | select(.uuid == $u) | .xrayJsonTemplateUuid // empty')
|
||||
if [ "${bound}" != "${tpl_uuid}" ]; then
|
||||
host_bind=$(jq -n --arg u "${host_uuid}" --arg t "${tpl_uuid}" '{uuid: $u, xrayJsonTemplateUuid: $t}')
|
||||
api PATCH /hosts/ -d "${host_bind}" >/dev/null
|
||||
echo "Хост ${RW_SELFSTEAL} привязан к шаблону ${RW_XRAY_TEMPLATE_NAME}" >&2
|
||||
users_changed=1
|
||||
fi
|
||||
fi
|
||||
|
||||
squad_uuid=$(api GET /internal-squads/ | jq -r --arg n "Default-Squad" '
|
||||
.response.internalSquads[]? | select(.name == $n) | .uuid' | head -1)
|
||||
if [ -n "${squad_uuid}" ] && [ -n "${inbound_uuid}" ]; then
|
||||
@@ -317,6 +359,7 @@ settings=$(api GET /subscription-settings/ || echo '')
|
||||
if [ -n "${settings}" ]; then
|
||||
patched=$(printf '%s' "${settings}" | jq '
|
||||
.response
|
||||
| .serveJsonAtBaseSubscription = true
|
||||
| .responseRules.rules = (
|
||||
[
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user