diff --git a/swh/web/assets/config/webpack-plugins/generate-weblabels-webpack-plugin/index.js b/swh/web/assets/config/webpack-plugins/generate-weblabels-webpack-plugin/index.js --- a/swh/web/assets/config/webpack-plugins/generate-weblabels-webpack-plugin/index.js +++ b/swh/web/assets/config/webpack-plugins/generate-weblabels-webpack-plugin/index.js @@ -191,10 +191,16 @@ let parsedSpdxLicenses = this.parseSpdxLicenseExpression(scriptSrc['spdxLicenseExpression'], `file ${scriptSrc['path']}`); scriptSrcData['licenses'] = this.spdxToWebLabelsLicenses(parsedSpdxLicenses); - let licenseCopyUrl = this.copyLicenseFile(licenceFilePath); - scriptSrcData['licenses'].forEach(license => { - license['copy_url'] = licenseCopyUrl; - }); + if (licenceFilePath.indexOf('://') === -1 && !licenceFilePath.startsWith('/')) { + let licenseCopyUrl = this.copyLicenseFile(licenceFilePath); + scriptSrcData['licenses'].forEach(license => { + license['copy_url'] = licenseCopyUrl; + }); + } else { + scriptSrcData['licenses'].forEach(license => { + license['copy_url'] = licenceFilePath; + }); + } if (scriptSrc['path'].indexOf('://') === -1 && !scriptSrc['path'].startsWith('/')) { scriptSrcData['src_url'] = stats.publicPath + path.join(this.weblabelsDirName, scriptSrc['id']); } else { diff --git a/swh/web/assets/config/webpack.config.development.js b/swh/web/assets/config/webpack.config.development.js --- a/swh/web/assets/config/webpack.config.development.js +++ b/swh/web/assets/config/webpack.config.development.js @@ -431,6 +431,14 @@ 'spdxLicenseExpression': 'AGPL-3.0-or-later', 'licenseFilePath': './LICENSE' } + ], + 'https://piwik.inria.fr/matomo.js': [ + { + 'id': 'matomo.js', + 'path': 'https://github.com/matomo-org/matomo/blob/master/js/piwik.js', + 'spdxLicenseExpression': 'BSD-3-Clause', + 'licenseFilePath': 'https://github.com/matomo-org/matomo/blob/master/js/LICENSE.txt' + } ] } ) diff --git a/swh/web/common/utils.py b/swh/web/common/utils.py --- a/swh/web/common/utils.py +++ b/swh/web/common/utils.py @@ -4,6 +4,7 @@ # See top-level LICENSE file for more information from datetime import datetime, timezone +import os import re from typing import Any, Dict, Optional @@ -263,6 +264,7 @@ "browsers_supported_image_mimes": browsers_supported_image_mimes, "keycloak": config["keycloak"], "site_base_url": request.build_absolute_uri("/"), + "DJANGO_SETTINGS_MODULE": os.environ["DJANGO_SETTINGS_MODULE"], } diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -64,6 +64,24 @@ + {% if "production" in DJANGO_SETTINGS_MODULE %} + + + + + + {% endif %} +