mirror of https://github.com/coddrago/Heroku
Fix data root in web
parent
54122dbb23
commit
9fa316cd94
|
@ -39,6 +39,12 @@ from .. import utils, main
|
||||||
|
|
||||||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
|
|
||||||
|
DATA_DIR = (
|
||||||
|
os.path.normpath(os.path.join(utils.get_base_dir(), ".."))
|
||||||
|
if "OKTETO" not in os.environ
|
||||||
|
else "/data"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Web:
|
class Web:
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -101,9 +107,7 @@ class Web:
|
||||||
):
|
):
|
||||||
return web.Response(status=400)
|
return web.Response(status=400)
|
||||||
with open(
|
with open(
|
||||||
os.path.join(
|
os.path.join(self.data_root or DATA_DIR, "api_token.txt"),
|
||||||
self.data_root or os.path.dirname(utils.get_base_dir()), "api_token.txt"
|
|
||||||
),
|
|
||||||
"w",
|
"w",
|
||||||
) as f:
|
) as f:
|
||||||
f.write(api_id + "\n" + api_hash)
|
f.write(api_id + "\n" + api_hash)
|
||||||
|
@ -209,7 +213,8 @@ class Web:
|
||||||
markup = InlineKeyboardMarkup()
|
markup = InlineKeyboardMarkup()
|
||||||
markup.add(
|
markup.add(
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
"🔓 Authorize user", callback_data=f"authorize_web_{token}"
|
"🔓 Authorize user",
|
||||||
|
callback_data=f"authorize_web_{token}",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue