Skip to content

Commit f54c708

Browse files
authored
More Security for Files
Just added a Calculating before encoding string with message id and channel id, so no one can access files from channel without link or with the combination of channel id and message id
1 parent d71bc13 commit f54c708

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugins/commands.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#(©)Codexbotz
22

33
import asyncio
4-
import base64
54
from pyrogram import Client, filters, __version__
65
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
76
from pyrogram.errors import FloodWait
@@ -22,8 +21,8 @@ async def start_command(client: Client, message: Message):
2221
argument = string.split("-")
2322
if len(argument) == 3:
2423
try:
25-
start = int(argument[1])
26-
end = int(argument[2])
24+
start = int(int(argument[1]) / abs(CHANNEL_ID))
25+
end = int(int(argument[2]) / abs(CHANNEL_ID))
2726
except:
2827
return
2928
if start <= end:
@@ -112,7 +111,8 @@ async def channel_post(client: Client, message: Message):
112111
except:
113112
await reply_text.edit_text("Something went Wrong..!")
114113
return
115-
string = f"get-{post_message.message_id}"
114+
converted_id = post_message.message_id * abs(CHANNEL_ID)
115+
string = f"get-{converted_id}"
116116
base64_string = await encode(string)
117117
link = f"https://t.me/{client.username}?start={base64_string}"
118118
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
@@ -143,7 +143,7 @@ async def batch(client: Client, message: Message):
143143
break
144144
await second_message.reply_text("Forward from the Assigned Channel only...", quote = True)
145145
continue
146-
string = f"get-{f_msg_id}-{s_msg_id}"
146+
string = f"get-{f_msg_id * abs(CHANNEL_ID)}-{s_msg_id * abs(CHANNEL_ID)}"
147147
base64_string = await encode(string)
148148
link = f"https://t.me/{client.username}?start={base64_string}"
149149
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])

0 commit comments

Comments
 (0)