mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Update is_pro value when fetching metadata
This commit is contained in:
parent
5f2a284587
commit
e0969c87bd
2 changed files with 3 additions and 3 deletions
|
|
@ -290,14 +290,14 @@ class Database:
|
|||
|
||||
def get_metadata(self) -> Dict[str, str]:
|
||||
"""Get the metadata from the database"""
|
||||
data = {"version": "1.5.6", "integration": "unknown", "database_version": "Unknown", "is_pro": False}
|
||||
data = {"version": "1.5.6", "integration": "unknown", "database_version": "Unknown", "is_pro": "no"}
|
||||
database = self.database_uri.split(":")[0].split("+")[0]
|
||||
with self.__db_session() as session:
|
||||
with suppress(ProgrammingError, OperationalError):
|
||||
data["database_version"] = (session.execute(text("SELECT sqlite_version()" if database == "sqlite" else "SELECT VERSION()")).first() or ["unknown"])[0]
|
||||
metadata = session.query(Metadata).with_entities(Metadata.version, Metadata.integration, Metadata.is_pro).filter_by(id=1).first()
|
||||
if metadata:
|
||||
data.update({"version": metadata.version, "integration": metadata.integration, "is_pro": metadata.is_pro})
|
||||
data.update({"version": metadata.version, "integration": metadata.integration, "is_pro": "yes" if metadata.is_pro else "no"})
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ def inject_variables():
|
|||
return dict(
|
||||
dark_mode=app.config["DARK_MODE"],
|
||||
script_nonce=app.config["SCRIPT_NONCE"],
|
||||
is_pro_version=db.get_metadata()["is_pro"],
|
||||
is_pro_version=db.get_metadata()["is_pro"] == "yes",
|
||||
plugins=app.config["CONFIG"].get_plugins(),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue