Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 - Cypher #47

Merged
merged 93 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
1f6bef8
Started development of the successor
Itz-fork Nov 18, 2023
6f4c70d
modules: mega_dl
Itz-fork Nov 18, 2023
df74bb5
nightly-0.2
Itz-fork Nov 18, 2023
062b203
nightly-0.2: Updates
Itz-fork Nov 18, 2023
7653e7b
feat: add dockerfile, mega conf and other example files
Itz-fork Dec 21, 2023
fd99e62
Update Dockerfile
Itz-fork Dec 21, 2023
2201a25
add heroku.yml
Itz-fork Dec 21, 2023
6ad939f
add Procfile
Itz-fork Dec 21, 2023
ddd2d42
Added missing req: `filesplit`
Itz-fork Dec 21, 2023
8ab236a
fixes
Itz-fork Dec 21, 2023
4cf2f89
changed cwd to `megadl`
Itz-fork Dec 21, 2023
fd4a38c
updated plugin path
Itz-fork Dec 21, 2023
a17c291
def: raw string
Itz-fork Dec 21, 2023
dca209e
use `.env` file for configuration
Itz-fork Dec 21, 2023
422fe14
update readme
Itz-fork Dec 21, 2023
379f3dc
added `installer` script
Itz-fork Dec 21, 2023
3737610
fixes
Itz-fork Dec 21, 2023
3bd7694
updated roadmap
Itz-fork Dec 21, 2023
8ba5f94
roadmap: another one
Itz-fork Dec 21, 2023
df81ca8
fix: any value get treated as True
Itz-fork Dec 22, 2023
794d073
docs: lib readme update
Itz-fork Dec 22, 2023
137a092
fixes and docs updates
Itz-fork Dec 22, 2023
995b0e1
docs: set `USE_ENV` in `.env.sample` file to `False`
Itz-fork Dec 22, 2023
08c92ec
megatools: added `file_info` function
Itz-fork Dec 22, 2023
5b92b79
fix: added `requests` to requirements
Itz-fork Dec 22, 2023
0ca4d3b
megatools: add support for `mega.nz/#!...` links
Itz-fork Dec 22, 2023
af68c62
fix: `helpers.files` passing folder path to ffmpeg
Itz-fork Dec 23, 2023
90a1694
feat: improved performance in `megatools.upload`
Itz-fork Dec 23, 2023
d23cb2b
fix: updated thumbnail path in `send_as_guessed` video uploader
Itz-fork Dec 23, 2023
de9e2bb
docs: typo fixes
Itz-fork Dec 23, 2023
be577f5
feat: Implement DDL to Mega.nz uploader
Itz-fork Dec 23, 2023
21fa7e1
docs: h4 -> h3
Itz-fork Dec 23, 2023
d104038
fix: added `CHUNK_SIZE` and fix pip issue
Itz-fork Dec 23, 2023
d7add88
feat: custom `pyrogram.Client` patcher
Itz-fork Dec 24, 2023
6796176
increase `CHUNK_SIZE` to `500 KiB`
Itz-fork Dec 24, 2023
fc08fbf
fix: installer exiting with code 0
Itz-fork Dec 24, 2023
4ee4e69
fix: `DOWNLOAD_LOCATION`
Itz-fork Dec 24, 2023
6ac9d29
fix: add missing requirements
Itz-fork Dec 24, 2023
d0bc081
Create notify.yml
Itz-fork Dec 25, 2023
e706fab
feat: add multi user support
Itz-fork Dec 25, 2023
69a8a7d
Merge branch 'nightly' of https://github.com/Itz-fork/Mega.nz-Bot int…
Itz-fork Dec 25, 2023
25857df
fix: github workflow
Itz-fork Dec 26, 2023
19e692d
renamed `ilistner` to `use_listner`
Itz-fork Dec 26, 2023
3dd1299
fix: reference branch on `.github/workflows/notify.yml`
Itz-fork Dec 26, 2023
46a1529
github: use `Itz-fork/github-telegram-notify`
Itz-fork Dec 26, 2023
a520450
github: use Itz-fork/github-telegram-notify
Itz-fork Dec 26, 2023
dd1d25c
typo: `MeganzClient`
Itz-fork Dec 26, 2023
92ceef8
typo: `_emsg`
Itz-fork Dec 26, 2023
c8641df
actions: run on `commit`, `pull`, `fork`, `release`
Itz-fork Dec 26, 2023
ba9063f
perf: ddl, megatools
Itz-fork Dec 26, 2023
0f180ce
perf: pyros track_progress and TimeFormatter
Itz-fork Dec 26, 2023
2839b42
security: hash mega email and password before storing it
Itz-fork Dec 26, 2023
f9fd49b
feat: add encryption to mega email and password
Itz-fork Dec 26, 2023
6d65ad6
fix: add missing requirement cryptography
Itz-fork Dec 26, 2023
c6df1fc
fix: TimeFormatter returning unreadable time
Itz-fork Dec 26, 2023
5f32251
perf: refactor TimeFormatter
Itz-fork Dec 26, 2023
2c7ae6e
feat: add logout command
Itz-fork Dec 26, 2023
be5f344
perf: use aiohttp for asynchronous data fetching (`megatools.file_info`)
Itz-fork Dec 26, 2023
2e68313
perf: use aiohttp for asynchronous data fetching ()
Itz-fork Dec 26, 2023
264f32f
feat: add cancel button for megatools
Itz-fork Dec 26, 2023
0782dc8
fixes: process cancel, cleanup and more
Itz-fork Dec 27, 2023
7961506
docs: added "CIPHER_KEY" in .env.sample
Itz-fork Dec 27, 2023
d449b44
added help comand
Itz-fork Dec 27, 2023
82d26ab
fix: added missing requirement `psutil`
Itz-fork Dec 27, 2023
d06100a
fix: disable web page preview in start message
Itz-fork Dec 27, 2023
7020218
handle user logins
Itz-fork Dec 27, 2023
d5d239b
perf: check whether user has logged in before processing the request
Itz-fork Dec 28, 2023
6b2603b
perf: `mclient.send_files` - use stored max file size
Itz-fork Dec 28, 2023
ee33a7f
fix: `auth` check if email or password is missing individually
Itz-fork Dec 28, 2023
ac1d837
perf: `helpers.crypt func: base64_url_decode` use regex instead of re…
Itz-fork Dec 28, 2023
b5f7cd2
Implement private mode
Itz-fork Dec 28, 2023
62e49dd
fix: authorized users
Itz-fork Dec 28, 2023
9c7f6d5
docs: update message strings and readmes
Itz-fork Dec 28, 2023
60ab321
docs: added better documentation
Itz-fork Dec 28, 2023
3bdd7b6
add admin features and update user controls
Itz-fork Dec 28, 2023
a88ba8b
refactoring, privacy and database updates
Itz-fork Dec 29, 2023
28b644e
bug fixes and improvements
Itz-fork Dec 29, 2023
7a0c405
docs: update `.env.sample`
Itz-fork Dec 29, 2023
fe8c720
docs: remove `USE_LOGS`
Itz-fork Dec 30, 2023
d7a3f16
rename `mclient.py` -> `cypher.py`
Itz-fork Dec 30, 2023
cec2e46
log client start
Itz-fork Dec 30, 2023
98d27d5
updated installer
Itz-fork Dec 30, 2023
7d54a37
fix: if `DOWNLOAD_LOCATION` is empty fallback to `self.cwd/NexaBots`
Itz-fork Dec 30, 2023
da33686
new feature, improvements and refacoring
Itz-fork Dec 30, 2023
d45e302
fix: Deadlock in `megatools.__shellExec` and some other fixes
Itz-fork Dec 30, 2023
25cb6bb
rename `mega.ini.sample` -> `mega.ini`
Itz-fork Dec 30, 2023
e74bb98
remove login section from mega.ini
Itz-fork Dec 31, 2023
5c22301
removed proxy from `mega.ini`
Itz-fork Dec 31, 2023
be0c2b0
perf: reduce database calls and use C wrapper for calculations
Itz-fork Dec 31, 2023
ad166c3
new method and some other changes
Itz-fork Dec 31, 2023
75463c4
proxy support and bug fixes
Itz-fork Dec 31, 2023
4838f72
set ParallelTransfers to 16 (maximum)
Itz-fork Dec 31, 2023
7ab0914
updated readme
Itz-fork Dec 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
APP_ID=app-id-from-my.telegram.org
API_HASH=api-hash-from-my.telegram.org
BOT_TOKEN=bot-token-from-@BotFather

MEGA_EMAIL=yourname@gmail.com
MEGA_PASSWORD=mypassword

AUTH_USERS=*
USE_ENV=False
LOG_CHAT=-1001234567890
MONGO_URI=mongodb+srv://username:password@host/dbname?retryWrites=true&w=majority
CYPHER_KEY=vJmDXO4xria6SYVcOfVYd3k3YM8WiiGBfRjbQ8MBsvI=

DOWNLOAD_LOCATION=${PWD}/NexaBots
CHUNK_SIZE=524288
TG_MAX_SIZE=2040108421
11 changes: 11 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Notify on Telegram
on: [push, fork, pull_request, release]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Notify the commit on Telegram
uses: Itz-fork/github-telegram-notify@main
with:
bot_token: '${{ secrets.BOT_TOKEN }}'
chat_id: '${{ secrets.CHAT_ID }}'
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ FROM fedora:latest
RUN dnf upgrade -y
RUN dnf install \
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm -y
RUN dnf install git python3-pip ffmpeg megatools -y
RUN dnf install gcc python3-devel git python3-pip ffmpeg megatools -y
RUN pip3 install -U pip
RUN mkdir /app/
WORKDIR /app/
RUN git clone https://github.com/Itz-fork/Mega.nz-Bot.git /app
RUN git clone -b nightly https://github.com/Itz-fork/Mega.nz-Bot.git /app
RUN pip3 install -U -r requirements.txt
CMD [ "bash", "startup.sh" ]
CMD ["python3", "-m", "megadl"]
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2021 Itz-fork. <https://github.com/Itz-fork>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this telegram Bot, but changing it is not allowed.
of this license document, but changing it is not allowed.

Preamble

Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: bash startup.sh
worker: python3 -m megadl
66 changes: 27 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
# Mega.nz-Bot
A simple telegram bot written in Python using Pyrogram framework which helps you to download, upload and import [^1] files / folders from [Mega.nz](https://mega.nz/) cloud storage with telegram.
<p align="center">
<img src="assests/logo.png" width=200, height=200/>
<br>
<a href="https://megabot.hirusha.codes/"><img src="https://img.shields.io/badge/Docs-e6615f?style=for-the-badge&logo=gitbook&logoColor=white" /></a>
<a href="https://t.me/Nexa_bots"><img src="https://img.shields.io/badge/Support-0a0a0a?style=for-the-badge&logo=telegram&logoColor=white" /></a>
</p>


# Mega.nz-Bot - Cypher 🥷
A simple telegram bot to download, upload files or folders from [Mega.nz](https://mega.nz/)


# Features
- ⚡ Download, Upload & Import files easily
- 📱 Mega.nz user account support
- 🙅‍♂️ No login required
- 🖇️ Almost all file / folder links are supported [^2]
- 🛡️ Can be used as either public or private bot
- 🕵️‍♂️ Inline Mode [Still In Development Stage: BETA]
- ⚡ Download, Upload files/folders easily
- 🙅‍♂️ No login required[^1]
- 🗃️ Support for Mega.nz user account
- 🤝 Support for both private and public content
- 🛡 Can be used as either private or public bot
- 🖇 Direct download link to mega.nz upload
- 🧐 See what files are in your links


# Deploy
Deploy your own Bot ♥️! **Star 🌟 Fork 🍴 and Deploy**

### Config Vars 📓,
**Mandatory Vars,**
- `APP_ID` - Your APP_ID. Get it from [my.telegram.org](my.telegram.org)
- `API_HASH` - Your API_ID. Get it from [my.telegram.org](my.telegram.org)
- `AUTH_USERS` - Telegram IDs Of Auth Users, Only they can use this bot (If you didn't set this as public bot). Separate them by a space. (Ex: `123445 2648589`)
- `BOT_TOKEN` - Your Bot Token From [@BotFather](https://t.me/BotFather)

**Non Mandatory Vars,**
- `IS_PUBLIC_BOT` - Set this to 'True' if you want to set Download Function as Public. Default to 'False'
- `LOGS_CHANNEL` - To get this, follow these steps,
- Make a private channel
- Send a message and copy it's link
- The link'll be something like `https://t.me/c/12345/1`. Simply copy the `12345` part from it and add `-100` to the beginning of it. Now it'll be something like `-10012345`. That's your channel id!
- `MEGA_EMAIL` - Fill this if you want to use your own Mega Account. This is your Mega account Email
- `MEGA_PASSWORD` - Fill this if you want to use your own Mega Account. This is your Mega account Password

Check out [config.sample file](https://github.com/Itz-fork/Mega.nz-Bot/blob/main/config.sample) if you aren't using heroku 🤗

### With Heroku
> Notice ⚠️:
> Please refer the [Deployment](https://github.com/Itz-fork/X-Bin-Patch#deployment) guide inorder to deploy this bot Heroku. THIS REPO ISN'T FUCKING COMPATIBLE WITH HEROKU!

### Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://github.com/Itz-fork/X-Bin-Patch#deployment)

### With VPS/PC
### Local
---
**Tip 💡:**
If you're using a linux distro with `apt`, `pacman` or `dnf` package manager, you can use the official installer script to setup [Mega.nz-Bot](https://github.com/Itz-fork/Mega.nz-Bot). To do so run the following command,
If you're using a linux distro with `apt`, `pacman` or `dnf` as the package manager, you can use the official installer script to setup [Mega.nz-Bot](https://github.com/Itz-fork/Mega.nz-Bot).

```bash
curl -sS https://raw.githubusercontent.com/Itz-fork/Mega.nz-Bot/main/installer.sh | bash
curl -sS https://raw.githubusercontent.com/Itz-fork/Mega.nz-Bot/nightly/installer.sh | bash
```
---

Expand All @@ -63,18 +51,18 @@ cd Mega.nz-Bot
pip3 install -U -r requirements.txt
```
- Install [megatools](https://megatools.megous.com/), [ffmpeg](https://ffmpeg.org/download.html) according to your system
- Fill config vars with your own values ([How to get config values](https://github.com/Itz-fork/Mega.nz-Bot#config-vars-)),
- If you have GUI system use a normal text editor like notepad, sublime text etc.
- For CLI systems, [use nano](https://gist.github.com/Itz-fork/fd11c08ef7464bdae3663a1f9c77c9e9) and edit the config file using `nano config.py` command.
- Create a `.env` file (see [example](/.env.sample))
- Fill config vars with your own values ([How to get config values](#config-vars)),
- Run the Bot,
```
bash startup.sh
python3 -m megadl
```

### Config vars
Please refer to [documentation](https://megabot.hirusha.codes/config-vars)

[^1]: Only download and upload functions support folder links. Currently import function supports only for files
[^2]: Public content only

[^1]: This only applies to public contents and you're still limited by the daily download quota limit of the mega.nz platform

# Support
[![Support Group](https://img.shields.io/badge/Support_Group-0a0a0a?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/Nexa_bots)
65 changes: 0 additions & 65 deletions app.json

This file was deleted.

Binary file added assests/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions cache/test.txt

This file was deleted.

18 changes: 0 additions & 18 deletions config.py

This file was deleted.

13 changes: 0 additions & 13 deletions config.sample

This file was deleted.

6 changes: 6 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
docker:
worker: Dockerfile

run:
worker: python3 -m megadl
Loading