Skip to content

Latest commit

Β 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

☁️ Telegram Cloud Storage

Penyimpanan cloud pribadi tanpa batas yang memanfaatkan Telegram sebagai backend storage. Kelola file, folder, sinkronisasi Google Drive, dan akses semuanya dari satu dashboard web modern.

Python Flask SQLite License


πŸš€ Fitur Utama

πŸ“ File Management

  • Upload & Download file langsung ke Telegram (mendukung file hingga 2GB)
  • Folder Hierarchy β€” buat, navigasi, dan kelola folder seperti file manager biasa
  • Multi-Upload β€” upload banyak file sekaligus dengan progress bar real-time
  • Search & Pagination β€” cari file dengan cepat, navigasi antar halaman
  • File Preview β€” preview gambar, video, audio, PDF, teks, dan dokumen Office langsung di browser
  • Favorites β€” tandai file favorit untuk akses cepat
  • Trash & Permanent Delete β€” hapus file ke trash, atau hapus permanen dari Telegram

πŸ”— Google Drive Integration

  • Connect Google Drive β€” hubungkan akun Google Drive via OAuth2
  • Browse & Copy β€” telusuri file Google Drive dan salin ke Telegram Storage
  • Bi-directional Sync β€” sinkronisasi file dari Google Drive ke Telegram secara otomatis
  • Sync Progress β€” pantau progress sinkronisasi real-time dengan retry mechanism
  • Disconnect β€” putuskan koneksi Google Drive kapan saja

πŸ“Έ Google Photos Integration

  • Browse Photos β€” akses Google Photos langsung dari sidebar
  • Embed Panel β€” tampilan Google Photos terintegrasi di dalam dashboard

πŸ‘€ User Profile & Multi-Account

  • User Profile β€” atur nama, email, telepon, bio, dan foto profil
  • Auto-Populate dari Google β€” profil otomatis terisi dari data Google OAuth
  • Multi-Account Isolation β€” setiap akun Google memiliki penyimpanan terisolasi
  • Admin Panel β€” panel pengaturan untuk admin (Google Client ID/Secret)

βš™οΈ Telegram Configuration

  • API Settings β€” atur API ID, API Hash, Bot Token, dan Channel ID
  • Channel Target Normalization β€” otomatis menormalkan format Channel ID Telegram
  • Connection Test β€” uji koneksi ke Telegram langsung dari dashboard
  • Multi-Account Support β€” dukungan multiple Telegram bot accounts

🎨 UI/UX

  • Dark Mode β€” tema gelap modern dengan aksen ungu
  • Responsive Design β€” tampilan optimal di desktop, tablet, dan mobile
  • Mobile Bottom Navigation β€” navigasi mudah di perangkat mobile
  • Inline Settings Panel β€” pengaturan terpadu tanpa pindah halaman
  • Toast Notifications β€” notifikasi status upload/download/sync

πŸ—οΈ Arsitektur

telegram-cloud-storage/
β”œβ”€β”€ web.py                 # Main Flask app + Telegram integration (29 routes)
β”œβ”€β”€ web_drive.py           # Google Drive/Photos + Profile features (37 routes)
β”œβ”€β”€ telegram_accounts.py   # Multi-account Telegram management
β”œβ”€β”€ storage.db             # SQLite database (auto-created)
β”œβ”€β”€ config.env             # Environment configuration
β”œβ”€β”€ profiles/              # User profile photos
β”œβ”€β”€ icons/                 # SVG icon set
β”‚   β”œβ”€β”€ cloud-storage-icons/
β”‚   └── cloud-storage-svg-complete/
└── test_*.py              # Unit & integration tests (15 test files)

Tech Stack

Komponen Teknologi
Backend Python 3.8+, Flask 3.x
Database SQLite3 (file-based)
Telegram Telethon (MTProto API)
Google API Google Drive API v3, Google Photos API
Frontend Vanilla JavaScript (ES5), HTML5, CSS3
Icons Custom SVG icon set
Deployment systemd service, Cloudflare Tunnel

πŸ“¦ Instalasi

Prerequisites

  • Python 3.8 atau lebih baru
  • Telegram API credentials (dari my.telegram.org)
  • Google Cloud Project (untuk fitur Google Drive/Photos)

1. Clone Repository

git clone https://github.com/sigit4715/telegram-cloud-storage.git
cd telegram-cloud-storage

2. Install Dependencies

python3 -m venv venv
source venv/bin/activate
pip install flask telethon pillow google-api-python-client google-auth-oauthlib

3. Konfigurasi

Buat file config.env:

# Telegram Settings
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHANNEL_ID=-100xxxxxxxxxx

# Google OAuth (opsional)
GDRIVE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GDRIVE_CLIENT_SECRET=GOCSPX-your_secret
PHOTOS_CLIENT_ID=your_client_id.apps.googleusercontent.com
PHOTOS_CLIENT_SECRET=GOCSPX-your_secret

# Admin (opsional)
ADMIN_IDS=your_google_email@gmail.com

4. Jalankan

python3 web.py

Server akan berjalan di http://localhost:8050


πŸ”§ Deployment (Production)

Systemd Service

sudo tee /etc/systemd/system/telegram-cloud-web.service << 'EOF'
[Unit]
Description=Telegram Cloud Storage Web
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/data/telegram-cloud
ExecStart=/opt/data/.venv-scrapling/bin/python3 web.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable telegram-cloud-web
sudo systemctl start telegram-cloud-web

Cloudflare Tunnel (Optional)

Untuk akses publik tanpa port forwarding:

cloudflared tunnel --url http://localhost:8050

πŸ§ͺ Testing

Jalankan semua unit test:

python3 -m unittest discover -p "test_*.py" -v

Test Coverage

Test File Deskripsi
test_login_redirect.py Login & redirect behavior
test_telegram_settings_page.py Settings page rendering
test_telegram_channel_target.py Channel ID normalization
test_telegram_account_config.py Multi-account configuration
test_multi_account_isolation.py Data isolation per account
test_web_drive_host_binding.py Drive blueprint registration
test_web_main_alias.py Module import safety
test_file_preview.py Preview functionality
+ 7 UI tests Pagination, stat cards, file types, etc.

πŸ“± Screenshots

Dashboard

  • Statistik penyimpanan (File, Ukuran, Folder, Foto, Video)
  • Daftar file terbaru dengan pagination
  • Sidebar navigasi dengan mode gelap

Settings Panel (Inline)

  • Tab Profil β€” atur data personal & foto profil
  • Tab Telegram β€” konfigurasi API & Channel
  • Tab Google β€” kredensial OAuth (admin only)
  • Tab Tutorial β€” panduan setup Telegram

Google Drive

  • Status koneksi (Terhubung / Tidak terhubung)
  • Browser file Google Drive
  • Tombol Copy to Telegram & Sync

πŸ”’ Keamanan

  • Session-based Authentication β€” login via ID atau Google OAuth
  • Multi-Tenant Isolation β€” data per akun terisolasi di database
  • CSRF Protection β€” session token untuk semua request
  • No Secrets in Code β€” credentials disimpan di config.env (tidak di-commit)
  • HTTPS via Cloudflare β€” enkripsi data saat transit

πŸ“„ API Endpoints

Core (web.py)

Method Endpoint Deskripsi
POST /api/login Login dengan User ID
POST /api/logout Logout
GET /api/me Info user saat ini
GET /api/files List files dengan pagination
POST /api/upload Upload file ke Telegram
GET /api/download/<id> Download file
GET /api/stream/<id> Stream file (preview)
DELETE /api/delete/<id> Hapus file
GET /api/stats Statistik penyimpanan
GET /api/folders List folders

Google Drive & Profile (web_drive.py)

Method Endpoint Deskripsi
GET/POST /api/profile Get/update profil
POST /api/profile/photo Upload foto profil
GET /api/gdrive/status Status koneksi Google Drive
GET /api/gdrive/auth Mulai OAuth Google Drive
GET /api/gdrive/files Browse file Google Drive
POST /api/gdrive/copy Copy file dari GDrive ke Telegram
POST /api/gdrive/sync Mulai sinkronisasi
GET /api/settings Get settings (admin)
POST /api/settings Update settings (admin)
POST /api/settings/restart Restart service (admin)

🀝 Contributing

  1. Fork repository
  2. Buat branch baru (git checkout -b feature/amazing-feature)
  3. Commit perubahan (git commit -m 'Add amazing feature')
  4. Push ke branch (git push origin feature/amazing-feature)
  5. Buka Pull Request

πŸ“ Changelog

v2.1.0 (Latest)

  • βœ… Settings panel terpadu (Profil, Telegram, Google, Tutorial)
  • βœ… Auto-populate profil dari Google OAuth
  • βœ… Fixed Google Drive & Settings panel overlap
  • βœ… ES5 JavaScript untuk kompatibilitas maksimal
  • βœ… 15 unit test baru

v2.0.0

  • βœ… Google Drive & Photos integration
  • βœ… Multi-account isolation
  • βœ… File preview (image, video, PDF, Office)
  • βœ… Sync progress & retry mechanism

v1.0.0

  • βœ… Initial release β€” Telegram Cloud Storage

πŸ“œ License

MIT License - Silakan gunakan untuk keperluan pribadi maupun komersial.


πŸ‘¨β€πŸ’» Author

sigit4715 - GitHub

Built with ❀️ for unlimited cloud storage using Telegram as backend.


πŸ”— Links


⭐ Star this repo if you find it useful!

About

Telegram-powered cloud storage with Google Drive sync, dark purple web dashboard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages