3x-ui/docs/Tasktracking/2026-04-24-fix-mariadb-json-each-compat.md
root f5862abc2e feat: add CodeMirror YAML editor for Clash template and fix settings save button bug
- Replace plain textarea with CodeMirror editor (YAML syntax highlighting, line numbers, auto-indent) for Clash subscription template
- Fix confAlerts crash when subClashURI/subURI/subJsonURI is null/undefined (prevented save button from enabling)
- Add yaml.js CodeMirror mode asset
- Include docs and .gitignore cleanup
2026-04-24 16:15:22 +08:00

879 B

fix: MariaDB JSON_EACH compatibility for subscription and traffic queries

Date: 2026-04-24

Problem

Subscription endpoint (/sub/:subid, /json/:subid) returns Error! on MariaDB. Root cause: JSON_EACH is SQLite-only; MariaDB requires JSON_TABLE.

Changes

sub/subService.go

  • getInboundsBySubId: branch SQL by DB type — JSON_TABLE for MariaDB, JSON_EACH for SQLite
  • getFallbackMaster: same branching for fallback query
  • Added config import for GetDBTypeFromJSON()

web/service/inbound.go

  • GetClientTrafficByID: branch SQL by DB type
  • MigrationRemoveOrphanedTraffics: branch SQL by DB type
  • Added config import

config/version

  • Bump to v1.5.1

Not in scope

  • getAllEmails() (TG Bot) — same issue, deferred

Verification

  • go build ./... passes
  • go test ./... all pass
  • go vet ./sub/ ./web/service/ clean