Repository navigation
fix(payments,sub,api): webhook deduplication, HWID race guard, panic elimination, Hysteria2/Trojan/SS/gRPC/HTTPUpgrade/XHTTP support, Remnawave directives - #2
Open
reelsmaker2026 wants to merge 9 commits into
Conversation
…ts and eliminate panics
…section with parity tests
…indow_start index
…ish manual checkout ux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR bundles a set of reliability fixes and subscription-format extensions developed in the
reelsmaker2026fork. All changes are backward-compatible and do not alter existing database schemas beyond an additive index.Commits in this PR
8c1f5ae805db28a518f9bb9e05c882dbf1f3f80c4243365dd36be4b99901a9cTotal: 28 files changed, +1 120 / -102 lines
Changes
1 — Webhook deduplication & payment-provider fixes (
8c1f5ae)Files:
crates/payments/src/providers/cryptobot.rs,crates/payments/src/providers/generic_http.rs,crates/api/src/pay_routes.rs,crates/api/src/catalog_routes.rs,crates/payments/tests/webhook_regression.rsunwrap()calls onOptionincatalog_routes.rsandprofile_workflow.rsreplaced with proper?propagation, preventing unhandled panics under edge-case inputs.webhook_regression.rs, 183 lines): covers idempotent replay, correct amount extraction, and provider-level error paths.2 — HWID race condition fix (
b9e05c8)Files:
crates/api/src/sub_routes.rs,crates/sub/src/main.rs,web/app/app.js,web/app/customer-en.js,web/app/customer-ui.jsSELECT ... FOR UPDATEinside a transaction. Previously, concurrent subscription requests for the same client (e.g., two devices connecting at the same moment) could both pass the device-limit check before either inserted its row, resulting in over-limit device registration.usedandknowncounts inside the same transaction — concurrent admissions are fully serialized without deadlock risk.3 — Auth rate-limit performance (
a518f9b)Files:
crates/api/src/cabinet.rs,crates/api/src/security.rs,crates/worker/src/main.rs,db/migrations/049_auth_limits_index.sqlwindow_startindex (migration049) to make expiry sweeps efficient even with large auth-attempt tables.4 — Dynamic theme auto-detection & cabinet help section (
805db28)Files:
web/theme.js,web/help.js,web/help-en.js,devtools/tests/help-parity.test.cjs,.gitignore,Makefileprefers-color-schememedia query) intheme.js.help-en.js).help-parity.test.cjs) ensuring RU/EN help strings stay in sync.5 — Remnawave template directives (
82dbf1f+3f80c42)Files:
crates/sub/src/policy.rs,crates/sub/Cargo.toml,web/subscription-studio.jsinjectHosts: merges an operator-supplied hosts map into the outbound proxy objects in Sing-Box / Clash templates, without overwriting unrelated keys.include-proxies: filters the generated proxy list down to a named subset, allowing per-user or per-plan subscription templates.3f80c42) where the directive processor incorrectly inserted into a JSON array instead of the object's map entry, causing malformed output for nested object values.6 — Pre-flight auto-download of Xray geodata assets (
43365dd)Files:
crates/node/src/engine_update.rs,crates/node/src/main.rsgeoip.dat,geosite.dat) before the node engine starts, eliminating a common manual setup step and preventing startup failures on fresh nodes.7 — Protocol support: Hysteria2, Trojan, Shadowsocks (
36be4b9)Files:
crates/sub/src/formats.rsExtended the Clash and Sing-Box subscription serializers to emit correct proxy objects for:
hysteria2proxy type withup/downbandwidth, obfs, pinned certhysteria2outboundtrojanproxy type with TLS settingstrojanoutboundssproxy type with cipher and passwordshadowsocksoutboundPreviously these protocols were silently omitted from generated subscription links, causing clients to show empty proxy lists when the node operator used them.
8 — Transport support: gRPC, HTTPUpgrade, XHTTP (
9901a9c)Files:
crates/sub/src/formats.rsAdded transport-layer mapping inside the Clash / Sing-Box serializers:
grpc-optswithgrpc-service-namegrpctransport withservice_namehttp-optswith upgrade headershttpupgradetransportnetwork: xhttpwith path/hostxhttptransportThese transports are increasingly common in censorship-resilient deployments; without them, subscription links generated by the panel were unusable for nodes configured with non-WebSocket transports.
Testing
crates/payments/tests/webhook_regression.rs— 183-line regression suite covering webhook replay, amount parsing, and provider errors (new)devtools/tests/help-parity.test.cjs— 60-line parity tests for RU/EN help strings (new)Migration
Only one additive migration is included:
No existing columns are altered, no data is touched.
Checklist
cargo check --workspaceunwrap()onOption/Resultin hot paths🇷🇺 Описание изменений (на русском языке)
Данный PR объединяет набор исправлений надёжности и расширений форматов подписок, разработанных в форке
reelsmaker2026. Все изменения обратно совместимы и не затрагивают схему БД за исключением одного дополнительного индекса.Содержимое PR:
Дедупликация вебхуков и фиксы платежей (
8c1f5ae):unwrap()вcatalog_routes.rsиprofile_workflow.rsзаменены на безопасный оператор?).webhook_regression.rs, 183 строки).Устранение race condition при регистрации HWID (
b9e05c8):SELECT ... FOR UPDATEвнутри транзакции. Исключена ситуация, когда параллельные запросы с разных устройств одновременно проходили проверку лимита до записи в базу.Оптимизация проверки лимитов авторизации (
a518f9b):window_start(миграция049) для быстрого удаления устаревших записей.Автоопределение темы и справка в кабинете (
805db28):prefers-color-scheme).Шаблонные директивы совместимости с Remnawave (
82dbf1f+3f80c42):injectHosts(подмешивание карты хостов оператора в исходящие прокси) иinclude-proxies(фильтрация списка прокси). Исправлена вставка в мапу JSON-объекта.Автозагрузка геобаз Xray перед запуском (
43365dd):geoip.datиgeosite.dat.Поддержка протоколов подписок: Hysteria2, Trojan, Shadowsocks (
36be4b9):Поддержка транспортов: gRPC, HTTPUpgrade, XHTTP (
9901a9c):