diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c62592df8..3626b5f55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: check-case-conflict - repo: https://github.com/psf/black - rev: 6fdf8a4af28071ed1d079c01122b34c5d587207a # frozen: 24.2.0 + rev: 552baf822992936134cbd31a38f69c8cfe7c0f05 # frozen: 24.3.0 hooks: - id: black name: Black Python Formatter @@ -50,7 +50,7 @@ repos: args: ["--max-line-length=160", "--ignore=E266,E402,E501,E722,W503"] - repo: https://github.com/dosisod/refurb - rev: a9a4edd45687e664dee0905ba1c848bda227d1d6 # frozen: v1.28.0 + rev: 2e31f0033b6c00bf99912fc6a8b5fd00460c9ba0 # frozen: v2.0.0 hooks: - id: refurb name: Refurb Python Refactoring Tool @@ -72,6 +72,6 @@ repos: - id: gitleaks - repo: https://github.com/koalaman/shellcheck-precommit - rev: 3f77b826548d8dc2d26675f077361c92773b50a7 # frozen: v0.9.0 + rev: 2491238703a5d3415bb2b7ff11388bf775372f29 # frozen: v0.10.0 hooks: - id: shellcheck diff --git a/.prettierignore b/.prettierignore index ef8d1aa39..f4091ff2c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -18,3 +18,4 @@ src/ui/static/js/utils/purify/* src/ui/templates/* src/common/core/*/ui/* datepicker-foundation.css +examples/ diff --git a/docs/json2md.py b/docs/json2md.py index 761771819..777d88496 100755 --- a/docs/json2md.py +++ b/docs/json2md.py @@ -102,10 +102,10 @@ for pro in glob(f"v{version}/*/plugin.json"): core_settings[pro_plugin["name"]]["is_pro"] = True # Print plugins and their settings -for name, data in dict(sorted(core_settings.items())).items(): +for data in dict(sorted(core_settings.items())).values(): pro_crown = "" if "is_pro" in data: - pro_crown = f" crow pro icon (PRO)\n" + pro_crown = " crow pro icon (PRO)\n" print(f"## {data['name']}{pro_crown}\n", file=doc) print(f"{stream_support(data['stream'])}\n", file=doc) print(f"{data['description']}\n", file=doc) diff --git a/docs/security-tuning.md b/docs/security-tuning.md index 741872549..f9bb1c680 100644 --- a/docs/security-tuning.md +++ b/docs/security-tuning.md @@ -626,4 +626,4 @@ List of settings : - Accepted values for `REPORTING_SCHEDULE` are `daily`, `weekly`and `monthly`. - If no `REPORTING_SMTP_FROM_USER` and `REPORTING_SMTP_FROM_PASSWORD` are set, the plugin will try to send the email without authentication. - If `REPORTING_SMTP_FROM_USER` isn't set but `REPORTING_SMTP_FROM_PASSWORD` is set, the plugin will use the `REPORTING_SMTP_FROM_EMAIL` as the username. -- If the job fails, the plugin will retry sending the report in the next execution. \ No newline at end of file +- If the job fails, the plugin will retry sending the report in the next execution. diff --git a/src/common/core/letsencrypt/jobs/certbot-new.py b/src/common/core/letsencrypt/jobs/certbot-new.py index c7f96dba5..84937a889 100755 --- a/src/common/core/letsencrypt/jobs/certbot-new.py +++ b/src/common/core/letsencrypt/jobs/certbot-new.py @@ -58,7 +58,7 @@ def certbot_new(domains: str, email: str, use_letsencrypt_staging: bool = False) stdin=DEVNULL, stderr=PIPE, universal_newlines=True, - env=environ.copy() | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, + env=environ | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, ) while process.poll() is None: if process.stderr: @@ -124,7 +124,7 @@ try: stdout=PIPE, stderr=STDOUT, text=True, - env=environ.copy() | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, + env=environ | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, check=False, ) stdout = proc.stdout diff --git a/src/common/core/letsencrypt/jobs/certbot-renew.py b/src/common/core/letsencrypt/jobs/certbot-renew.py index a7aa6c612..99d5d123d 100755 --- a/src/common/core/letsencrypt/jobs/certbot-renew.py +++ b/src/common/core/letsencrypt/jobs/certbot-renew.py @@ -63,7 +63,7 @@ try: stdin=DEVNULL, stderr=PIPE, universal_newlines=True, - env=environ.copy() | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, + env=environ | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")}, ) while process.poll() is None: if process.stderr: diff --git a/src/scheduler/main.py b/src/scheduler/main.py index 7d841bd97..a14f6b8ed 100644 --- a/src/scheduler/main.py +++ b/src/scheduler/main.py @@ -252,7 +252,7 @@ if __name__ == "__main__": env["DATABASE_URI"] = db.database_uri # Instantiate scheduler - SCHEDULER = JobScheduler(env | environ.copy(), logger, INTEGRATION, db=db) + SCHEDULER = JobScheduler(env | environ, logger, INTEGRATION, db=db) if INTEGRATION in ("Docker", "Swarm", "Kubernetes", "Autoconf"): # Automatically setup the scheduler apis @@ -370,7 +370,7 @@ if __name__ == "__main__": logger.info("Running plugins download jobs ...") # Update the environment variables of the scheduler - SCHEDULER.env = env | environ.copy() + SCHEDULER.env = env | environ if not SCHEDULER.run_single("download-plugins"): logger.warning("download-plugins job failed at first start, plugins settings set by the user may not be up to date ...") if not SCHEDULER.run_single("download-pro-plugins"): @@ -454,7 +454,7 @@ if __name__ == "__main__": if RUN_JOBS_ONCE: # Update the environment variables of the scheduler - SCHEDULER.env = env | environ.copy() + SCHEDULER.env = env | environ SCHEDULER.setup() # Only run jobs once diff --git a/src/ui/src/Instances.py b/src/ui/src/Instances.py index d6dad9fa7..585f1f3f8 100644 --- a/src/ui/src/Instances.py +++ b/src/ui/src/Instances.py @@ -271,7 +271,7 @@ class Instances: def reload_instances(self) -> Union[list[str], str]: not_reloaded: list[str] = [] for instance in self.get_instances(): - if instance.health is False: + if not instance.health: not_reloaded.append(instance.name) continue diff --git a/tests/ui/instances_page.py b/tests/ui/instances_page.py index 6b2c1ada3..3031b5574 100644 --- a/tests/ui/instances_page.py +++ b/tests/ui/instances_page.py @@ -51,7 +51,7 @@ try: try: assert_button_click(DRIVER, f"//form[starts-with(@id, 'form-instance-')]//button[@value='{action}']") - log_info(f"Clicked on stop button, waiting 5s ...") + log_info("Clicked on stop button, waiting 5s ...") sleep(5) safe_get_element(DRIVER, By.XPATH, "//form[starts-with(@id, 'form-instance-')]", error=True) log_exception("Instance was not stopped successfully, exiting ...")