From 6dd774b1c4cc39aa360b213d87cb7abf0f0e8078 Mon Sep 17 00:00:00 2001 From: Giovanni Pellerano Date: Mon, 18 Nov 2024 19:46:48 +0100 Subject: [PATCH] Refactor README.md to be able to host more projects metrics --- README.md | 18 +++++++++++------- backend/globaleaks/settings.py | 10 ++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4f9a41b77e..40bf4366b3 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,18 @@ The software is recognized by the [Digital Public Good Alliance](https://digitalpublicgoods.net) as a [Digital Public Good](https://app.digitalpublicgoods.net/a/11113). ## Continuous integration and testing -| Branch | Build Status | Test Status | Quality | Coverage | Documentation -| :---: | :---: | :---: | :---: | :---: | :---: | -| [stable](https://github.com/globaleaks/globaleaks-whistleblowing-software/tree/stable) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml/badge.svg?branch=stable)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml?query=branch%3Astable) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test.yml/badge.svg?branch=stable)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test.yml?query=branch%3Astable) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c09f1ec9607f4546924d19798a98dd7d?branch=stable)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/c09f1ec9607f4546924d19798a98dd7d?branch=stable)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | [![Build Status](https://readthedocs.org/projects/globaleaks/badge/?version=stable&style=flat)](https://docs.globaleaks.org/en/stable/) -| [devel](https://github.com/globaleaks/globaleaks-whistleblowing-software/tree/devel) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml/badge.svg?branch=devel)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml?query=branch%3Adevel) | [![test workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test.yml/badge.svg?branch=devel)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test.yml?query=branch%3Adevel) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c09f1ec9607f4546924d19798a98dd7d?branch=devel)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard?branch=devel) | [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/c09f1ec9607f4546924d19798a98dd7d?branch=devel)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard?branch=devel) | [![Build Status](https://readthedocs.org/projects/globaleaks/badge/?version=devel&style=flat)](https://docs.globaleaks.org/en/devel/) - -Project best practices and scores: +| Metric | [Stable branch](https://github.com/globaleaks/globaleaks-whistleblowing-software/tree/stable) | [Devel branch](https://github.com/globaleaks/globaleaks-whistleblowing-software/tree/devel) | +| :---- | :---- | :---- | +| Build Status | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml/badge.svg?branch=stable)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml?query=branch%3Astable) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml/badge.svg?branch=devel)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/build.yml?query=branch%3Adevel) | +| Tests (Backend) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-backend.yml/badge.svg?branch=stable)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-backend.yml?query=branch%3Astable) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-backend.yml/badge.svg?branch=devel)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-backend.yml?query=branch%3Adevel) | +| Tests (Client) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-client.yml/badge.svg?branch=stable)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-client.yml?query=branch%3Astable) | [![build workflow](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-client.yml/badge.svg?branch=devel)](https://github.com/globaleaks/globaleaks-whistleblowing-software/actions/workflows/test-client.yml?query=branch%3Adevel) | +| Tests Coverage | [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/c09f1ec9607f4546924d19798a98dd7d?branch=stable)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/c09f1ec9607f4546924d19798a98dd7d?branch=devel)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | +| Code Quality | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c09f1ec9607f4546924d19798a98dd7d?branch=stable)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c09f1ec9607f4546924d19798a98dd7d?branch=devel)](https://app.codacy.com/gh/globaleaks/globaleaks-whistleblowing-software/dashboard) | +| Documentation | [![Build Status](https://readthedocs.org/projects/globaleaks/badge/?version=stable&style=flat)](https://docs.globaleaks.org/en/stable/) | [![Build Status](https://readthedocs.org/projects/globaleaks/badge/?version=devel&style=flat)](https://docs.globaleaks.org/en/devel/) | + +## Project best practices and scores | Metric | Score -| :---: | :---: | +| :---- | :---- | | [OpenSSF Scorecard](https://scorecard.dev/) | [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/globaleaks/globaleaks-whistleblowing-software/badge)](https://scorecard.dev/viewer/?uri=github.com/globaleaks/globaleaks-whistleblowing-software) | [OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/) | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3816/badge)](https://bestpractices.coreinfrastructure.org/projects/3816) | [MDN HTTP Observatory](https://developer.mozilla.org/en-US/observatory/analyze?host=try.globaleaks.org) | ![Status](https://img.shields.io/badge/observatory-A%2B-brightgreen) diff --git a/backend/globaleaks/settings.py b/backend/globaleaks/settings.py index f0272395b6..19a6d718d7 100644 --- a/backend/globaleaks/settings.py +++ b/backend/globaleaks/settings.py @@ -8,8 +8,8 @@ this_directory = os.path.dirname(__file__) possible_client_paths = [ - os.path.abspath(os.path.join(this_directory, '../../client/build/')), - '/usr/share/globaleaks/client' + '/usr/share/globaleaks/client', + os.path.abspath(os.path.join(this_directory, '../../client/build/')) ] @@ -98,14 +98,16 @@ def eval_paths(self): self.accesslogfile = os.path.abspath(os.path.join(self.log_path, "access.log")) # Client path detection + client_found=False + self.client_path = possible_client_paths[0] for path in possible_client_paths: if os.path.isfile(os.path.join(path, 'index.html')): self.client_path = path + client_found=True break - if self.client_path is None: + if not client_found: print("Unable to find a directory to load the client from") - sys.exit(1) self.appdata_file = os.path.join(self.client_path, 'data/appdata.json') self.questionnaires_path = os.path.join(self.client_path, 'data/questionnaires')