### Enable and Start Marzban Systemd Service Source: https://github.com/gozargah/marzban/blob/master/README.md Enables the Marzban systemd service to start automatically on boot and immediately starts the service. This command assumes the `marzban.service` file has been copied to the correct location. ```bash systemctl enable /var/lib/marzban/marzban.service systemctl start marzban ``` -------------------------------- ### Install Marzban with marzban-scripts Source: https://github.com/gozargah/marzban/blob/master/README.md This command installs the latest version of Marzban using the recommended `marzban-scripts`. It fetches and executes a shell script from the GitHub repository, streamlining the initial setup process for new deployments. ```bash sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install-script ``` -------------------------------- ### Manually Launch Marzban Application Source: https://github.com/gozargah/marzban/blob/master/README.md Starts the Marzban application by running its main Python script. This command launches the server after all dependencies and configurations are set up. ```bash python3 main.py ``` -------------------------------- ### Manually Copy and Edit Marzban Environment File Source: https://github.com/gozargah/marzban/blob/master/README.md Copies the example environment configuration file (`.env.example`) to `.env` and opens it for editing using `nano`. This file contains critical application settings, including admin credentials. ```bash cp .env.example .env nano .env ``` -------------------------------- ### Display Marzban Installation Script Help Source: https://github.com/gozargah/marzban/blob/master/README.md Shows the help message for the Marzban installation script, providing information on available commands and options. ```bash marzban --help ``` -------------------------------- ### Marzban CLI Basic Command Usage Source: https://github.com/gozargah/marzban/blob/master/README.md Demonstrates the general syntax for interacting with the Marzban command-line interface, showing how to use options, commands, and arguments for direct administration. ```bash marzban cli [OPTIONS] COMMAND [ARGS]... ``` -------------------------------- ### Install Marzban with SQLite Database Source: https://github.com/gozargah/marzban/blob/master/README.md Installs the Marzban application using the official installation script, configuring it to use an SQLite database by default. This is the simplest installation method. ```bash sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install ``` -------------------------------- ### Setup Marzban Backup Service Source: https://github.com/gozargah/marzban/blob/master/README.md This command initializes and configures Marzban's integrated backup service. The service efficiently zips necessary files, supports various databases (SQLite, MySQL, MariaDB), and can automate scheduled backups, including splitting large files for Telegram uploads. ```bash marzban backup-service ``` -------------------------------- ### Install Marzban with MariaDB Database Source: https://github.com/gozargah/marzban/blob/master/README.md Installs the Marzban application using the official installation script, explicitly configuring it to use a MariaDB database. This requires a pre-existing MariaDB server. ```bash sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mariadb ``` -------------------------------- ### Install Marzban with MySQL Database Source: https://github.com/gozargah/marzban/blob/master/README.md Installs the Marzban application using the official installation script, explicitly configuring it to use a MySQL database. This requires a pre-existing MySQL server. ```bash sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql ``` -------------------------------- ### Manually Install Xray Core Source: https://github.com/gozargah/marzban/blob/master/README.md Installs the Xray core, a dependency for Marzban, using its official installation script. This is part of the advanced manual installation process. ```bash bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install ``` -------------------------------- ### Example Marzban Webhook Notification Request Source: https://github.com/gozargah/marzban/blob/master/README.md Illustrates the structure of a POST request sent by Marzban for webhook notifications. This example includes the required headers, such as 'x-webhook-secret', and the JSON body containing user action details like 'user_updated'. ```text Headers: Host: 0.0.0.0:9000 User-Agent: python-requests/2.28.1 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive x-webhook-secret: something-very-very-secret Content-Length: 107 Content-Type: application/json Body: {"username": "marzban_test_user", "action": "user_updated", "enqueued_at": 1680506457.636369, "tries": 0} ``` -------------------------------- ### Manually Clone Marzban Project and Install Python Dependencies Source: https://github.com/gozargah/marzban/blob/master/README.md Clones the Marzban project repository, navigates into the directory, and installs Python dependencies using pip. This step is required for running Marzban from source. ```bash git clone https://github.com/Gozargah/Marzban.git cd Marzban wget -qO- https://bootstrap.pypa.io/get-pip.py | python3 - python3 -m pip install -r requirements.txt ``` -------------------------------- ### Manually Link Marzban CLI and Install Autocompletion Source: https://github.com/gozargah/marzban/blob/master/README.md Creates a symbolic link for the `marzban-cli.py` script to `/usr/bin/marzban-cli`, makes it executable, and installs shell autocompletion for convenience. This integrates the CLI into the system's PATH. ```bash sudo ln -s $(pwd)/marzban-cli.py /usr/bin/marzban-cli sudo chmod +x /usr/bin/marzban-cli marzban-cli completion install ``` -------------------------------- ### Initiate Immediate Marzban Backup Source: https://github.com/gozargah/marzban/blob/master/README.md This command triggers an immediate backup of all essential Marzban files and data. It's useful for on-demand backups outside of scheduled operations, ensuring critical data is saved promptly. ```bash marzban backup ``` -------------------------------- ### Manually Run Marzban Database Migrations Source: https://github.com/gozargah/marzban/blob/master/README.md Executes the Alembic database migration scripts to set up or update the Marzban database schema. This is a crucial step after setting up the project and before launching the application. ```bash alembic upgrade head ``` -------------------------------- ### Create Sudo Admin User for Marzban Dashboard Source: https://github.com/gozargah/marzban/blob/master/README.md Uses the Marzban command-line interface (CLI) to create a new administrator account with sudo privileges, which is required for logging into the Marzban dashboard. ```bash marzban cli admin create --sudo ``` -------------------------------- ### Nginx Proxy Configuration for Marzban Dashboard and API Source: https://github.com/gozargah/marzban/blob/master/README.md Provides an Nginx server block configuration to proxy requests to the Marzban application, including SSL setup and specific location rules for dashboard, API, and Xray WebSocket traffic. It handles routing based on paths and ports. ```nginx server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location ~* /(dashboard|statics|sub|api|docs|redoc|openapi.json) { proxy_pass http://0.0.0.0:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # xray-core ws-path: / # client ws-path: /marzban/me/2087 # # All traffic is proxed through port 443, and send to the xray port(2087, 2088 etc.). # The '/marzban' in location regex path can changed any characters by yourself. # # /${path}/${username}/${xray-port} location ~* /marzban/.+/(.+)$ { proxy_redirect off; proxy_pass http://127.0.0.1:$1/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; } ``` -------------------------------- ### Marzban Configuration Variables Source: https://github.com/gozargah/marzban/blob/master/README.md This section details the various environment variables used to configure Marzban's behavior, including notification settings, user auto-deletion, and custom JSON client configurations. Understanding these variables is crucial for customizing Marzban to specific operational needs. ```APIDOC NUMBER_OF_RECURRENT_NOTIFICATIONS: How many times to retry if an error detected in sending a notification (default: 3) RECURRENT_NOTIFICATIONS_TIMEOUT: Timeout between each retry if an error detected in sending a notification in seconds (default: 180) NOTIFY_REACHED_USAGE_PERCENT: At which percentage of usage to send the warning notification (default: 80) NOTIFY_DAYS_LEFT: When to send warning notifaction about expiration (default: 3) USERS_AUTODELETE_DAYS: Delete expired (and optionally limited users) after this many days (Negative values disable this feature, default: -1) USER_AUTODELETE_INCLUDE_LIMITED_ACCOUNTS: Whether to include limited accounts in the auto-delete feature (default: False) USE_CUSTOM_JSON_DEFAULT: Enable custom JSON config for ALL supported clients (default: False) USE_CUSTOM_JSON_FOR_V2RAYNG: Enable custom JSON config only for V2rayNG (default: False) USE_CUSTOM_JSON_FOR_STREISAND: Enable custom JSON config only for Streisand (default: False) USE_CUSTOM_JSON_FOR_V2RAYN: Enable custom JSON config only for V2rayN (default: False) ``` -------------------------------- ### Accessing Marzban REST API Documentation Source: https://github.com/gozargah/marzban/blob/master/README.md Marzban provides a REST API for programmatic interaction. Developers can access the API documentation via Swagger UI or ReDoc by setting the `DOCS=True` configuration variable and navigating to the `/docs` or `/redoc` endpoints respectively. This enables exploration of available endpoints and data models. ```APIDOC To view Marzban REST API documentation: - Set configuration variable: DOCS=True - Navigate to: /docs (Swagger UI) or /redoc (ReDoc) ``` -------------------------------- ### Start Marzban Dashboard Development Server Source: https://github.com/gozargah/marzban/blob/master/app/dashboard/README.md Execute this command to launch the local development server for the Marzban Dashboard UI. This allows developers to preview changes in real-time during development. ```Shell yarn dev ``` -------------------------------- ### Application Environment Variables Source: https://github.com/gozargah/marzban/blob/master/README.md Detailed list of environment variables used to configure various aspects of the application, including security, database, server binding, Xray integration, template paths, Telegram bot settings, JWT expiration, and debugging options. Default values are provided where applicable. ```APIDOC Environment Variables: - SUDO_USERNAME: Superuser's username - SUDO_PASSWORD: Superuser's password - SQLALCHEMY_DATABASE_URL: Database URL (SQLAlchemy's docs) - UVICORN_HOST: Bind application to this host (default: 0.0.0.0) - UVICORN_PORT: Bind application to this port (default: 8000) - UVICORN_UDS: Bind application to a UNIX domain socket - UVICORN_SSL_CERTFILE: SSL certificate file to have application on https - UVICORN_SSL_KEYFILE: SSL key file to have application on https - UVICORN_SSL_CA_TYPE: Type of authority SSL certificate. Use 'private' for testing self-signed CA (default: public) - XRAY_JSON: Path of Xray's json config file (default: xray_config.json) - XRAY_EXECUTABLE_PATH: Path of Xray binary (default: /usr/local/bin/xray) - XRAY_ASSETS_PATH: Path of Xray assets (default: /usr/local/share/xray) - XRAY_SUBSCRIPTION_URL_PREFIX: Prefix of subscription URLs - XRAY_FALLBACKS_INBOUND_TAG: Tag of the inbound that includes fallbacks, needed in the case you're using fallbacks - XRAY_EXCLUDE_INBOUND_TAGS: Tags of the inbounds that shouldn't be managed and included in links by application - CUSTOM_TEMPLATES_DIRECTORY: Customized templates directory (default: app/templates) - CLASH_SUBSCRIPTION_TEMPLATE: The template that will be used for generating clash configs (default: clash/default.yml) - SUBSCRIPTION_PAGE_TEMPLATE: The template used for generating subscription info page (default: subscription/index.html) - HOME_PAGE_TEMPLATE: Decoy page template (default: home/index.html) - TELEGRAM_API_TOKEN: Telegram bot API token - TELEGRAM_ADMIN_ID: Numeric Telegram ID of admin - TELEGRAM_PROXY_URL: Run Telegram Bot over proxy - JWT_ACCESS_TOKEN_EXPIRE_MINUTES: Expire time for the Access Tokens in minutes, '0' considered as infinite (default: 1440) - DOCS: Whether API documents should be available on /docs and /redoc or not (default: False) - DEBUG: Debug mode for development (default: False) - WEBHOOK_ADDRESS: Webhook address to send notifications to. Webhook notifications will be sent if this value was set. - WEBHOOK_SECRET: Webhook secret will be sent with each request as x-webhook-secret in the header (default: None) ``` -------------------------------- ### Clash HTTP Options Configuration Example Source: https://github.com/gozargah/marzban/blob/master/app/templates/clash/README.md Example YAML configuration for 'http-opts' within Clash templates, demonstrating how to set IP version, method, and headers. This allows customization of network settings not directly accessible from the dashboard. ```yaml http-opts: - ip-version: dual method: "GET" headers: Connection: - keep-alive ``` -------------------------------- ### Install Frontend Dependencies for Debug Mode Source: https://github.com/gozargah/marzban/blob/master/CONTRIBUTING.md These commands navigate to the frontend directory and install the necessary npm packages. This step is required before running the project in debug mode. ```bash cd app/dashboard npm install cd ../.. ``` -------------------------------- ### Install Marzban Dashboard UI Dependencies Source: https://github.com/gozargah/marzban/blob/master/app/dashboard/README.md This snippet provides the commands to clone the Marzban Dashboard UI repository and install its required Node.js dependencies using Yarn. Ensure Node.js v16.17.0 or higher is installed before running these commands. ```Shell git clone https://github.com/gozargah/marz-manager.git cd marz-manager yarn install ``` -------------------------------- ### Marzban CLI Completion Install Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Installs shell completion scripts for the specified shell. Supported shells include bash, zsh, fish, powershell, and pwsh. ```console $ completion install [OPTIONS] ``` ```APIDOC Options: --shell [bash|zsh|fish|powershell|pwsh]: The shell to install completion for. --help: Show this message and exit. ``` -------------------------------- ### Enable Marzban Telegram Bot Source: https://github.com/gozargah/marzban/blob/master/README.md To enable the integrated Marzban Telegram bot, users must set two environment variables: `TELEGRAM_API_TOKEN` with their bot's API token and `TELEGRAM_ADMIN_ID` with their numeric Telegram account ID. This bot facilitates server management, user operations, and notifications. ```APIDOC To enable Telegram Bot: 1. Set TELEGRAM_API_TOKEN to your bot's API Token 2. Set TELEGRAM_ADMIN_ID to your Telegram account's numeric ID (get from @userinfobot) ``` -------------------------------- ### Marzban CLI Completion Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Manages shell completion scripts for the Marzban CLI, allowing generation and installation for various shells like bash, zsh, fish, powershell, and pwsh. ```console $ completion [OPTIONS] COMMAND [ARGS]... ``` ```APIDOC Options: --help: Show this message and exit. Commands: install: Install completion for the specified shell. show: Show completion for the specified shell,... ``` -------------------------------- ### Configure Marzban Dashboard Backend API URL Source: https://github.com/gozargah/marzban/blob/master/app/dashboard/README.md To connect the dashboard to a Marzban backend, copy the example environment file and set the VITE_BASE_API variable to your backend's URL. This is crucial for the UI to fetch data from the API. ```Shell VITE_BASE_API=https://somewhere.com/ ``` -------------------------------- ### Marzban CLI Subscription Get Link Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Prints the subscription link for a specified user. This command requires the `XRAY_SUBSCRIPTION_URL_PREFIX` environment variable to be set for correct operation. ```console $ subscription get-link [OPTIONS] ``` ```APIDOC Options: -u, --username TEXT: [required] --help: Show this message and exit. ``` -------------------------------- ### Access Marzban Dashboard Locally via SSH Port Forwarding Source: https://github.com/gozargah/marzban/blob/master/README.md Establishes an SSH tunnel to forward local port 8000 to the remote Marzban server's port 8000, allowing local access to the dashboard without a public domain. This method is suitable for testing purposes. ```bash ssh -L 8000:localhost:8000 user@serverip ``` -------------------------------- ### Generate Marzban CLI Documentation Source: https://github.com/gozargah/marzban/blob/master/CONTRIBUTING.md This command regenerates the Marzban CLI documentation using typer-cli. It should be run from the project's root directory after installing the typer-cli package. ```bash $ PYTHONPATH=$(pwd) typer marzban-cli.py utils docs --name "" --output ./cli/README.md ``` -------------------------------- ### Sing-box gRPC Settings Configuration Example Source: https://github.com/gozargah/marzban/blob/master/app/templates/singbox/README.md Illustrates a JSON snippet for customizing gRPC stream settings within Sing-box templates. This allows modification of parameters such as "idle_timeout", "ping_timeout", and "permit_without_stream" which are not directly accessible from the Marzban dashboard. ```json { "grpcSettings": { "idle_timeout": "15s", "ping_timeout": "15s", "permit_without_stream": false } } ``` -------------------------------- ### Nginx Proxy Headers for Real IP and Forwarded For Source: https://github.com/gozargah/marzban/blob/master/README.md This Nginx configuration snippet sets standard proxy headers to correctly pass the client's real IP address and the X-Forwarded-For chain to the backend application. This is crucial for accurate logging and security features that rely on client IP. ```Nginx proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ``` -------------------------------- ### Marzban CLI Subscription Get Config Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Generates a subscription configuration for a given user in a specified format (v2ray, clash). The output can be written to a file or displayed in the terminal, and can optionally be base64 encoded. ```console $ subscription get-config [OPTIONS] ``` ```APIDOC Options: -u, --username TEXT: [required] -f, --format [v2ray|clash]: [required] -o, --output TEXT: Writes the generated config in the file if provided --base64: Encodes output in base64 format if present --help: Show this message and exit. ``` -------------------------------- ### Nginx SSL Server Block with Proxy Pass to Marzban Source: https://github.com/gozargah/marzban/blob/master/README.md This complete Nginx server block configures an SSL-enabled virtual host listening on port 443 for both IPv4 and IPv6. It sets up SSL certificates and proxies all incoming requests to the Marzban application running on `http://0.0.0.0:8000`, ensuring proper host and client IP headers are forwarded. ```Nginx server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name marzban.example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location / { proxy_pass http://0.0.0.0:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` -------------------------------- ### Configure gRPC Stream Settings Template Source: https://github.com/gozargah/marzban/blob/master/app/templates/v2ray/README.md Example JSON configuration to customize gRPC stream settings, allowing modification of values like idle timeout, health check timeout, permit without stream, and initial window size that are not directly accessible from the Marzban dashboard. ```json { "grpcSettings": { "idle_timeout": 60, "health_check_timeout": 20, "permit_without_stream": false, "initial_windows_size": 0 } } ``` -------------------------------- ### Marzban CLI Base Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Describes the base usage of the Marzban CLI tool, including global options and available top-level commands such as `admin`, `completion`, `subscription`, and `user`. ```console $ [OPTIONS] COMMAND [ARGS]... ``` ```APIDOC Options: --help: Show this message and exit. Commands: admin completion subscription user ``` -------------------------------- ### Build Marzban Dashboard for Production Source: https://github.com/gozargah/marzban/blob/master/app/dashboard/README.md This command compiles and optimizes the Marzban Dashboard UI for production deployment. The output will be a highly optimized and minified version of the application. ```Shell yarn build ``` -------------------------------- ### Marzban CLI: user set-owner Command Options Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Lists and describes the various command-line options available for the `user set-owner` command. Options include specifying the target username, the new admin/owner, and flags for skipping confirmations or displaying help. ```APIDOC -u, --username TEXT --admin, --owner TEXT: Admin's username -y, --yes: Skips confirmations --help: Show this message and exit. ``` -------------------------------- ### Marzban CLI Subscription Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Manages user subscription configurations and links, including generating configs and retrieving subscription links. ```console $ subscription [OPTIONS] COMMAND [ARGS]... ``` ```APIDOC Options: --help: Show this message and exit. Commands: get-config: Generates a subscription config. get-link: Prints the given user's subscription link. ``` -------------------------------- ### Create Sing-box Template Subdirectory Source: https://github.com/gozargah/marzban/blob/master/app/templates/singbox/README.md Command to create a dedicated subdirectory for Sing-box specific templates within the CUSTOM_TEMPLATES_DIRECTORY. This folder will house the config and settings template files. ```shell mkdir /var/lib/marzban/templates/sing-box ``` -------------------------------- ### Marzban CLI Completion Show Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Displays the completion script for a specified shell, which can be copied or customized. Supported shells include bash, zsh, fish, powershell, and pwsh. ```console $ completion show [OPTIONS] ``` ```APIDOC Options: --shell [bash|zsh|fish|powershell|pwsh]: The shell to install completion for. --help: Show this message and exit. ``` -------------------------------- ### Create V2ray Template Subdirectory Source: https://github.com/gozargah/marzban/blob/master/app/templates/v2ray/README.md Shell command to create a specific subdirectory for V2ray templates within the previously defined custom templates directory. This organizes V2ray-specific configuration and settings files. ```shell mkdir /var/lib/marzban/templates/v2ray ``` -------------------------------- ### Marzban CLI Admin Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Details the `admin` subcommand, used for managing administrators. It includes options and subcommands for creating, deleting, importing, listing, and updating admin accounts. ```console $ admin [OPTIONS] COMMAND [ARGS]... ``` ```APIDOC Options: --help: Show this message and exit. Commands: create: Creates an admin delete: Deletes the specified admin import-from-env: Imports the sudo admin from env list: Displays a table of admins update: Updates the specified admin ``` -------------------------------- ### Marzban Dashboard Environment Variables Reference Source: https://github.com/gozargah/marzban/blob/master/app/dashboard/README.md This section details the environment variables available for configuring the Marzban Dashboard UI. Understanding these variables is essential for proper deployment and functionality. ```APIDOC VITE_BASE_API: Description: The API URL of the deployed backend (Marzban) ``` -------------------------------- ### Marzban CLI User Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Manages user accounts, including listing users and transferring user ownership. ```console $ user [OPTIONS] COMMAND [ARGS]... ``` ```APIDOC Options: --help: Show this message and exit. Commands: list: Displays a table of users set-owner: Transfers user's ownership ``` -------------------------------- ### Configure Sing-box Template File Paths Source: https://github.com/gozargah/marzban/blob/master/app/templates/singbox/README.md Sets environment variables SINGBOX_SUBSCRIPTION_TEMPLATE and SINGBOX_SETTINGS_TEMPLATE to specify the relative paths of the Sing-box subscription and settings template files, respectively, within the custom templates directory. ```shell SINGBOX_SUBSCRIPTION_TEMPLATE="singbox/default.json" SINGBOX_SETTINGS_TEMPLATE="singbox/settings.json" ``` -------------------------------- ### Marzban CLI Admin Create Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Creates a new admin account. The password can be set interactively or via the `MARZBAN_ADMIN_PASSWORD` environment variable for non-interactive use. Options include username, sudo privileges, Telegram ID, and Discord webhook. ```console $ admin create [OPTIONS] ``` ```APIDOC Options: -u, --username TEXT: [required] --sudo / --no-sudo: [default: no-sudo] -tg, --telegram-id TEXT -dc, --discord-webhook TEXT --help: Show this message and exit. ``` -------------------------------- ### JavaScript for Link Copy and QR Code Generation Source: https://github.com/gozargah/marzban/blob/master/app/templates/subscription/index.html This JavaScript code provides two main functionalities: `copyLink` copies a given text to the clipboard and provides visual feedback on the button. It also sets up event listeners for elements with the class 'qr-button' to generate and display a QR code in a popup using the `QRCode` library, and includes a function to close this popup. ```JavaScript function copyLink(link, button) { const tempInput = document.createElement('input'); tempInput.setAttribute('value', link); document.body.appendChild(tempInput); tempInput.select(); document.execCommand('copy'); document.body.removeChild(tempInput); button.textContent = 'Copied!'; setTimeout(function () { button.textContent = 'Copy'; }, 1500); } const qrButtons = document.querySelectorAll('.qr-button'); const qrPopup = document.getElementById('qrPopup'); qrButtons.forEach((qrButton) => { qrButton.addEventListener('click', () => { const link = qrButton.dataset.link; while (qrCodeContainer.firstChild) { qrCodeContainer.removeChild(qrCodeContainer.firstChild); } const qrCode = new QRCode(qrCodeContainer, { text: link, width: 256, height: 256, correctLevel: QRCode.CorrectLevel.L }); qrPopup.style.display = 'block'; }); }); function closeQrPopup() { document.getElementById('qrPopup').style.display = 'none'; } ``` -------------------------------- ### Marzban CLI Admin Import From Environment Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Imports a sudo admin from environment variables (`SUDO_USERNAME`, `SUDO_PASSWORD`) and links users without an `admin_id` to this imported admin. Confirmations can be skipped with `--yes`. ```console $ admin import-from-env [OPTIONS] ``` ```APIDOC Options: -y, --yes: Skips confirmations --help: Show this message and exit. ``` -------------------------------- ### Marzban CLI: user set-owner Command Usage Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Illustrates the basic command-line usage for the `user set-owner` command in Marzban. This command facilitates transferring user ownership and may require additional confirmation. ```console $ user set-owner [OPTIONS] ``` -------------------------------- ### Configure V2ray Template File Paths Source: https://github.com/gozargah/marzban/blob/master/app/templates/v2ray/README.md Shell commands to specify the relative paths for the V2ray subscription and settings template files. These environment variables link Marzban to the actual template files located within the custom templates directory. ```shell V2RAY_SUBSCRIPTION_TEMPLATE="v2ray/default.json" V2RAY_SETTINGS_TEMPLATE="v2ray/settings.json" ``` -------------------------------- ### Set Marzban Custom Templates Directory Source: https://github.com/gozargah/marzban/blob/master/app/templates/singbox/README.md Defines the environment variable CUSTOM_TEMPLATES_DIRECTORY to specify the base path where all custom Marzban templates, including Sing-box configurations and subscription pages, should be stored. Ensure Docker has access if used. ```shell CUSTOM_TEMPLATES_DIRECTORY="/var/lib/marzban/templates/" ``` -------------------------------- ### Create Clash Template Subdirectory Source: https://github.com/gozargah/marzban/blob/master/app/templates/clash/README.md Shell command to create a specific subdirectory for Clash templates within the main custom templates directory. This organizes Clash-related configuration and settings files. ```shell mkdir /var/lib/marzban/templates/v2ray ``` -------------------------------- ### Set Marzban Custom Templates Directory Source: https://github.com/gozargah/marzban/blob/master/app/templates/clash/README.md Shell command to define the CUSTOM_TEMPLATES_DIRECTORY environment variable, specifying the base path where all Marzban templates (home, subscription page, etc.) should be stored. Ensure Docker has access if used. ```shell CUSTOM_TEMPLATES_DIRECTORY="/var/lib/marzban/templates/" ``` -------------------------------- ### Marzban CLI User List Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Displays a table of user accounts. Users can be filtered by offset, limit, username, search term, status, or owner admin. Sorting is not currently supported. ```console $ user list [OPTIONS] ``` ```APIDOC Options: -o, --offset INTEGER -l, --limit INTEGER -u, --username TEXT: Search by username(s) -s, --search TEXT: Search by username/note --status [active|disabled|limited|expired|on_hold] --admin, --owner TEXT: Search by owner admin's username(s) --help: Show this message and exit. ``` -------------------------------- ### Marzban CLI Admin List Command Source: https://github.com/gozargah/marzban/blob/master/cli/README.md Displays a table of existing admin accounts. Results can be filtered by offset, limit, or username to refine the displayed list. ```console $ admin list [OPTIONS] ``` ```APIDOC Options: -o, --offset INTEGER -l, --limit INTEGER -u, --username TEXT: Search by username --help: Show this message and exit. ``` -------------------------------- ### Set Custom Templates Directory for Marzban Source: https://github.com/gozargah/marzban/blob/master/app/templates/v2ray/README.md Shell command to define the base directory where all custom templates (for home, subscription page, etc.) will be stored. It is crucial to ensure that Docker has access to this folder if you are using a Dockerized environment. ```shell CUSTOM_TEMPLATES_DIRECTORY="/var/lib/marzban/templates/" ``` -------------------------------- ### Configure Marzban Clash Template File Paths Source: https://github.com/gozargah/marzban/blob/master/app/templates/clash/README.md Shell commands to set environment variables CLASH_SUBSCRIPTION_TEMPLATE and CLASH_SETTINGS_TEMPLATE to specify the relative paths of the Clash config and settings template files within the custom templates directory. These variables link Marzban to the custom templates. ```shell CLASH_SUBSCRIPTION_TEMPLATE = "clash/default.yml") CLASH_SETTINGS_TEMPLATE = "clash/settings.yml") ``` -------------------------------- ### CSS 3D Transformations and Keyframe Animations for Assembly Elements Source: https://github.com/gozargah/marzban/blob/master/app/templates/home/index.html This snippet applies intricate 3D transformations and animations to `.assembly` elements and their nested `.side` and `.roller` components. It utilizes `transform` properties for rotation and translation, and `@keyframes` for defining continuous sliding and rolling animations across multiple child elements, creating a complex animated structure. ```css } .assembly:nth-child(11) .side:nth-child(4) { transform: rotateY(90deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(4):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(5) { transform: rotateY(120deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(5):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(6) { transform: rotateY(150deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(6):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(7) { transform: rotateY(180deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(7):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(8) { transform: rotateY(210deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(8):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(9) { transform: rotateY(240deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(9):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(10) { transform: rotateY(270deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(10):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(11) { transform: rotateY(300deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(11):before { height: 5.59808em; } .assembly:nth-child(11) .side:nth-child(12) { transform: rotateY(330deg) translateZ(5.59808em); } .assembly:nth-child(11) .side:nth-child(12):before { height: 5.59808em; } .assembly:nth-child(12) { z-index: -12; transform: translate(0, -60em); animation: slide12 1s ease-in-out infinite; } @keyframes slide12 { to { transform: translate(3em, -60em); } } .assembly:nth-child(12) .roller { transform: rotateY(13.84615deg) translateZ(6.26787em) rotateY(-27.69231deg); animation: inherit; animation-name: roll12a; } .assembly:nth-child(12) .roller:last-child { z-index: -1; margin: 0 12em; transform: rotateY(-13.84615deg) translateZ(-6.26787em) rotateY(-13.84615deg); animation-name: roll12b; } @keyframes roll12a { to { transform: rotateY(-13.84615deg) translateZ(6.26787em) rotateY(-27.69231deg); } } @keyframes roll12b { to { transform: rotateY(13.84615deg) translateZ(-6.26787em) rotateY(-13.84615deg); } } .assembly:nth-child(12) .side { margin: -2em -1.5em; width: 3em; height: 4em; } .assembly:nth-child(12) .side:nth-child(1) { transform: rotateY(0deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(1):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(2) { transform: rotateY(27.69231deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(2):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(3) { transform: rotateY(55.38462deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(3):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(4) { transform: rotateY(83.07692deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(4):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(5) { transform: rotateY(110.76923deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(5):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(6) { transform: rotateY(138.46154deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(6):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(7) { transform: rotateY(166.15385deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(7):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(8) { transform: rotateY(193.84615deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(8):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(9) { transform: rotateY(221.53846deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(9):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(10) { transform: rotateY(249.23077deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(10):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(11) { transform: rotateY(276.92308deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(11):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(12) { transform: rotateY(304.61538deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(12):before { height: 6.08574em; } .assembly:nth-child(12) .side:nth-child(13) { transform: rotateY(332.30769deg) translateZ(6.08574em); } .assembly:nth-child(12) .side:nth-child(13):before { height: 6.08574em; } .assembly:nth-child(13) { z-index: -13; transform: translate(0, -65em); animation: slide13 1s ease-in-out infinite; } @keyframes slide13 { to { transform: translate(3em, -65em); } } .assembly:nth-child(13) .roller { transform: rotateY(12.85714deg) translateZ(6.74094em) rotateY(-38.57143deg); animation: inherit; animation-name: roll13a; } .assembly:nth-child(13) ```