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