mirror of https://github.com/coddrago/Heroku
Add heroku specific update
parent
071f88db5e
commit
f622bf93c8
|
@ -3,7 +3,6 @@
|
||||||
## 🌑 Hikka 1.2.1
|
## 🌑 Hikka 1.2.1
|
||||||
|
|
||||||
- Add termux specific requirements
|
- Add termux specific requirements
|
||||||
- Ignore `heroku3` import error on non-heroku platforms
|
|
||||||
- Refactor `heroku.py` app searching algorithm
|
- Refactor `heroku.py` app searching algorithm
|
||||||
- Refactor postgresql database saving process
|
- Refactor postgresql database saving process
|
||||||
- Fix heroku restart message not being edited
|
- Fix heroku restart message not being edited
|
||||||
|
|
|
@ -14,17 +14,18 @@ from . import utils
|
||||||
|
|
||||||
|
|
||||||
def publish(
|
def publish(
|
||||||
key: str,
|
key: Optional[str] = None,
|
||||||
api_token: Optional[str] = None,
|
api_token: Optional[str] = None,
|
||||||
create_new: Optional[bool] = True,
|
create_new: Optional[bool] = True,
|
||||||
):
|
):
|
||||||
"""Push to heroku"""
|
"""Push to heroku"""
|
||||||
logging.debug("Configuring heroku...")
|
logging.debug("Configuring heroku...")
|
||||||
|
|
||||||
|
if key is None:
|
||||||
|
key = os.environ.get("heroku_api_token")
|
||||||
|
|
||||||
app, config = get_app(key, api_token, create_new)
|
app, config = get_app(key, api_token, create_new)
|
||||||
|
|
||||||
# Will be configured later in app
|
|
||||||
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,7 +42,10 @@ def publish(
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
app.install_addon("heroku-postgresql")
|
if not any(
|
||||||
|
addon.plan.name.startswith("heroku-buildpack-") for addon in app.addons()
|
||||||
|
):
|
||||||
|
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}@")
|
||||||
|
@ -71,8 +75,7 @@ def get_app(
|
||||||
config = poss_app.config()
|
config = poss_app.config()
|
||||||
|
|
||||||
if api_token is None or (
|
if api_token is None or (
|
||||||
config["api_id"] == api_token.ID
|
config["api_id"] == api_token.ID and config["api_hash"] == api_token.HASH
|
||||||
and config["api_hash"] == api_token.HASH
|
|
||||||
):
|
):
|
||||||
return app, config
|
return app, config
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,11 @@ class UpdaterMod(loader.Module):
|
||||||
os.system("lavhost update")
|
os.system("lavhost update")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if "DYNO" in os.environ:
|
||||||
|
await self._db.postgre_force_save()
|
||||||
|
heroku.publish(api_token=main.hikka.api_token, create_new=False)
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
msg_obj = await utils.answer(msg_obj, self.strings("downloading"))
|
msg_obj = await utils.answer(msg_obj, self.strings("downloading"))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in New Issue