Update heroku_settings.py

pull/136/head
Who? 2025-04-29 10:53:45 +07:00 committed by GitHub
parent d6c8d40c1f
commit 03e5629eef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 87 deletions

View File

@ -4,6 +4,12 @@
# You can redistribute it and/or modify it under the terms of the GNU AGPLv3
# 🔑 https://www.gnu.org/licenses/agpl-3.0.html
# ©️ Codrago, 2024-2025
# This file is a part of Heroku Userbot
# 🌐 https://github.com/coddrago/Heroku
# You can redistribute it and/or modify it under the terms of the GNU AGPLv3
# 🔑 https://www.gnu.org/licenses/agpl-3.0.html
import logging
import os
import random
@ -755,92 +761,6 @@ class HerokuSettingsMod(loader.Module):
reply_markup=self._get_settings_markup(),
)
@loader.command()
async def weburl(self, message: Message, force: bool = False):
if "LAVHOST" in os.environ:
form = await self.inline.form(
self.strings("lavhost_web"),
message=message,
reply_markup={
"text": self.strings("web_btn"),
"url": await main.hikka.web.get_url(proxy_pass=False),
},
photo="https://imgur.com/a/yOoHsa2.png",
)
return
if (
not force
and not message.is_private
and "force_insecure" not in message.raw_text.lower()
):
try:
if not await self.inline.form(
self.strings("privacy_leak_nowarn").format(self._client.tg_id),
message=message,
reply_markup=[
{
"text": self.strings("btn_yes"),
"callback": self.weburl,
"args": (True,),
},
{"text": self.strings("btn_no"), "action": "close"},
],
photo="https://imgur.com/a/NumfPGa.png",
):
raise Exception
except Exception:
await utils.answer(
message,
self.strings("privacy_leak").format(
self._client.tg_id,
utils.escape_html(self.get_prefix()),
),
)
return
if not main.hikka.web:
main.hikka.web = core.Web(
data_root=main.BASE_DIR,
api_token=main.hikka.api_token,
proxy=main.hikka.proxy,
connection=main.hikka.conn,
)
await main.hikka.web.add_loader(self._client, self.allmodules, self._db)
await main.hikka.web.start_if_ready(
len(self.allclients),
main.hikka.arguments.port,
proxy_pass=main.hikka.arguments.proxy_pass,
)
if force:
form = message
await form.edit(
self.strings("opening_tunnel"),
reply_markup={"text": "🕔 Wait...", "data": "empty"},
photo=(
"https://imgur.com/a/MQJGI0w.png"
),
)
else:
form = await self.inline.form(
self.strings("opening_tunnel"),
message=message,
reply_markup={"text": "🕔 Wait...", "data": "empty"},
photo=(
"https://imgur.com/a/MQJGI0w.png"
),
)
url = await main.hikka.web.get_url(proxy_pass=True)
await form.edit(
self.strings("tunnel_opened"),
reply_markup={"text": self.strings("web_btn"), "url": url},
photo="https://imgur.com/a/lgmzCpj.png",
)
def _get_all_IDM(self, module: str):
return {
getattr(getattr(self.lookup(module), name), "name", name): getattr(