mirror of https://github.com/coddrago/Heroku
Do not ask user to enter Telegram credintials locally when installing to heroku
parent
1288220c3f
commit
bb96c7ca3b
|
@ -474,7 +474,7 @@ class Hikka:
|
||||||
MemorySession(),
|
MemorySession(),
|
||||||
self.api_token.ID,
|
self.api_token.ID,
|
||||||
self.api_token.HASH,
|
self.api_token.HASH,
|
||||||
connection=self.connection,
|
connection=self.conn,
|
||||||
proxy=self.proxy,
|
proxy=self.proxy,
|
||||||
connection_retries=None,
|
connection_retries=None,
|
||||||
device_model="Hikka",
|
device_model="Hikka",
|
||||||
|
@ -671,6 +671,36 @@ class Hikka:
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
"""Main entrypoint"""
|
"""Main entrypoint"""
|
||||||
|
if self.arguments.heroku:
|
||||||
|
if isinstance(self.arguments.heroku, str):
|
||||||
|
key = self.arguments.heroku
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
"\033[0;35m- Heroku installation -\033[0m\n"
|
||||||
|
"*If you are from Russia, enable VPN and use it throughout the process\n\n"
|
||||||
|
"1. Register account at https://heroku.com\n"
|
||||||
|
"2. Go to https://dashboard.heroku.com/account\n"
|
||||||
|
"3. Next to API Key click `Reveal` and copy it\n"
|
||||||
|
"4. Enter it below:"
|
||||||
|
)
|
||||||
|
key = input("♓️ \033[1;37mHeroku API key:\033[0m ").strip()
|
||||||
|
|
||||||
|
print(
|
||||||
|
"⏱ Installing to Heroku...\n"
|
||||||
|
"This process might take several minutes, be patient."
|
||||||
|
)
|
||||||
|
|
||||||
|
app = heroku.publish(self.clients, key, self.api_token)
|
||||||
|
print(
|
||||||
|
"Installed to heroku successfully!\n"
|
||||||
|
"🎉 App URL: {}".format(app.web_url)
|
||||||
|
)
|
||||||
|
|
||||||
|
# On this point our work is done
|
||||||
|
# everything else will be run on Heroku, including
|
||||||
|
# authentication
|
||||||
|
return
|
||||||
|
|
||||||
self._init_web()
|
self._init_web()
|
||||||
save_config_key("port", self.arguments.port)
|
save_config_key("port", self.arguments.port)
|
||||||
self._get_token()
|
self._get_token()
|
||||||
|
@ -682,23 +712,6 @@ class Hikka:
|
||||||
) and not self._initial_setup(): # Otherwise attempt to run setup
|
) and not self._initial_setup(): # Otherwise attempt to run setup
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.arguments.heroku:
|
|
||||||
if isinstance(self.arguments.heroku, str):
|
|
||||||
key = self.arguments.heroku
|
|
||||||
else:
|
|
||||||
key = input(
|
|
||||||
"Please enter your Heroku API key (from https://dashboard.heroku.com/account): "
|
|
||||||
).strip()
|
|
||||||
|
|
||||||
app = heroku.publish(self.clients, key, self.api_token)
|
|
||||||
print("Installed to heroku successfully!\n" "🎉 {}".format(app.web_url))
|
|
||||||
|
|
||||||
if self.web:
|
|
||||||
self.web.redirect_url = app.web_url
|
|
||||||
self.web.ready.set()
|
|
||||||
self.loop.run_until_complete(self.web.root_redirected.wait())
|
|
||||||
return
|
|
||||||
|
|
||||||
self.loop.set_exception_handler(
|
self.loop.set_exception_handler(
|
||||||
lambda _, x: logging.error(
|
lambda _, x: logging.error(
|
||||||
f"Exception on event loop! {x['message']}",
|
f"Exception on event loop! {x['message']}",
|
||||||
|
|
Loading…
Reference in New Issue