Teldrive Documentation
repository·main·Indexed 25 days ago
https://github.com/tgdrive/teldriveA high-performance utility written in Go that acts as a wrapper for Telegram accounts to organize and manage files. Teldrive provides an interface compatible with Rclone and includes a CLI for running the service, verifying file integrity via the check command, and managing updates.
What's inside Teldrive
- Teldrive is a utility designed to organize Telegram files. It acts as a wrapper over your Telegram account to simplify file access and provides an intuitive user interface for file interaction. It is compatible with Rclone, allowing for enhanced file management capabilities.
Important Usage Warnings and Best Practices
mainTelegram API Compliance
Teldrive is a wrapper over your Telegram account. You must strictly adhere to the limitations imposed by the Telegram API. Misusing the Telegram API can result in an instant account ban. Teldrive is not responsible for consequences arising from non-compliance with these limits.
Best Practices
To avoid account bans or automatic deletion of your channels/files, follow these guidelines:
Dos:
- Follow Limits: Adhere to all limits imposed by Telegram servers.
- Responsible Storage: Use storage efficiently and only keep data that serves a purpose.
Don'ts:
- Data Hoarding: Avoid excessive data hoarding, as it violates Telegram's terms of service.
Setup and Installation Guide
mainFor detailed instructions on how to set up Teldrive, visit the official documentation at https://teldrive-docs.pages.dev.Use the `check` command to verify file integrity
mainThe
checkcommand verifies the integrity of files stored in Telegram channels by comparing database records with actual Telegram messages. It identifies missing file parts, orphan messages, and incomplete uploads.Key Capabilities:
- Dry-run: Preview issues without making any changes to the database or Telegram.
- Export: Save a list of missing files to a JSON file.
- Cleanup: Remove missing files, orphan messages, pending files, and incomplete uploads from the database and Telegram.
- Concurrency: Process multiple channels simultaneously to speed up the check.
# Preview issues without making changes (dry-run) teldrive check --user alice --dry-run # Check, clean and export missing files to a custom file teldrive check --export-file missing_files.json # Clean missing and pending files along with incompleted uploads teldrive check --clean-pending --clean-uploads # Concurrent processing teldrive check --concurrent 8Available Teldrive subcommands
mainThe Teldrive CLI supports the following subcommands:
run: Starts the Teldrive service.check: Performs system or configuration checks.update: Updates the Teldrive installation.version: Displays the current version of Teldrive.
Configure Teldrive Server via CLI flags
mainThe
runcommand accepts configuration flags defined by theconfig.ServerCmdConfigstruct. These flags allow you to customize the server's behavior, including database connections, Redis settings, logging, and server timeouts.Common configuration areas include:
- Server: Port, Read/Write timeouts, and Graceful Shutdown duration.
- Log: Log level (e.g.,
info,debug,error) and file path. - DB: Database connection details and logging settings.
- Redis: Connection settings for the cache and bot selector.
- Events: Poll interval, worker counts, and buffer sizes.
- JWT: Settings for JSON Web Token authentication.
- CronJobs: Toggle for background cron jobs via
cron-jobs.enable.
Configure the `check` command flags
mainThe
checkcommand uses several flags to control the verification and cleanup process. These flags are part of theconfig.CheckCmdConfigstructure.Flag Description --userSpecify the username to run the check for. If omitted, you will be prompted to select a user from the available list. --dry-runIf set, the command will only report issues and will not delete any files, messages, or database records. --export-file <path>Specifies the path to a JSON file where missing files will be exported (only works when not in --dry-runmode).--clean-pendingWhen set, deletes files from the database that have a status of pending_deletion.--clean-uploadsWhen set, deletes incomplete upload records from the database. --concurrent <int>Sets the number of channels to process concurrently. --db-data-source <string>Required. The data source for the database connection. Upgrade TelDrive using the upgrade command
mainUse the
upgradecommand to update TelDrive to the latest version. The command automatically detects your operating system and executes the appropriate installation script.- Windows: Uses
powershellto run the update script. - Linux/macOS (darwin): Uses
bashto run the update script.
Note: On Windows, you must manually restart TelDrive after the upgrade process completes to use the new version. On Unix-like systems, the command will attempt to verify the version automatically.
- Windows: Uses
Use the Teldrive CLI
mainTheteldrivecommand is the entrypoint for the Teldrive application. Running the base command without any subcommands will display the help menu.teldriveCheck the Teldrive version
mainUse theversioncommand to display the current version of Teldrive along with build metadata, including the commit SHA, operating system, architecture, and Go version.Start the Teldrive Server with the `run` command
mainThe
runcommand is the primary CLI entrypoint used to start the Teldrive service. When executed, it initializes the database, connects to Redis, starts the event broadcaster, and launches the HTTP server (providing both the API and the Web UI).If the configured port is already in use, the application will attempt to find an available port within a range of 100 ports starting from the configured value. If a different port is used, the server will log the
server.port_occupiedevent with theoccupied_portandnew_portdetails.