mirror of https://github.com/coddrago/Heroku
Install postgresql, fix session import on heroku
parent
867f2c542d
commit
e67b98a999
|
@ -24,7 +24,7 @@ def publish(
|
||||||
app, config = get_app(key, api_token, create_new)
|
app, config = get_app(key, api_token, create_new)
|
||||||
|
|
||||||
# Will be configured later in app
|
# Will be configured later in app
|
||||||
config["HIKKA_SESSION"] = None
|
config["HIKKA_SESSION"] = "None"
|
||||||
config["heroku_api_token"] = key
|
config["heroku_api_token"] = key
|
||||||
|
|
||||||
if api_token is not None:
|
if api_token is not None:
|
||||||
|
@ -41,6 +41,8 @@ def publish(
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
app.install_addon("heroku-postgresql")
|
||||||
|
|
||||||
repo = get_repo()
|
repo = get_repo()
|
||||||
url = app.git_url.replace("https://", f"https://api:{key}@")
|
url = app.git_url.replace("https://", f"https://api:{key}@")
|
||||||
|
|
||||||
|
|
|
@ -290,24 +290,6 @@ class Hikka:
|
||||||
self._get_api_token()
|
self._get_api_token()
|
||||||
self._get_proxy()
|
self._get_proxy()
|
||||||
|
|
||||||
if "DYNO" in os.environ and "HIKKA_SESSION" in os.environ:
|
|
||||||
try:
|
|
||||||
client = TelegramClient(
|
|
||||||
StringSession(os.environ.get("HIKKA_SESSION")),
|
|
||||||
self.api_token.ID,
|
|
||||||
self.api_token.HASH,
|
|
||||||
connection=self.conn,
|
|
||||||
proxy=self.proxy,
|
|
||||||
connection_retries=None,
|
|
||||||
device_model="Hikka",
|
|
||||||
)
|
|
||||||
|
|
||||||
client.start()
|
|
||||||
install_entity_caching(client)
|
|
||||||
self.clients += [client]
|
|
||||||
except Exception:
|
|
||||||
logging.exception("Failed to load session")
|
|
||||||
|
|
||||||
def _get_proxy(self):
|
def _get_proxy(self):
|
||||||
"""
|
"""
|
||||||
Get proxy tuple from --proxy-host, --proxy-port and --proxy-secret
|
Get proxy tuple from --proxy-host, --proxy-port and --proxy-secret
|
||||||
|
@ -346,7 +328,7 @@ class Hikka:
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
if "HIKKA_SESSION" in os.environ:
|
if os.environ.get("HIKKA_SESSION") not in {None, "None"}:
|
||||||
self.sessions += [StringSession(os.environ.get("HIKKA_SESSION"))]
|
self.sessions += [StringSession(os.environ.get("HIKKA_SESSION"))]
|
||||||
|
|
||||||
def _get_api_token(self):
|
def _get_api_token(self):
|
||||||
|
|
Loading…
Reference in New Issue