Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • olasd/swh-web
  • lunar/swh-web
  • jayeshv/swh-web
  • bchauvet/swh-web
  • ardumont/swh-web
  • anlambert/swh-web
  • vlorentz/swh-web
  • swh/devel/swh-web
  • KShivendu/swh-web
  • pabs/swh-web
  • douardda/swh-web
  • bmeles/swh-web
  • marmoute/swh-web
  • rboyer/swh-web
14 results
Show changes
Commits on Source (7)
......@@ -2,12 +2,7 @@ const {defineConfig} = require('cypress');
module.exports = defineConfig({
projectId: 'swh-web',
// workaround performance regression in Cypress 14
// https://github.com/cypress-io/cypress/issues/30980
video: true,
videosFolder: '/tmp/cypress/videos/',
video: false,
viewportWidth: 1920,
viewportHeight: 1080,
defaultCommandTimeout: 20000,
......
......@@ -21,15 +21,15 @@
"dependencies": {
"@babel/runtime-corejs3": "^7.27.0",
"@ballerina/highlightjs-ballerina": "github:highlightjs/highlightjs-ballerina",
"@iframe-resizer/child": "^5.3.3",
"@iframe-resizer/parent": "^5.3.3",
"@iframe-resizer/child": "^5.4.4",
"@iframe-resizer/parent": "^5.4.4",
"@mdi/font": "^7.4.47",
"@popperjs/core": "^2.11.8",
"@sentry/browser": "^9.9.0",
"@sentry/browser": "^9.12.0",
"admin-lte": "^4.0.0-beta3",
"anchor-js": "^5.0.0",
"ansi_up": "^6.0.2",
"bootstrap": "^5.3.3",
"ansi_up": "^6.0.5",
"bootstrap": "^5.3.5",
"c3": "github:highlightjs/highlightjs-c3",
"chosen-js": "^1.8.7",
"clipboard": "^2.0.11",
......@@ -38,7 +38,7 @@
"datatables.net": "^2.2.2",
"datatables.net-bs5": "^2.2.2",
"datatables.net-fixedheader-bs5": "^4.0.1",
"dompurify": "^3.2.4",
"dompurify": "^3.2.5",
"email-validator": "^2.0.4",
"global": "^4.4.0",
"hex-rgb": "^5.0.0",
......@@ -78,7 +78,7 @@
"highlightjs-lookml": "github:spectacles-ci/highlightjs-lookml",
"highlightjs-lox": "^2.0.6",
"highlightjs-luau": "github:highlightjs/highlightjs-luau",
"highlightjs-macaulay2": "^0.2.5",
"highlightjs-macaulay2": "^0.3.0",
"highlightjs-mint": "github:mint-lang/highlightjs-mint#a0aedf13807107a9e167ff1e26fff89171de1e97",
"highlightjs-mirc": "github:highlightjs/highlightjs-mirc",
"highlightjs-mlir": "github:highlightjs/highlightjs-mlir",
......@@ -124,7 +124,7 @@
"object-fit-images": "^3.2.4",
"org": "^0.2.0",
"pathifist": "^1.0.1",
"pdfjs-dist": "^5.0.375",
"pdfjs-dist": "^5.1.91",
"prismjs-bibtex": "^2.1.0",
"showdown": "^2.1.0",
"typeface-alegreya": "^1.1.13",
......@@ -140,9 +140,9 @@
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@cypress/code-coverage": "^3.13.12",
"@eslint/compat": "^1.2.7",
"@sentry/webpack-plugin": "^3.2.2",
"@cypress/code-coverage": "^3.14.0",
"@eslint/compat": "^1.2.8",
"@sentry/webpack-plugin": "^3.3.1",
"autoprefixer": "^10.4.21",
"axe-core": "^4.10.3",
"axios": "^1.8.4",
......@@ -152,17 +152,17 @@
"copy-webpack-plugin": "^13.0.0",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.2",
"cypress": "^14.2.0",
"cypress-accessibility-checker": "^4.0.2",
"cypress": "^14.3.0",
"cypress-accessibility-checker": "^4.0.3",
"cypress-axe": "^1.6.0",
"cypress-hmr-restarter": "^2.1.1",
"cypress-multi-reporters": "^2.0.5",
"cypress-split": "^1.24.14",
"ejs": "^3.1.10",
"ejs-compiled-loader": "^3.1.0",
"eslint": "^9.23.0",
"eslint": "^9.24.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-cypress": "^4.2.0",
"eslint-plugin-cypress": "^4.2.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^7.2.1",
......@@ -187,7 +187,7 @@
"progress-bar-webpack-plugin": "^2.1.0",
"resolve-url-loader": "^5.0.0",
"robotstxt-webpack-plugin": "^8.0.0",
"sass": "^1.86.0",
"sass": "^1.86.3",
"sass-loader": "^16.0.5",
"schema-utils": "^4.3.0",
"script-loader": "^0.7.2",
......@@ -196,15 +196,15 @@
"spdx-expression-parse": "^4.0.0",
"sqlite3": "^5.1.7",
"style-loader": "^4.0.0",
"stylelint": "^16.16.0",
"stylelint-config-standard": "^37.0.0",
"stylelint": "^16.18.0",
"stylelint-config-standard": "^38.0.0",
"stylelint-webpack-plugin": "^5.0.1",
"terser-webpack-plugin": "^5.3.14",
"url-loader": "^4.1.1",
"webpack": "^5.98.0",
"webpack": "^5.99.5",
"webpack-bundle-tracker": "^3.1.1",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.0",
"webpack-dev-server": "^5.2.1",
"webpack-log": "^3.0.2",
"yaml-loader": "^0.8.1"
},
......
......@@ -699,12 +699,16 @@ def test_add_forge_request_update_gitlab_pipeline_trigger(
assert sent_request.url == trigger_url
assert sent_request.headers["Content-Type"] == "application/x-www-form-urlencoded"
id = request["id"]
lister_type = ADD_FORGE_DATA_FORGE1["forge_type"]
instance_name = urlparse(ADD_FORGE_DATA_FORGE1["forge_url"]).netloc
expected_form_data = {
"token": token,
"ref": "main",
"variables[LISTER_TYPE]": ADD_FORGE_DATA_FORGE1["forge_type"],
"variables[INSTANCE_NAME]": urlparse(ADD_FORGE_DATA_FORGE1["forge_url"]).netloc,
"variables[REQUEST_ID]": request["id"],
"name": f"AFNR#{id} {lister_type} {instance_name}",
"variables[LISTER_TYPE]": lister_type,
"variables[INSTANCE_NAME]": instance_name,
"variables[REQUEST_ID]": id,
}
assert requests_mock.request_history[0].body == urlencode(expected_form_data)
......
......@@ -19,6 +19,7 @@ def trigger_request_processing_pipeline(id, forge_type, forge_url):
data = {
"token": pipeline_token,
"ref": "main",
"name": f"AFNR#{id} {lister_type} {instance_name}",
"variables[LISTER_TYPE]": lister_type,
"variables[INSTANCE_NAME]": instance_name,
"variables[REQUEST_ID]": request_id,
......
# Copyright (C) 2024 The Software Heritage developers
# Copyright (C) 2024-2025 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
import os
from django.conf import settings
from django.contrib import admin
......@@ -11,36 +10,33 @@ from django.urls import path as url
from swh.web.config import get_config, oidc_enabled
# prevent code execution when building documentation to avoid errors
# with autodoc processing
if "SWH_DOC_BUILD" not in os.environ:
config = get_config()
config = get_config()
if oidc_enabled():
# use swh-auth views in admin site for login/logout when webapp
# uses Keycloak for authentication
from swh.auth.django.views import oidc_login, oidc_logout
if oidc_enabled():
# use swh-auth views in admin site for login/logout when webapp
# uses Keycloak for authentication
from swh.auth.django.views import oidc_login, oidc_logout
admin.site.login = oidc_login # type: ignore[assignment]
admin.site.logout = oidc_logout # type: ignore[assignment]
admin.site.login = oidc_login # type: ignore[assignment]
admin.site.logout = oidc_logout # type: ignore[assignment]
if "swh.web.add_forge_now" in settings.SWH_DJANGO_APPS:
# register add forge now request model as manageable by admin site
from swh.web.add_forge_now.models import Request
if "swh.web.add_forge_now" in settings.SWH_DJANGO_APPS:
# register add forge now request model as manageable by admin site
from swh.web.add_forge_now.models import Request
if not admin.site.is_registered(Request):
admin.site.register(Request)
if not admin.site.is_registered(Request):
admin.site.register(Request)
if "swh.web.save_code_now" in settings.SWH_DJANGO_APPS:
# register save code now request model as manageable by admin site
from swh.web.save_code_now.models import SaveOriginRequest
if "swh.web.save_code_now" in settings.SWH_DJANGO_APPS:
# register save code now request model as manageable by admin site
from swh.web.save_code_now.models import SaveOriginRequest
if not admin.site.is_registered(SaveOriginRequest):
admin.site.register(SaveOriginRequest)
if not admin.site.is_registered(SaveOriginRequest):
admin.site.register(SaveOriginRequest)
admin.site.site_header = "swh-web management"
admin.site.site_title = "Software Heritage Web Application management"
admin.site.site_header = "swh-web management"
admin.site.site_title = "Software Heritage Web Application management"
urlpatterns = [
url("manage/", admin.site.urls),
]
urlpatterns = [
url("manage/", admin.site.urls),
]
......@@ -114,7 +114,7 @@ td.swh-branch-date {
}
.chosen-container-active {
box-shadow: 0 0 0 0.2rem rgba(226 0 38 / 25%);
box-shadow: 0 0 0 0.2rem rgb(226 0 38 / 25%);
z-index: 10;
}
......
......@@ -238,9 +238,10 @@ def _get_content_from_request(request: HttpRequest) -> Dict[str, Any]:
browse_context="content",
visit_type=request.GET.get("visit_type"),
)
root_directory = snapshot_context["root_directory"]
assert root_directory is not None # to keep mypy happy
return archive.lookup_directory_with_path(root_directory, path)
if root_directory := snapshot_context["root_directory"]:
return archive.lookup_directory_with_path(root_directory, path)
# this should only happen in staging due to a partial storage
raise NotFoundExc(f"Missing root directory for {snapshot}")
@browse_route(
......
......@@ -36,7 +36,9 @@ See top-level LICENSE file for more information
{% endif %}
{% if "tarball" in visit_types %}
<li>
<code>tarball</code>, for tarball origins
<code>tarball</code>, for tarball origins (supported formats: <code>.jar</code>, <code>.tar</code>,
<code>.tar.bz2</code>, <code>.tar.gz</code>, <code>.tar.lz</code>, <code>.tar.xz</code>,
<code>.tar.zst</code>, <code>.zip</code>)
</li>
{% endif %}
</ul>
......
# Copyright (C) 2017-2022 The Software Heritage developers
# Copyright (C) 2017-2025 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -59,6 +59,7 @@ def _hljs_languages_aliases():
"pow": "poweron",
"ttcn": "ttcn3",
"ttcnpp": "ttcn3",
"rkt": "lisp",
}
......
# Copyright (C) 2017-2022 The Software Heritage developers
# Copyright (C) 2017-2025 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
import pytest
from swh.web.utils import highlightjs
def test_get_hljs_language_from_mime_type():
lang = highlightjs.get_hljs_language_from_mime_type("text/plain")
assert lang == "plaintext"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-c")
assert lang == "c"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-c++")
assert lang == "cpp"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-perl")
assert lang == "perl"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-python")
assert lang == "python"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-msdos-batch")
assert lang == "dos"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-tex")
assert lang == "latex"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-lisp")
assert lang == "lisp"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-java")
assert lang == "java"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-makefile")
assert lang == "makefile"
lang = highlightjs.get_hljs_language_from_mime_type("text/x-shellscript")
assert lang == "bash"
lang = highlightjs.get_hljs_language_from_mime_type("text/html")
assert lang == "xml"
lang = highlightjs.get_hljs_language_from_mime_type("image/png")
assert lang is None
def test_get_hljs_language_from_filename():
for filename, language in (
@pytest.mark.parametrize(
"mime_type, language",
[
("text/plain", "plaintext"),
("text/x-c", "c"),
("text/x-c++", "cpp"),
("text/x-perl", "perl"),
("text/x-python", "python"),
("text/x-msdos-batch", "dos"),
("text/x-tex", "latex"),
("text/x-lisp", "lisp"),
("text/x-java", "java"),
("text/x-makefile", "makefile"),
("text/x-shellscript", "bash"),
("text/html", "xml"),
("image/png", None),
],
)
def test_get_hljs_language_from_mime_type(mime_type, language):
lang = highlightjs.get_hljs_language_from_mime_type(mime_type)
assert lang == language
@pytest.mark.parametrize(
"filename, language",
[
("foo", None),
("foo.h", "c"),
("foo.c", "c"),
......@@ -76,10 +60,14 @@ def test_get_hljs_language_from_filename():
("Makefile", "makefile"),
("CMakeLists.txt", "cmake"),
("robots.txt", "robots-txt"),
):
lang = highlightjs.get_hljs_language_from_filename(filename)
assert lang == language
],
)
def test_get_hljs_language_from_filename(filename, language):
lang = highlightjs.get_hljs_language_from_filename(filename)
assert lang == language
def test_hljs_languages_aliases():
for alias, language in highlightjs._hljs_languages_aliases().items():
lang = highlightjs.get_hljs_language_from_filename(f"foo.{alias}")
assert lang == language
This diff is collapsed.