Files
3x-ui/docs
Jack 9672249edb feat(clients): add calendar weekly renewal and schedule previews (#6524)
* feat(clients): add calendar weekly renewal and schedule previews

Expose fixed-day, calendar-weekly, calendar-monthly, and disabled renewal
through one shared selector in individual and bulk client forms. Store the
weekly weekday separately (Monday 1 through Sunday 7) and use panel-local
calendar dates rather than a fixed 168-hour duration. Resolve skipped or
repeated midnights to the first valid instant of the selected date, and skip
an entirely nonexistent calendar date rather than changing the weekday.

Reuse the existing renewal writer and share its boundary alignment and
per-period catch-up calculation with an authenticated, read-only preview.
Keep monthly precedence for legacy records, fixed-day interval semantics,
maximum renewal allowances, first-use durations, and operator-disabled
settings unchanged. Selecting a mode does not rewrite an existing cutoff;
an unset calendar cutoff requires an explicit action to choose the first.
The last-valid-second preview uses the stored exclusive expiry, even when
the billing calculation aligns a legacy last-second cutoff up to midnight.

Carry weekly schedules through client persistence, paging, enable toggles,
inbound settings, and node traffic reconciliation. Migrate missing or nullable
weekday columns to disabled by default without altering existing limits, and
include the new isolated-schema PostgreSQL regression in the live CI gate.

Regenerate API contracts and reference documentation, add lifecycle and form
regressions, and document timezone, quota-reset, and upgrade considerations.
All participating nodes must be upgraded before weekly mode is enabled;
older binaries ignore the new field. Independent periodic traffic resets and
the optional month-end subscription-header display are not changed.

* fix(clients): validate renewal schedules across inbound write paths

Reject conflicting weekly/interval/monthly schedules and out-of-range
weekdays on inbound creation and edits, legacy one-client apply paths,
record/link synchronization, and traffic metadata writes. Validate imported
traffic snapshots as well, before any inbound or client is persisted, so
an inbound API cannot create a client that the clients page cannot toggle.

Merge a weekly-related schedule as one timestamp-selected tuple rather
than filling its zero fields from another renewal mode. Preserve empty
migration snapshots and the existing non-weekly monthly/interval merge
semantics. Renewal caps, counters, credentials, and deadlines are unchanged.

Add regressions for nine write paths, unchanged records and runtime calls
after rejection, valid inbound clients remaining editable, and duplicate
record merges between individually valid renewal modes.

* docs(clients): clarify depleted-client deletion risks on downgrade

Explain in English and Chinese that older versions not only stop weekly
renewal: their depleted-client cleanup can delete a weekly-only client once
its expiry or quota is exhausted. This is conditional on cleanup, not an
automatic deletion caused by downgrade itself.

Recommend backing up and converting weekly schedules to a mode supported
by every participating version before rollback, and avoiding cleanup while
mixed versions or unconverted clients remain. Merely disabling weekly
renewal does not restore the old binary's missing purge protection.

* fix(clients): bound weekly renewal date searches

Limit the search for a valid weekly calendar date to eight candidates so
an unusual timezone cannot monopolize the single traffic writer. Exhaustion
returns the original instant, allowing the existing catch-up forward-progress
guard to stop without advancing expiry, consuming an allowance, resetting
traffic, or falling back to a fixed-duration schedule that can drift.

Reject a non-future calendar suggestion in the read-only preview instead of
offering an immediately expired initial cutoff. Also report failed weekly
catch-up as a search error when allowances remain, not as cap exhaustion.
Existing preview errors use the form's current warning; no API schema or
locale changes are needed.

Exercise exhaustion with a synthetic valid TZif containing twelve skipped
Sundays. This fault-injection case was red without the bound; it is not a
claim that a production IANA timezone was observed hanging. Keep the Havana
and Apia regressions for real skipped/repeated midnights and absent dates.

* fix(tests): isolate weekly renewal preview timezone

Stop the weekly search regression from replacing process-global time.Local.
CI caught that assignment and its cleanup racing with background timer reads
through time.Now, even though the top-level tests do not use t.Parallel.

Pass the timezone and current instant into the unchanged preview calculation.
The public service still validates the request and resolves the panel timezone;
API responses, renewal accounting, and persisted client data are unchanged.

Use fixed dates for both suggestion and catch-up exhaustion, removing the
test's dependency on today's date and its unnecessary database setup. Keep a
bounded-lifetime background clock reader to expose future global-timezone
mutations under the existing race gate rather than disabling that check.

* ci: retrigger PR checks

Create an empty commit to request a fresh pull-request CI run after release dependency downloads failed with network errors.

No source, dependency, or workflow changes are included. Retry the existing checks without bypassing them.

* ci: retry PR checks and record deferred download hardening

Request another CI run after the amd64 release job compiled successfully but failed during dependency fetching with exit code 4 (network failure).

Record possible follow-up improvements for the Linux release fetch helper:
- Print each download URL and destination, and preserve error details.
- Reuse the existing curl configuration with up to five retries; add connection and per-attempt timeouts and a bounded retry window.
- Download to a temporary file and promote it to the final filename only after a successful, non-empty transfer. Keep the job failing if downloads ultimately fail.
- Validate successful downloads, recovery after a temporary failure, and correct failure after persistent errors before shipping such a change.

These improvements are intentionally deferred, not implemented or tested by this commit. This commit is empty: renewal logic, dependencies, workflow configuration, check requirements, and TLS verification remain unchanged.

---------

Co-authored-by: JacktheRanger <219502738+JacktheRanger@users.noreply.github.com>
2026-09-26 22:59:23 +02:00
..
2026-07-09 00:45:35 +02:00

3x-ui

3x-ui Documentation

The official documentation and product site for 3x-ui — an advanced web panel for managing Xray-core servers.

Live site CI License: GPL-3.0 Next.js 16 Fumadocs 16

Read the docs →


Overview

This directory (docs/ in the 3x-ui monorepo) contains the source for docs.sanaei.dev — a static-first documentation and marketing site built with Fumadocs on Next.js. It has no backend, no database, and no auth: every page is prerendered and every tool runs entirely in the browser.

What's inside

The documentation walks you through 3x-ui from first install to day-to-day operation:

  • Getting Started — installation, first login, and updating or uninstalling the panel.
  • Configuration — the panel, inbounds, REALITY, transports, clients, subscriptions, and share links.
  • Operations — reverse proxy, multi-node setups, outbounds & routing, backup/restore, Telegram and Discord bots, and security.
  • Reference — environment variables, the database, ports & firewall, and the HTTP API.
  • Help — troubleshooting, FAQ, migration, and how to contribute.

Interactive tools

The site ships with in-browser helpers that generate configuration for you — no data ever leaves your browser:

Tool What it does
REALITY Config Generator Build a valid REALITY inbound configuration.
Share Link Inspector Decode and inspect vless:// / vmess:// share links.
Install Command Builder Assemble the right install command for your setup.
Reverse Proxy Generator Generate reverse-proxy configs (Nginx / Caddy).
Protocol Wizard Pick and configure the right protocol for your needs.
Firewall Rules Generator Produce firewall rules for your ports.

Tech stack

Layer Technology
Framework Next.js 16 (App Router) · React 19
Docs Fumadocs (-ui / -core / -mdx)
Styling Tailwind CSS v4
Search Orama static index
Language TypeScript (strict)
Tests Vitest for the pure lib/xray logic
Tooling pnpm · oxlint · oxfmt

Quick start

This project uses pnpm (npm lockfiles are gitignored). Run everything from the docs/ directory:

cd docs
pnpm install
pnpm dev        # http://localhost:3000

Useful scripts:

Script Description
pnpm dev Start the dev server
pnpm build Production build (also typechecks)
pnpm typecheck Generate MDX/route types and tsc --noEmit
pnpm lint Run oxlint (.oxlintrc.json)
pnpm test Run unit tests (Vitest)

See CONTRIBUTING.md for the full list and project conventions.

Project structure

app/             # Next.js App Router — layouts, home, docs, OG images, search, llms.txt
components/      # React components — interactive tools, home sections, MDX bindings
content/docs/    # MDX documentation, one folder per locale (en · fa · ru · zh)
lib/             # source config, i18n, GitHub stats, and the unit-tested lib/xray logic
public/          # static assets — logos, favicon, openapi.json, CNAME
scripts/         # build-time scripts (API reference generation)
source.config.ts # Fumadocs MDX schema & collection config
next.config.mjs  # Next.js config (static-export gating)
proxy.ts         # i18n middleware

Internationalization

Documentation is authored in English. Persian (fa, RTL), Russian (ru), and Chinese (zh) locales are wired up; untranslated pages fall back to English so they never 404. English URLs are unprefixed; other locales live under /fa, /ru, /zh.

Deployment

The site builds for two targets:

  • Vercel / Node — pnpm build (static search index + prerendered OG images).
  • GitHub Pages (static export) — DEPLOY_TARGET=static pnpm build → out/.

Contributing

Contributions are welcome! Setup, scripts, and project conventions live in CONTRIBUTING.md.

License

Licensed under GPL-3.0.