├── .achecker.yml ├── .copier-answers.yml ├── .git-blame-ignore-revs ├── .gitignore ├── .pre-commit-config.yaml ├── AUTHORS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTORS ├── LICENSE ├── MANIFEST.in ├── Makefile ├── Makefile.local ├── README.rst ├── assets ├── config │ ├── webpack-plugins │ │ ├── dump-highlightjs-languages-data-plugin.js │ │ ├── fix-swh-source-maps-webpack-plugin.js │ │ └── generate-weblabels-webpack-plugin │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── jslicenses.ejs │ │ │ ├── plugin-options-schema.json │ │ │ └── spdx-licenses-mapping.js │ ├── webpack.config.development.js │ └── webpack.config.production.js └── src │ ├── thirdparty │ └── jquery.tabSlideOut │ │ ├── LICENSE │ │ ├── jquery.tabSlideOut.css │ │ └── jquery.tabSlideOut.js │ └── utils │ ├── constants.js │ ├── d3.js │ ├── functions.js │ ├── highlightjs.css │ ├── highlightjs.js │ ├── hljs-swh-theme.css │ ├── mathjax.js │ ├── org.css │ ├── org.js │ ├── requests-filter-checkbox.ejs │ ├── scrolling.js │ ├── showdown.css │ └── showdown.js ├── conftest.py ├── cypress.config.js ├── cypress ├── e2e │ ├── accessibility.cy.js │ ├── add-forge-now-request-create.cy.js │ ├── add-forge-now-request-dashboard.cy.js │ ├── add-forge-now-requests-moderation.cy.js │ ├── admin.cy.js │ ├── alter.cy.js │ ├── api-tokens.cy.js │ ├── back-to-top.cy.js │ ├── code-highlighting.cy.js │ ├── content-display.cy.js │ ├── content-rendering.cy.js │ ├── deposit-admin.cy.js │ ├── directory.cy.js │ ├── errors.cy.js │ ├── guided-tour.cy.js │ ├── home.cy.js │ ├── language-select.cy.js │ ├── layout.cy.js │ ├── mailmap.cy.js │ ├── origin-browse.cy.js │ ├── origin-save.cy.js │ ├── origin-search.cy.js │ ├── origin-visits.cy.js │ ├── revision-diff.cy.js │ ├── sidebar.cy.js │ ├── sidetabs.cy.js │ └── vault.cy.js ├── fixtures │ ├── add-forge-now-requests.json │ ├── example.json │ ├── origin-save.json │ ├── save-task-info.json │ ├── swh_1_dir_cd19126d815470b28919d64b2a8e6a3e37f900dd.tar.gz │ └── swh_1_rev_1c480a4573d2a003fc2630c21c2b25829de49972.git.tar ├── plugins │ └── index.js ├── support │ └── e2e.js └── utils │ └── index.js ├── docs ├── .gitignore ├── Makefile ├── _static │ └── .placeholder ├── _templates │ └── .placeholder ├── conf.py ├── developers-info.rst ├── index.rst ├── uri-scheme-api-content.rst ├── uri-scheme-api-directory.rst ├── uri-scheme-api-extid.rst ├── uri-scheme-api-graph.rst ├── uri-scheme-api-origin.rst ├── uri-scheme-api-provenance.rst ├── uri-scheme-api-release.rst ├── uri-scheme-api-request-archival.rst ├── uri-scheme-api-revision.rst ├── uri-scheme-api-snapshot.rst ├── uri-scheme-api-stat.rst ├── uri-scheme-api-swhids.rst ├── uri-scheme-api-vault.rst ├── uri-scheme-api.rst ├── uri-scheme-browse-content.rst ├── uri-scheme-browse-directory.rst ├── uri-scheme-browse-origin.rst ├── uri-scheme-browse-release.rst ├── uri-scheme-browse-revision.rst ├── uri-scheme-browse-snapshot.rst ├── uri-scheme-browse.rst ├── uri-scheme-misc.rst └── uri-scheme-swhids.rst ├── eslint.config.js ├── mirror_demo ├── config.yml ├── static │ └── partner_logo.png └── templates │ ├── mirror-footer.html │ └── mirror-homepage.html ├── nyc.config.js ├── package.json ├── pyproject.toml ├── requirements-swh.txt ├── requirements-test.txt ├── requirements.txt ├── swh └── web │ ├── __init__.py │ ├── add_forge_now │ ├── __init__.py │ ├── admin_views.py │ ├── api_views.py │ ├── apps.py │ ├── assets │ │ ├── add-forge.css │ │ ├── add-request-history-item.ejs │ │ ├── create-request.js │ │ ├── forge-admin-email.ejs │ │ ├── forge-success-email.ejs │ │ ├── index.js │ │ ├── moderation-dashboard.js │ │ └── request-dashboard.js │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_authorized_null_comment.py │ │ ├── 0003_request_submitter_forward_username.py │ │ ├── 0004_rename_tables.py │ │ ├── 0005_prepare_inbound_email.py │ │ ├── 0006_request_add_new_fields.py │ │ ├── 0007_rename_denied_request_status.py │ │ ├── 0008_turn_request_forge_url_into_url_field.py │ │ ├── 0009_canonicalise_forge_urls.py │ │ ├── __init__.py │ │ └── swh-afn-urls-canonicalise.txt │ ├── models.py │ ├── signal_receivers.py │ ├── templates │ │ ├── add-forge-common.html │ │ ├── add-forge-creation-form.html │ │ ├── add-forge-help.html │ │ ├── add-forge-list.html │ │ ├── add-forge-request-dashboard.html │ │ └── add-forge-requests-moderation.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_api_views.py │ │ ├── test_app.py │ │ ├── test_migration.py │ │ ├── test_models.py │ │ └── test_views.py │ ├── urls.py │ ├── utils.py │ └── views.py │ ├── admin │ ├── __init__.py │ ├── apps.py │ ├── templates │ │ └── admin │ │ │ └── base_site.html │ ├── tests │ │ ├── __init__.py │ │ └── test_app.py │ └── urls.py │ ├── alter │ ├── __init__.py │ ├── apps.py │ ├── assets │ │ ├── alter.css │ │ └── index.js │ ├── emails.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── templates │ │ ├── admin_alteration.html │ │ ├── admin_dashboard.html │ │ ├── alter_common.html │ │ ├── alteration_access.html │ │ ├── alteration_details.html │ │ ├── assistant_category.html │ │ ├── assistant_email.html │ │ ├── assistant_origins.html │ │ ├── assistant_reasons.html │ │ ├── assistant_summary.html │ │ ├── content_policies.html │ │ ├── emails │ │ │ ├── admin_alteration_notification.txt │ │ │ ├── admin_message_notification.txt │ │ │ ├── alteration_confirmation.txt │ │ │ ├── alteration_magic_link.txt │ │ │ ├── email_magic_link.txt │ │ │ └── message_notification.txt │ │ └── includes │ │ │ ├── activity_log.html │ │ │ ├── origins_table.html │ │ │ ├── reasons_outcome.html │ │ │ ├── steps.html │ │ │ └── swh_legal.html │ ├── templatetags │ │ ├── __init__.py │ │ └── alter_extras.py │ ├── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_app.py │ │ ├── test_emails.py │ │ ├── test_forms.py │ │ ├── test_models.py │ │ ├── test_templatetags.py │ │ ├── test_utils.py │ │ └── test_views.py │ ├── urls.py │ ├── utils.py │ └── views.py │ ├── api │ ├── __init__.py │ ├── apidoc.py │ ├── apiresponse.py │ ├── apiurls.py │ ├── parsers.py │ ├── renderers.py │ ├── serializers.py │ ├── templates │ │ ├── api-endpoints.html │ │ ├── api.html │ │ └── apidoc.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_api_lookup.py │ │ ├── test_apidoc.py │ │ ├── test_apiresponse.py │ │ ├── test_apiurls.py │ │ ├── test_serializers.py │ │ ├── test_throttling.py │ │ ├── test_utils.py │ │ └── views │ │ │ ├── __init__.py │ │ │ ├── test_citation.py │ │ │ ├── test_content.py │ │ │ ├── test_directory.py │ │ │ ├── test_extid.py │ │ │ ├── test_graph.py │ │ │ ├── test_identifiers.py │ │ │ ├── test_metadata.py │ │ │ ├── test_origin.py │ │ │ ├── test_ping.py │ │ │ ├── test_raw.py │ │ │ ├── test_release.py │ │ │ ├── test_revision.py │ │ │ ├── test_snapshot.py │ │ │ ├── test_stat.py │ │ │ └── utils.py │ ├── throttling.py │ ├── urls.py │ ├── utils.py │ └── views │ │ ├── __init__.py │ │ ├── citation.py │ │ ├── content.py │ │ ├── directory.py │ │ ├── extid.py │ │ ├── graph.py │ │ ├── identifiers.py │ │ ├── metadata.py │ │ ├── origin.py │ │ ├── ping.py │ │ ├── raw.py │ │ ├── release.py │ │ ├── revision.py │ │ ├── snapshot.py │ │ ├── stat.py │ │ └── utils.py │ ├── archive_coverage │ ├── __init__.py │ ├── assets │ │ ├── coverage.css │ │ └── index.js │ ├── templates │ │ └── archive-coverage.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_coverage.py │ ├── urls.py │ └── views.py │ ├── auth │ ├── __init__.py │ ├── apps.py │ ├── assets │ │ ├── auth.css │ │ └── index.js │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_remove_stored_tokens.py │ │ ├── 0003_delete_oidcuser.py │ │ ├── 0004_usermailmap.py │ │ ├── 0005_usermailmapevent.py │ │ ├── 0006_fix_mailmap_admin_user_id.py │ │ ├── 0007_mailmap_django_app.py │ │ ├── 0008_create_webapp_permissions.py │ │ ├── 0009_create_provenance_permission.py │ │ └── __init__.py │ ├── models.py │ ├── templates │ │ ├── login.html │ │ ├── logout.html │ │ └── profile.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_migrations.py │ │ ├── test_utils.py │ │ └── test_views.py │ ├── urls.py │ ├── utils.py │ └── views.py │ ├── badges │ ├── __init__.py │ ├── assets │ │ ├── badges.css │ │ └── index.js │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_badges.py │ └── urls.py │ ├── banners │ ├── __init__.py │ ├── templates │ │ ├── banner-iframe.html │ │ ├── downtime-banner.html │ │ ├── fundraising-banner.html │ │ └── hiring-banner.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_banners.py │ ├── urls.py │ └── views.py │ ├── browse │ ├── __init__.py │ ├── assets │ │ ├── browse │ │ │ ├── breadcrumbs.css │ │ │ ├── browse-utils.js │ │ │ ├── browse.css │ │ │ ├── content.css │ │ │ ├── iframe.js │ │ │ ├── index.js │ │ │ ├── origin-search.js │ │ │ ├── sidetabs.js │ │ │ ├── snapshot-navigation.css │ │ │ └── snapshot-navigation.js │ │ ├── guided_tour │ │ │ ├── guided-tour-steps.yaml │ │ │ ├── index.js │ │ │ └── swh-introjs.css │ │ ├── origin_visits │ │ │ ├── index.js │ │ │ ├── utils.js │ │ │ ├── visits-calendar.js │ │ │ ├── visits-histogram.js │ │ │ ├── visits-reporting.css │ │ │ └── visits-reporting.js │ │ └── revision │ │ │ ├── diff-panel.ejs │ │ │ ├── diff-utils.js │ │ │ ├── index.js │ │ │ ├── log-utils.js │ │ │ └── revision.css │ ├── browseurls.py │ ├── identifiers.py │ ├── snapshot_context.py │ ├── templates │ │ ├── browse-branches.html │ │ ├── browse-content.html │ │ ├── browse-directory.html │ │ ├── browse-help.html │ │ ├── browse-iframe.html │ │ ├── browse-origin-visits.html │ │ ├── browse-release.html │ │ ├── browse-releases.html │ │ ├── browse-revision-log.html │ │ ├── browse-revision.html │ │ ├── browse-search.html │ │ ├── browse.html │ │ └── includes │ │ │ ├── branch-search.html │ │ │ ├── breadcrumbs.html │ │ │ ├── content-display.html │ │ │ ├── directory-display.html │ │ │ ├── empty-snapshot.html │ │ │ ├── origin-search-form.html │ │ │ ├── readme-display.html │ │ │ ├── revision-info.html │ │ │ ├── show-metadata.html │ │ │ ├── sidetabs.html │ │ │ ├── snapshot-context.html │ │ │ └── top-navigation.html │ ├── tests │ │ ├── __init__.py │ │ ├── data │ │ │ └── content_iso-8859-7_encoded │ │ ├── test_snapshot_context.py │ │ ├── test_utils.py │ │ └── views │ │ │ ├── __init__.py │ │ │ ├── conftest.py │ │ │ ├── test_content.py │ │ │ ├── test_directory.py │ │ │ ├── test_identifiers.py │ │ │ ├── test_iframe.py │ │ │ ├── test_origin.py │ │ │ ├── test_release.py │ │ │ ├── test_revision.py │ │ │ └── test_snapshot.py │ ├── urls.py │ ├── utils.py │ └── views │ │ ├── __init__.py │ │ ├── content.py │ │ ├── directory.py │ │ ├── iframe.py │ │ ├── origin.py │ │ ├── release.py │ │ ├── revision.py │ │ └── snapshot.py │ ├── config.py │ ├── conftest.py │ ├── deposit │ ├── __init__.py │ ├── assets │ │ └── index.js │ ├── templates │ │ └── deposit-admin.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_views.py │ └── urls.py │ ├── gunicorn_config.py │ ├── inbound_email │ ├── __init__.py │ ├── apps.py │ ├── handle_message.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── process_inbound_email.py │ ├── signals.py │ ├── tests │ │ ├── __init__.py │ │ ├── common_tests.py │ │ ├── resources │ │ │ ├── __init__.py │ │ │ ├── bounce-implicit-dest.eml │ │ │ ├── multipart_alternative.eml │ │ │ ├── multipart_alternative_html_only.eml │ │ │ ├── multipart_alternative_recursive.eml │ │ │ ├── multipart_alternative_text_only.eml │ │ │ ├── multipart_iso8859-1.eml │ │ │ ├── multipart_mixed.eml │ │ │ ├── multipart_mixed2.eml │ │ │ ├── multipart_mixed_text_only.eml │ │ │ ├── multipart_related.eml │ │ │ └── plaintext.eml │ │ ├── test_management_command.py │ │ ├── test_utils.py │ │ └── test_views.py │ ├── urls.py │ ├── utils.py │ └── views.py │ ├── jslicenses │ ├── __init__.py │ ├── templates │ │ └── jslicenses.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_jslicenses.py │ └── urls.py │ ├── mailmap │ ├── __init__.py │ ├── apps.py │ ├── assets │ │ ├── index.js │ │ └── mailmap-form.ejs │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ ├── sync_mailmaps.py │ │ │ └── sync_masking_mailmaps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── templates │ │ └── admin │ │ │ └── mailmap.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ ├── test_mailmap.py │ │ ├── test_mailmap_legacy.py │ │ ├── test_masking_mailmap.py │ │ └── test_migrations.py │ ├── urls.py │ └── views.py │ ├── manage.py │ ├── metrics │ ├── __init__.py │ ├── prometheus.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ └── test_metrics.py │ ├── urls.py │ └── views.py │ ├── provenance │ ├── __init__.py │ ├── api_views.py │ ├── apps.py │ ├── tests │ │ ├── test_api_views.py │ │ └── test_apps.py │ └── urls.py │ ├── py.typed │ ├── save_bulk │ ├── __init__.py │ ├── api_views.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_alter_savebulkorigin_origin_url.py │ │ └── __init__.py │ ├── models.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_api_views.py │ │ ├── test_migrations.py │ │ └── test_views.py │ ├── urls.py │ └── views.py │ ├── save_code_now │ ├── __init__.py │ ├── admin_views.py │ ├── api_views.py │ ├── apps.py │ ├── assets │ │ ├── artifact-form-row.ejs │ │ ├── index.js │ │ ├── origin-save-admin.js │ │ └── origin-save.js │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ ├── dump_savecodenow_data.py │ │ │ └── refresh_savecodenow_statuses.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_saveoriginrequest_visit_date.py │ │ ├── 0003_saveoriginrequest_loading_task_status.py │ │ ├── 0004_auto_20190204_1324.py │ │ ├── 0005_remove_duplicated_authorized_origins.py │ │ ├── 0006_rename_origin_type.py │ │ ├── 0007_save_request_task_status_fix_typo.py │ │ ├── 0008_save-code-now_indexes_20210106_1327.py │ │ ├── 0009_saveoriginrequest_visit_status.py │ │ ├── 0010_saveoriginrequest_user_id.py │ │ ├── 0011_saveoriginrequest_user_ids.py │ │ ├── 0012_saveoriginrequest_note.py │ │ ├── 0013_saveoriginrequest_webhook_info.py │ │ ├── 0014_saveoriginrequest_snapshot_swhid.py │ │ ├── 0015_alter_saveoriginrequest_loading_task_status.py │ │ ├── 0016_alter_saveoriginrequest_origin_url.py │ │ └── __init__.py │ ├── models.py │ ├── origin_save.py │ ├── origin_visit_webhook.py │ ├── templates │ │ ├── admin │ │ │ ├── origin-save-common.html │ │ │ ├── origin-save-filters.html │ │ │ └── origin-save-requests.html │ │ ├── includes │ │ │ └── take-new-snapshot.html │ │ ├── origin-save-help.html │ │ ├── origin-save-list.html │ │ └── origin-save.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ ├── test_django_command.py │ │ ├── test_migrations.py │ │ ├── test_origin_save.py │ │ ├── test_origin_save_admin.py │ │ ├── test_origin_save_api.py │ │ ├── test_origin_save_views.py │ │ └── test_origin_visit_webhook.py │ ├── urls.py │ └── views.py │ ├── save_origin_webhooks │ ├── __init__.py │ ├── bitbucket.py │ ├── generic_receiver.py │ ├── gitea.py │ ├── github.py │ ├── gitlab.py │ ├── sourceforge.py │ ├── tests │ │ ├── __init__.py │ │ ├── data │ │ │ ├── bitbucket_webhook_payload.json │ │ │ ├── gitea_webhook_payload.json │ │ │ ├── github_webhook_payload.json │ │ │ ├── gitlab_webhook_payload.json │ │ │ ├── https_sourceforge.net │ │ │ │ ├── rest_p_webhook-test-git │ │ │ │ ├── rest_p_webhook-test-hg │ │ │ │ └── rest_p_webhook-test-svn │ │ │ ├── sourceforge_webhook_payload_git.json │ │ │ ├── sourceforge_webhook_payload_hg.json │ │ │ └── sourceforge_webhook_payload_svn.json │ │ ├── test_app.py │ │ ├── test_bitbucket.py │ │ ├── test_gitea.py │ │ ├── test_github.py │ │ ├── test_gitlab.py │ │ ├── test_sourceforge.py │ │ └── utils.py │ └── urls.py │ ├── settings │ ├── __init__.py │ ├── common.py │ ├── cypress.py │ ├── development.py │ ├── production.py │ └── tests.py │ ├── static │ ├── img │ │ ├── arrow-up-small.png │ │ ├── icons │ │ │ ├── swh-logo-32x32.png │ │ │ ├── swh-logo-archive-180x180.png │ │ │ ├── swh-logo-archive-192x192.png │ │ │ └── swh-logo-archive-270x270.png │ │ ├── logos │ │ │ ├── arch.png │ │ │ ├── aur.png │ │ │ ├── bioconductor.png │ │ │ ├── bitbucket-hg.png │ │ │ ├── bitbucket.png │ │ │ ├── bower.png │ │ │ ├── cgit.png │ │ │ ├── conda.png │ │ │ ├── cpan.png │ │ │ ├── cran.png │ │ │ ├── crates.png │ │ │ ├── debian.png │ │ │ ├── dlang.png │ │ │ ├── elife.png │ │ │ ├── gitea.png │ │ │ ├── github.png │ │ │ ├── gitlab.png │ │ │ ├── gitorious.png │ │ │ ├── gitweb.png │ │ │ ├── gnu.png │ │ │ ├── gogs.png │ │ │ ├── golang.png │ │ │ ├── googlecode.png │ │ │ ├── guix.png │ │ │ ├── hackage.png │ │ │ ├── hal.png │ │ │ ├── heptapod.png │ │ │ ├── inria.jpg │ │ │ ├── ipol.png │ │ │ ├── launchpad.png │ │ │ ├── maven.png │ │ │ ├── nixos.png │ │ │ ├── npm.png │ │ │ ├── opam.png │ │ │ ├── packagist.png │ │ │ ├── pagure.png │ │ │ ├── phabricator.png │ │ │ ├── pubdev.png │ │ │ ├── puppet.png │ │ │ ├── pypi.png │ │ │ ├── rpm.png │ │ │ ├── rubygems.png │ │ │ ├── sourceforge.png │ │ │ └── zenodo.png │ │ ├── swh-donor.png │ │ ├── swh-logo-white.svg │ │ ├── swh-logo.png │ │ ├── swh-logo.svg │ │ ├── swh-mirror.png │ │ ├── swh-spinner-small.gif │ │ ├── swh-spinner.gif │ │ └── swh-vault.png │ ├── json │ │ └── highlightjs-languages.json │ └── xml │ │ └── swh-opensearch.xml │ ├── tests │ ├── __init__.py │ ├── create_test_admin.py │ ├── create_test_alter.py │ ├── create_test_users.py │ ├── data.py │ ├── django_asserts.py │ ├── helpers.py │ ├── pytest_plugin.py │ ├── random_fixtures_test.py │ ├── resources │ │ ├── contents │ │ │ ├── code │ │ │ │ ├── LICENSE │ │ │ │ ├── extensions │ │ │ │ │ ├── test.R │ │ │ │ │ ├── test.abnf │ │ │ │ │ ├── test.adb │ │ │ │ │ ├── test.adoc │ │ │ │ │ ├── test.ahk │ │ │ │ │ ├── test.aj │ │ │ │ │ ├── test.applescript │ │ │ │ │ ├── test.as │ │ │ │ │ ├── test.au3 │ │ │ │ │ ├── test.awk │ │ │ │ │ ├── test.bas │ │ │ │ │ ├── test.bat │ │ │ │ │ ├── test.bf │ │ │ │ │ ├── test.bnf │ │ │ │ │ ├── test.bsl │ │ │ │ │ ├── test.cal │ │ │ │ │ ├── test.capnp │ │ │ │ │ ├── test.ceylon │ │ │ │ │ ├── test.clj │ │ │ │ │ ├── test.cls │ │ │ │ │ ├── test.cmake │ │ │ │ │ ├── test.coffee │ │ │ │ │ ├── test.cpp │ │ │ │ │ ├── test.cr │ │ │ │ │ ├── test.cs │ │ │ │ │ ├── test.css │ │ │ │ │ ├── test.d │ │ │ │ │ ├── test.dart │ │ │ │ │ ├── test.dcl │ │ │ │ │ ├── test.dfm │ │ │ │ │ ├── test.diff │ │ │ │ │ ├── test.do │ │ │ │ │ ├── test.dts │ │ │ │ │ ├── test.dust │ │ │ │ │ ├── test.ebnf │ │ │ │ │ ├── test.elm │ │ │ │ │ ├── test.ep │ │ │ │ │ ├── test.erb │ │ │ │ │ ├── test.erl │ │ │ │ │ ├── test.ex │ │ │ │ │ ├── test.f90 │ │ │ │ │ ├── test.feature │ │ │ │ │ ├── test.flix │ │ │ │ │ ├── test.fs │ │ │ │ │ ├── test.gcode │ │ │ │ │ ├── test.glsl │ │ │ │ │ ├── test.gml │ │ │ │ │ ├── test.gms │ │ │ │ │ ├── test.go │ │ │ │ │ ├── test.golo │ │ │ │ │ ├── test.gradle │ │ │ │ │ ├── test.groovy │ │ │ │ │ ├── test.gss │ │ │ │ │ ├── test.haml │ │ │ │ │ ├── test.hbs │ │ │ │ │ ├── test.hs │ │ │ │ │ ├── test.hsp │ │ │ │ │ ├── test.html │ │ │ │ │ ├── test.hx │ │ │ │ │ ├── test.hy │ │ │ │ │ ├── test.ini │ │ │ │ │ ├── test.ino │ │ │ │ │ ├── test.java │ │ │ │ │ ├── test.jl │ │ │ │ │ ├── test.js │ │ │ │ │ ├── test.json │ │ │ │ │ ├── test.kt │ │ │ │ │ ├── test.lasso │ │ │ │ │ ├── test.lc │ │ │ │ │ ├── test.ldif │ │ │ │ │ ├── test.leaf │ │ │ │ │ ├── test.less │ │ │ │ │ ├── test.lisp │ │ │ │ │ ├── test.ll │ │ │ │ │ ├── test.ls │ │ │ │ │ ├── test.lsl │ │ │ │ │ ├── test.lua │ │ │ │ │ ├── test.m │ │ │ │ │ ├── test.md │ │ │ │ │ ├── test.mel │ │ │ │ │ ├── test.mk │ │ │ │ │ ├── test.ml │ │ │ │ │ ├── test.moon │ │ │ │ │ ├── test.nim │ │ │ │ │ ├── test.nix │ │ │ │ │ ├── test.nsi │ │ │ │ │ ├── test.p │ │ │ │ │ ├── test.pbi │ │ │ │ │ ├── test.pde │ │ │ │ │ ├── test.php │ │ │ │ │ ├── test.pl │ │ │ │ │ ├── test.pony │ │ │ │ │ ├── test.pp │ │ │ │ │ ├── test.properties │ │ │ │ │ ├── test.proto │ │ │ │ │ ├── test.ps1 │ │ │ │ │ ├── test.py │ │ │ │ │ ├── test.q │ │ │ │ │ ├── test.qml │ │ │ │ │ ├── test.rb │ │ │ │ │ ├── test.re │ │ │ │ │ ├── test.rib │ │ │ │ │ ├── test.rs │ │ │ │ │ ├── test.rsc │ │ │ │ │ ├── test.s │ │ │ │ │ ├── test.sas │ │ │ │ │ ├── test.scad │ │ │ │ │ ├── test.scala │ │ │ │ │ ├── test.sci │ │ │ │ │ ├── test.scm │ │ │ │ │ ├── test.scss │ │ │ │ │ ├── test.sh │ │ │ │ │ ├── test.sl │ │ │ │ │ ├── test.smali │ │ │ │ │ ├── test.sml │ │ │ │ │ ├── test.sqf │ │ │ │ │ ├── test.st │ │ │ │ │ ├── test.stan │ │ │ │ │ ├── test.styl │ │ │ │ │ ├── test.subunit │ │ │ │ │ ├── test.swift │ │ │ │ │ ├── test.tap │ │ │ │ │ ├── test.tcl │ │ │ │ │ ├── test.tex │ │ │ │ │ ├── test.thrift │ │ │ │ │ ├── test.ts │ │ │ │ │ ├── test.v │ │ │ │ │ ├── test.vala │ │ │ │ │ ├── test.vb │ │ │ │ │ ├── test.vbs │ │ │ │ │ ├── test.vhd │ │ │ │ │ ├── test.vim │ │ │ │ │ ├── test.wl │ │ │ │ │ ├── test.xml │ │ │ │ │ ├── test.xqy │ │ │ │ │ ├── test.yml │ │ │ │ │ └── test.zep │ │ │ │ └── filenames │ │ │ │ │ ├── .htaccess │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── access.log │ │ │ │ │ ├── httpd.conf │ │ │ │ │ ├── nginx.conf │ │ │ │ │ ├── nginx.log │ │ │ │ │ ├── pf.conf │ │ │ │ │ └── resolv.conf │ │ │ └── other │ │ │ │ └── extensions │ │ │ │ ├── bash-cheatsheet.pdf │ │ │ │ ├── public.gpg │ │ │ │ ├── swh-logo.jpeg │ │ │ │ ├── swh-logo.png │ │ │ │ ├── swh-logo.webp │ │ │ │ ├── swh-spinner.gif │ │ │ │ └── word2vec.ipynb │ │ └── repos │ │ │ ├── highlightjs-line-numbers.js.zip │ │ │ ├── highlightjs-line-numbers.js_visit2.zip │ │ │ ├── libtess2.zip │ │ │ ├── repo_with_cff_file.zip │ │ │ ├── repo_with_metadata_file.zip │ │ │ └── repo_with_submodules.tgz │ ├── strategies.py │ ├── test_create_users.py │ ├── test_gunicorn_config.py │ ├── test_random_fixtures.py │ ├── test_urls.py │ ├── test_views.py │ ├── urls.py │ └── views.py │ ├── urls.py │ ├── utils │ ├── __init__.py │ ├── archive.py │ ├── citation.py │ ├── converters.py │ ├── exc.py │ ├── highlightjs.py │ ├── identifiers.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── rename_app.py │ ├── middlewares.py │ ├── origin_visits.py │ ├── query.py │ ├── swh_templatetags.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_archive.py │ │ ├── test_converters.py │ │ ├── test_exc.py │ │ ├── test_highlightjs.py │ │ ├── test_identifiers.py │ │ ├── test_metadata.py │ │ ├── test_middlewares.py │ │ ├── test_origin_visits.py │ │ ├── test_query.py │ │ ├── test_templatetags.py │ │ ├── test_url_path_converters.py │ │ └── test_utils.py │ ├── typing.py │ ├── url_path_converters.py │ └── urlsindex.py │ ├── vault │ ├── __init__.py │ ├── api_views.py │ ├── assets │ │ ├── index.js │ │ ├── vault-create-tasks.js │ │ ├── vault-table-row.ejs │ │ ├── vault-ui.js │ │ └── vault.css │ ├── templates │ │ ├── includes │ │ │ ├── vault-common.html │ │ │ └── vault-create-tasks.html │ │ └── vault-ui.html │ ├── tests │ │ ├── __init__.py │ │ ├── test_apiviews.py │ │ ├── test_app.py │ │ └── test_views.py │ └── urls.py │ └── webapp │ ├── __init__.py │ ├── assets │ ├── vendors │ │ ├── _swh-custom.scss │ │ ├── bootstrap.scss │ │ ├── datatables.css │ │ ├── elementsfrompoint-polyfill.js │ │ └── index.js │ └── webapp │ │ ├── breadcrumbs.css │ │ ├── code-highlighting.js │ │ ├── heading-anchors.css │ │ ├── heading-anchors.js │ │ ├── history-counters.css │ │ ├── history-counters.js │ │ ├── index.js │ │ ├── math-typesetting.js │ │ ├── notebook-rendering.js │ │ ├── notebook.css │ │ ├── pdf-rendering.js │ │ ├── readme-rendering.js │ │ ├── sentry.js │ │ ├── status-widget.css │ │ ├── status-widget.js │ │ ├── webapp-utils.js │ │ ├── webapp.css │ │ └── xss-filtering.js │ ├── templates │ ├── error.html │ ├── homepage.html │ ├── includes │ │ ├── error-base.html │ │ ├── favicon.html │ │ ├── footer.html │ │ ├── global-modals.html │ │ ├── http-error.html │ │ ├── masking-error.html │ │ ├── sidebar.html │ │ └── top-bar.html │ ├── layout.html │ └── masked.html │ ├── tests │ ├── __init__.py │ ├── test_mirror_config.py │ ├── test_templates.py │ └── test_views.py │ └── urls.py ├── tox.ini └── yarn.lock /.copier-answers.yml: -------------------------------------------------------------------------------- 1 | # Changes here will be overwritten by Copier 2 | _commit: v0.3.3 3 | _src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git 4 | description: Software Heritage web UI 5 | distribution_name: swh-web 6 | have_cli: false 7 | have_workers: false 8 | package_root: swh/web 9 | project_name: swh.web 10 | python_minimal_version: '3.7' 11 | readme_format: rst 12 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Apply black formatting to Python code and add pre-commit hook 2 | 0503cce23f70d1cca279fd9f4794c1f5df63a325 3 | 4 | # test_origin_save: Fix black formatting 5 | 00cc0c4daef20455144845214f52330063a211c3 6 | 7 | # python: Reformat code with black 8 | f9f5854c3af9fbaa164187c56ba544454041d26e 9 | d7809352485e8dcd96290c424b9c1155087744cc 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.egg-info/ 2 | *.pyc 3 | .coverage 4 | .eggs/ 5 | .hypothesis 6 | .mypy_cache 7 | .tox 8 | __pycache__ 9 | docs/build/ 10 | docs/uri-scheme.md 11 | docs/dev-info.md 12 | *.sqlite3* 13 | .directory 14 | node_modules/ 15 | swh/web/static/*.* 16 | swh/web/static/js/ 17 | swh/web/static/css/ 18 | swh/web/static/fonts/ 19 | swh/web/static/jssources/ 20 | swh/web/static/img/thirdParty/ 21 | build/ 22 | dist/ 23 | package-lock.json 24 | yarn-error.log 25 | cypress/mochawesome/ 26 | .nyc_output*/ 27 | cypress/accessibility/ 28 | cypress/coverage*/ 29 | cypress/fixtures/source*.json 30 | cypress/junit/ 31 | cypress/downloads/ 32 | .eslintcache 33 | # these are symlinks created by a hook in swh-docs' main sphinx conf.py 34 | docs/README.rst 35 | docs/README.md 36 | # this should be a symlink for people who want to build the sphinx doc 37 | # without using tox, generally created by the swh-env/bin/update script 38 | docs/Makefile.sphinx 39 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2019 The Software Heritage developers 2 | 3 | See http://www.softwareheritage.org/ for more information. 4 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Anirudh Lakhotia 2 | Daniele Serafini 3 | Ishan Bhanuka 4 | Kalpit Kothari 5 | Katrin Leinweber 6 | Krithik Vaidya 7 | Kumar Shivendu 8 | Mihir Karbelkar 9 | Shankhadeep Dey 10 | Siddharth Ravikumar 11 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include swh/web/static * -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile driver for SWH Python modules. DO NOT CHANGE. 2 | # You can add custom Makefile rules to Makefile.local 3 | 4 | include ../Makefile.python 5 | -include Makefile.local 6 | -------------------------------------------------------------------------------- /assets/src/utils/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2019 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | import {staticAsset} from 'utils/functions'; 9 | 10 | // Constants defining Bootstrap Breakpoints 11 | export const BREAKPOINT_SM = 768; 12 | export const BREAKPOINT_MD = 992; 13 | export const BREAKPOINT_LG = 1200; 14 | 15 | export const swhSpinnerSrc = staticAsset('img/swh-spinner.gif'); 16 | 17 | export const dataTableCommonConfig = { 18 | serverSide: true, 19 | processing: true, 20 | language: { 21 | processing: `` 22 | }, 23 | fixedHeader: true, 24 | lengthMenu: [10, 25, 50, 100, 1000], 25 | scrollCollapse: true, 26 | searchDelay: 1000 27 | }; 28 | -------------------------------------------------------------------------------- /assets/src/utils/highlightjs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2019 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .highlightjs pre { 9 | background-color: transparent; 10 | border-radius: 0; 11 | border-color: transparent; 12 | } 13 | 14 | .hljs { 15 | background-color: transparent; 16 | white-space: pre; 17 | } 18 | 19 | /* for block of numbers */ 20 | .hljs-ln-numbers { 21 | cursor: pointer; 22 | user-select: none; 23 | text-align: center; 24 | color: #aaa; 25 | border-right: 1px solid #ccc; 26 | vertical-align: top; 27 | padding-right: 1px !important; 28 | } 29 | 30 | /* for block of code */ 31 | .hljs-ln-code { 32 | padding-left: 10px !important; 33 | width: 100%; 34 | } 35 | -------------------------------------------------------------------------------- /assets/src/utils/mathjax.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | export * from 'mathjax/es5/tex-mml-chtml'; 9 | -------------------------------------------------------------------------------- /assets/src/utils/org.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // org-js chunk that will be lazily loaded 9 | 10 | import './org.css'; 11 | export * from 'org'; 12 | -------------------------------------------------------------------------------- /assets/src/utils/requests-filter-checkbox.ejs: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright (C) 2022 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | %> 7 |
8 | 11 | checked="checked" 12 | <% } %> 13 | id="<%= inputId %>"> 14 | 17 |
18 | -------------------------------------------------------------------------------- /assets/src/utils/showdown.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2019 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .swh-showdown a { 9 | border: none; 10 | } 11 | 12 | .swh-showdown table { 13 | border-collapse: collapse; 14 | } 15 | 16 | .swh-showdown table, 17 | .swh-showdown table th, 18 | .swh-showdown table td { 19 | padding: 6px 13px; 20 | border: 1px solid #dfe2e5; 21 | } 22 | 23 | .swh-showdown table tr:nth-child(even) { 24 | background-color: #f2f2f2; 25 | } 26 | 27 | .swh-showdown img, 28 | .swh-showdown svg { 29 | max-width: 100%; 30 | } 31 | -------------------------------------------------------------------------------- /assets/src/utils/showdown.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // showdown chunk that will be lazily loaded 9 | 10 | import './showdown.css'; 11 | export * from 'showdown'; 12 | -------------------------------------------------------------------------------- /conftest.py: -------------------------------------------------------------------------------- 1 | pytest_plugins = ["swh.auth.pytest_plugin", "swh.scheduler.pytest_plugin"] 2 | -------------------------------------------------------------------------------- /cypress/e2e/back-to-top.cy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2019 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | const url = 'api/'; 9 | 10 | describe('Back-to-top button tests', function() { 11 | beforeEach(function() { 12 | cy.visit(url); 13 | }); 14 | 15 | it('should be hidden when on top', function() { 16 | cy.get('#back-to-top').should('not.be.visible'); 17 | }); 18 | 19 | it('should be visible when scrolled down', function() { 20 | cy.scrollTo('bottom') 21 | .get('#back-to-top') 22 | .should('be.visible'); 23 | }); 24 | 25 | it('should scroll to top when clicked', function() { 26 | cy.scrollTo('bottom') 27 | .get('#back-to-top') 28 | .click() 29 | .window() 30 | .then(win => { 31 | assert.equal(win.scrollY, 0); 32 | }); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } -------------------------------------------------------------------------------- /cypress/fixtures/save-task-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "scheduled": "2020-06-24T11:48:12.561643+00:00", 3 | "started": "2020-06-24T12:59:11.103188+00:00", 4 | "ended": "2020-06-24T12:59:12.065313+00:00", 5 | "status": "eventful", 6 | "type": "load-git", 7 | "arguments": { 8 | "args": [], 9 | "kwargs": { 10 | "url": "https://gitlab.inria.fr/solverstack/maphys/maphys/" 11 | } 12 | }, 13 | "duration": "1.0600971020758152", 14 | "message": "[2020-06-24 12:59:12,063: INFO/ForkPoolWorker-161] Task swh.loader.git.tasks.UpdateGitRepository[4ff8b555-9535-4e75-b8ec-8e76165e14ec] succeeded in 1.0600971020758152s: {'status': 'eventful'}", 15 | "name": "swh.loader.git.tasks.UpdateGitRepository" 16 | } -------------------------------------------------------------------------------- /cypress/fixtures/swh_1_dir_cd19126d815470b28919d64b2a8e6a3e37f900dd.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/cypress/fixtures/swh_1_dir_cd19126d815470b28919d64b2a8e6a3e37f900dd.tar.gz -------------------------------------------------------------------------------- /cypress/fixtures/swh_1_rev_1c480a4573d2a003fc2630c21c2b25829de49972.git.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/cypress/fixtures/swh_1_rev_1c480a4573d2a003fc2630c21c2b25829de49972.git.tar -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build/ 2 | apidoc/ 3 | *-stamp 4 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | include Makefile.sphinx 2 | APIDOC_EXCLUDES += ../assets ../cypress ../swh/web/static ../swh/*/settings 3 | -------------------------------------------------------------------------------- /docs/_static/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/docs/_static/.placeholder -------------------------------------------------------------------------------- /docs/_templates/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/docs/_templates/.placeholder -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | from swh.docs.sphinx.conf import * # noqa 2 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. _swh-web: 2 | 3 | .. include:: README.rst 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | :caption: Contents: 8 | 9 | developers-info 10 | uri-scheme-api 11 | uri-scheme-browse 12 | uri-scheme-swhids 13 | uri-scheme-misc 14 | 15 | 16 | .. only:: standalone_package_doc 17 | 18 | Indices and tables 19 | ------------------ 20 | 21 | * :ref:`genindex` 22 | * :ref:`modindex` 23 | * :ref:`routingtable` 24 | * :ref:`search` 25 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-content.rst: -------------------------------------------------------------------------------- 1 | Content 2 | ------- 3 | 4 | .. autosimple:: swh.web.api.views.content.api_check_content_known 5 | 6 | .. autosimple:: swh.web.api.views.content.api_content_metadata 7 | 8 | .. autosimple:: swh.web.api.views.content.api_content_raw 9 | 10 | .. autosimple:: swh.web.api.views.content.api_content_filetype 11 | 12 | .. autosimple:: swh.web.api.views.content.api_content_language 13 | 14 | .. autosimple:: swh.web.api.views.content.api_content_license 15 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-directory.rst: -------------------------------------------------------------------------------- 1 | Directory 2 | --------- 3 | 4 | .. autosimple:: swh.web.api.views.directory.api_directory 5 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-extid.rst: -------------------------------------------------------------------------------- 1 | External IDentifiers 2 | -------------------- 3 | 4 | .. autosimple:: swh.web.api.views.extid.api_extid 5 | 6 | .. autosimple:: swh.web.api.views.extid.api_extid_target 7 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-graph.rst: -------------------------------------------------------------------------------- 1 | Graph 2 | ----- 3 | 4 | .. autosimple:: swh.web.api.views.graph.api_graph 5 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-origin.rst: -------------------------------------------------------------------------------- 1 | Origin 2 | ------ 3 | 4 | .. autosimple:: swh.web.api.views.origin.api_origins 5 | 6 | .. autosimple:: swh.web.api.views.origin.api_origin 7 | 8 | .. autosimple:: swh.web.api.views.origin.api_origin_search 9 | 10 | .. autosimple:: swh.web.api.views.origin.api_origin_visits 11 | 12 | .. autosimple:: swh.web.api.views.origin.api_origin_visit 13 | 14 | .. autosimple:: swh.web.api.views.origin.api_origin_visit_latest 15 | 16 | .. autosimple:: swh.web.api.views.origin.api_origin_metadata_search 17 | 18 | .. autosimple:: swh.web.api.views.origin.api_origin_intrinsic_metadata 19 | 20 | .. autosimple:: swh.web.api.views.origin.api_origin_extrinsic_metadata 21 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-provenance.rst: -------------------------------------------------------------------------------- 1 | Provenance 2 | ---------- 3 | 4 | .. autosimple:: swh.web.provenance.api_views.api_provenance_whereis 5 | 6 | .. autosimple:: swh.web.provenance.api_views.api_provenance_whereare 7 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-release.rst: -------------------------------------------------------------------------------- 1 | Release 2 | ------- 3 | 4 | .. autosimple:: swh.web.api.views.release.api_release 5 | 6 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-revision.rst: -------------------------------------------------------------------------------- 1 | Revision 2 | -------- 3 | 4 | .. autosimple:: swh.web.api.views.revision.api_revision 5 | 6 | .. autosimple:: swh.web.api.views.revision.api_revision_directory 7 | 8 | .. autosimple:: swh.web.api.views.revision.api_revision_log 9 | 10 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-snapshot.rst: -------------------------------------------------------------------------------- 1 | Snapshot 2 | -------- 3 | 4 | .. autosimple:: swh.web.api.views.snapshot.api_snapshot 5 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-stat.rst: -------------------------------------------------------------------------------- 1 | Archive statistics 2 | ------------------ 3 | 4 | .. autosimple:: swh.web.api.views.stat.api_stats 5 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-swhids.rst: -------------------------------------------------------------------------------- 1 | SWHIDs (SoftWare Hash IDentifiers) 2 | ---------------------------------- 3 | 4 | .. autosimple:: swh.web.api.views.identifiers.api_resolve_swhid 5 | 6 | .. autosimple:: swh.web.api.views.identifiers.api_swhid_known 7 | 8 | .. autosimple:: swh.web.api.views.raw.api_raw_object 9 | 10 | -------------------------------------------------------------------------------- /docs/uri-scheme-api-vault.rst: -------------------------------------------------------------------------------- 1 | Vault 2 | ----- 3 | 4 | .. autosimple:: swh.web.vault.api_views.api_vault_cook_flat 5 | 6 | .. autosimple:: swh.web.vault.api_views.api_vault_download_flat 7 | 8 | .. autosimple:: swh.web.vault.api_views.api_vault_cook_git_bare 9 | 10 | .. autosimple:: swh.web.vault.api_views.api_vault_download_revision_git_bare 11 | 12 | .. autosimple:: swh.web.vault.api_views.api_vault_cook_gitfast 13 | 14 | .. autosimple:: swh.web.vault.api_views.api_vault_download_revision_gitfast 15 | 16 | .. autosimple:: swh.web.vault.api_views.api_vault_cook_directory 17 | 18 | .. autosimple:: swh.web.vault.api_views.api_vault_download_directory 19 | 20 | .. autosimple:: swh.web.vault.api_views.api_vault_cook_revision_gitfast 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/uri-scheme-api.rst: -------------------------------------------------------------------------------- 1 | .. _swh-web-api-urls: 2 | 3 | swh-web API URLs 4 | ================ 5 | 6 | .. include:: uri-scheme-api-content.rst 7 | 8 | .. include:: uri-scheme-api-directory.rst 9 | 10 | .. include:: uri-scheme-api-extid.rst 11 | 12 | .. include:: uri-scheme-api-graph.rst 13 | 14 | .. include:: uri-scheme-api-swhids.rst 15 | 16 | .. include:: uri-scheme-api-origin.rst 17 | 18 | .. include:: uri-scheme-api-provenance.rst 19 | 20 | .. include:: uri-scheme-api-release.rst 21 | 22 | .. include:: uri-scheme-api-request-archival.rst 23 | 24 | .. include:: uri-scheme-api-revision.rst 25 | 26 | .. include:: uri-scheme-api-snapshot.rst 27 | 28 | .. include:: uri-scheme-api-stat.rst 29 | 30 | .. include:: uri-scheme-api-vault.rst 31 | -------------------------------------------------------------------------------- /docs/uri-scheme-browse-release.rst: -------------------------------------------------------------------------------- 1 | Release 2 | ^^^^^^^ 3 | 4 | .. http:get:: /browse/release/(sha1_git)/ 5 | 6 | HTML view that displays metadata associated to a release: 7 | 8 | * the author 9 | * the release date 10 | * the release name 11 | * the associated message 12 | * the type of target the release points to (revision, directory, content or release) 13 | * the link to browse the release target 14 | 15 | :param string sha1_git: hexadecimal representation for the **sha1_git** 16 | identifier of a release 17 | :statuscode 200: no error 18 | :statuscode 404: requested release cannot be found in the archive 19 | 20 | **Examples:** 21 | 22 | .. parsed-literal:: 23 | 24 | :swh_web_browse:`release/208f61cc7a5dbc9879ae6e5c2f95891e270f09ef/` 25 | :swh_web_browse:`release/f883596e997fe5bcbc5e89bee01b869721326109/` 26 | -------------------------------------------------------------------------------- /mirror_demo/config.yml: -------------------------------------------------------------------------------- 1 | # example of extra configuration for a mirror version of swh-web 2 | 3 | # top bar can have custom links and donate link 4 | top_bar: 5 | links: 6 | Home: https://example.org 7 | # donate_link: 8 | 9 | # to display the status.io widget in the top bar 10 | status: 11 | {} 12 | # server_url: https://status.example.org/ 13 | # json_path: 1.0/status/ 14 | 15 | # matomo can optionally be used 16 | matomo: 17 | {} 18 | # url: 19 | # site_id: 20 | 21 | # most of django apps must be disabled when running a mirror 22 | swh_extra_django_apps: 23 | - swh.web.badges 24 | - swh.web.jslicenses 25 | - swh.web.vault 26 | 27 | show_corner_ribbon: false 28 | 29 | # mirror partner specific configuration 30 | mirror_config: 31 | partner_name: "[mirror partner]" 32 | partner_url: https://example.org 33 | static_path: mirror_demo/static 34 | partner_logo_static_path: partner_logo.png 35 | templates_path: mirror_demo/templates 36 | -------------------------------------------------------------------------------- /mirror_demo/static/partner_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/mirror_demo/static/partner_logo.png -------------------------------------------------------------------------------- /mirror_demo/templates/mirror-footer.html: -------------------------------------------------------------------------------- 1 | [mirror partner] — 2 | Copyright (C), [mirror partner]. 3 | License: GNU 4 | AGPLv3+. 5 |
6 | {% if "swh.web.jslicenses" in SWH_DJANGO_APPS %} 7 | JavaScript license information- 8 | {% endif %} 9 | Web API 10 | -------------------------------------------------------------------------------- /mirror_demo/templates/mirror-homepage.html: -------------------------------------------------------------------------------- 1 |
2 |

[mirror partner] section

3 |

4 | [mirror partner] has provided this mirror as part of their commitment 5 | to preserving and promoting open-source software, allowing the Software 6 | Heritage international network of mirrors to ensure accessibility and 7 | preservation of such software for future generations. 8 |

9 |
10 | -------------------------------------------------------------------------------- /nyc.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let reportDir = 'cypress/coverage'; 4 | let tempDir = '.nyc_output'; 5 | const parallelBuildId = process.env.CYPRESS_PARALLEL_BUILD_ID; 6 | if (parallelBuildId !== undefined) { 7 | reportDir += parallelBuildId; 8 | tempDir += parallelBuildId; 9 | } 10 | 11 | module.exports = { 12 | exclude: [ 13 | 'assets/src/bundles/vendors/index.js', 14 | 'assets/src/thirdparty/**/*.js' 15 | ], 16 | 'report-dir': reportDir, 17 | 'temp-dir': tempDir 18 | }; 19 | -------------------------------------------------------------------------------- /requirements-swh.txt: -------------------------------------------------------------------------------- 1 | swh.auth[django] >= 0.6.7 2 | swh.core >= 4.0.0 3 | swh.counters >= 0.5.1 4 | swh.graph >= 6.7.3 5 | swh.indexer >= 4.0.0 6 | swh.model >= 8.1.0 7 | swh.provenance >= 0.1.1 8 | swh.scheduler >= 3.0.0 9 | swh.search >= 0.16.0 10 | swh.storage >= 3.0.0 11 | swh-vault >= 2.0.0 12 | swh.webhooks >= 0.1.1 13 | -------------------------------------------------------------------------------- /requirements-test.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | decorator # dependency of swh.core[http] 3 | djangorestframework-stubs 4 | django-stubs[compatible-mypy] >= 5.0.2 5 | django-test-migrations 6 | hypothesis 7 | msgpack-types 8 | pytest >= 8.1 9 | pytest-django 10 | pytest-mock 11 | pytest-postgresql 12 | requests-mock != 1.9.0, != 1.9.1 13 | swh.core[http] >= 4.0.0 14 | swh.graph >= 5.1.1 15 | swh.loader.git >= 0.8.0 16 | swh.scheduler[pytest] >= 3.1.0 17 | swh.storage >= 3.0.0 18 | types-beautifulsoup4 19 | types-cryptography 20 | types-docutils 21 | types-Pygments 22 | types-pyyaml 23 | types-requests 24 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Add here external Python modules dependencies, one per line. Module names 2 | # should match https://pypi.python.org/pypi names. For the full spec or 3 | # dependency lines, see https://pip.readthedocs.org/en/1.1/requirements.html 4 | 5 | chardet 6 | charset-normalizer 7 | cryptography 8 | disposable-email-domains 9 | django 10 | django-bootstrap5 11 | django-cors-headers 12 | django-js-reverse 13 | django-minify-html 14 | django-ratelimit 15 | djangorestframework 16 | django-webpack-loader >= 3 17 | docutils 18 | iso8601 19 | looseversion 20 | msgpack 21 | prometheus-client 22 | psycopg 23 | pybadges >= 2.2.1 24 | pygments 25 | pymemcache 26 | python-magic >= 0.4.0 27 | pyyaml 28 | requests 29 | rfc3987 30 | sentry-sdk 31 | -------------------------------------------------------------------------------- /swh/web/__init__.py: -------------------------------------------------------------------------------- 1 | from pkgutil import extend_path 2 | 3 | __path__ = extend_path(__path__, __name__) 4 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.add_forge_now.apps.AddForgeNowConfig" 7 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | APP_LABEL = "swh_web_add_forge_now" 9 | 10 | 11 | class AddForgeNowConfig(AppConfig): 12 | name = "swh.web.add_forge_now" 13 | label = APP_LABEL 14 | 15 | def ready(self): 16 | from ..inbound_email.signals import email_received 17 | from .signal_receivers import handle_inbound_message 18 | 19 | email_received.connect(handle_inbound_message) 20 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/assets/add-forge.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2022 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .request-actions { 9 | padding-right: 10px; 10 | } 11 | 12 | .details-text { 13 | padding-top: 5px; 14 | } 15 | 16 | .history-item { 17 | padding-bottom: 5px; 18 | } 19 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/assets/forge-success-email.ejs: -------------------------------------------------------------------------------- 1 | Dear forge administrator, 2 | 3 | We are happy to announce to you that your forge is now successfully 4 | archived. 5 | 6 | The forge repositories are now available in the archive : 7 | https://archive.softwareheritage.org/browse/search/?q=<%= forgeUrl %>&with_visit=true&with_content=true 8 | 9 | Kind regards, 10 | 11 | The Software Heritage team -------------------------------------------------------------------------------- /swh/web/add_forge_now/migrations/0003_request_submitter_forward_username.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2022-03-21 16:37 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ("swh_web_add_forge_now", "0002_authorized_null_comment"), 9 | ] 10 | 11 | operations = [ 12 | migrations.AddField( 13 | model_name="request", 14 | name="submitter_forward_username", 15 | field=models.BooleanField(default=False), 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/migrations/0004_rename_tables.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.27 on 2022-03-29 11:42 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ("swh_web_add_forge_now", "0003_request_submitter_forward_username"), 9 | ] 10 | 11 | operations = [ 12 | migrations.AlterModelTable( 13 | name="request", 14 | table="add_forge_request", 15 | ), 16 | migrations.AlterModelTable( 17 | name="requesthistory", 18 | table="add_forge_request_history", 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/migrations/0005_prepare_inbound_email.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.16 on 2022-04-01 15:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ("swh_web_add_forge_now", "0004_rename_tables"), 9 | ] 10 | 11 | operations = [ 12 | migrations.AddField( 13 | model_name="requesthistory", 14 | name="message_source", 15 | field=models.BinaryField(null=True), 16 | ), 17 | migrations.AlterField( 18 | model_name="requesthistory", 19 | name="actor_role", 20 | field=models.TextField( 21 | choices=[ 22 | ("MODERATOR", "moderator"), 23 | ("SUBMITTER", "submitter"), 24 | ("FORGE_ADMIN", "forge admin"), 25 | ("EMAIL", "email"), 26 | ] 27 | ), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/migrations/0008_turn_request_forge_url_into_url_field.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2022-08-16 13:08 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ("swh_web_add_forge_now", "0007_rename_denied_request_status"), 9 | ] 10 | 11 | operations = [ 12 | migrations.AlterField( 13 | model_name="request", 14 | name="forge_url", 15 | field=models.URLField(), 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/add_forge_now/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/add_forge_now/templates/add-forge-list.html: -------------------------------------------------------------------------------- 1 | {% extends "./add-forge-common.html" %} 2 | 3 | {% comment %} 4 | Copyright (C) 2022-2023 The Software Heritage developers 5 | See the AUTHORS file at the top-level directory of this distribution 6 | License: GNU Affero General Public License version 3, or any later version 7 | See top-level LICENSE file for more information 8 | {% endcomment %} 9 | 10 | {% block tab_content %} 11 |
14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
Submission dateForge typeForge URLStatus
26 |
27 |
28 | {% endblock tab_content %} 29 | -------------------------------------------------------------------------------- /swh/web/add_forge_now/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/add_forge_now/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/admin/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.admin.apps.AdminConfig" 7 | -------------------------------------------------------------------------------- /swh/web/admin/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class AdminConfig(AppConfig): 10 | name = "swh.web.admin" 11 | label = "swh_web_admin" 12 | -------------------------------------------------------------------------------- /swh/web/admin/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/admin/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/admin/tests/test_app.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import pytest 7 | 8 | from django.urls.exceptions import NoReverseMatch 9 | 10 | from swh.web.utils import reverse 11 | 12 | 13 | @pytest.mark.django_db 14 | def test_admin_deactivate(client, staff_user, django_settings): 15 | """Check admin site feature is deactivated when the swh.web.admin django 16 | application is not in installed apps.""" 17 | 18 | assert reverse("admin:index") is not None 19 | 20 | django_settings.SWH_DJANGO_APPS = [ 21 | app for app in django_settings.SWH_DJANGO_APPS if app != "swh.web.admin" 22 | ] 23 | 24 | with pytest.raises(NoReverseMatch, match="'admin' is not a registered namespace"): 25 | reverse("admin:index") 26 | -------------------------------------------------------------------------------- /swh/web/alter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/alter/__init__.py -------------------------------------------------------------------------------- /swh/web/alter/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2025 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | APP_LABEL = "swh_web_alter" 9 | 10 | 11 | class AlterConfig(AppConfig): 12 | name = "swh.web.alter" 13 | label = APP_LABEL 14 | -------------------------------------------------------------------------------- /swh/web/alter/assets/alter.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2025 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .process-steps i.mdi { 9 | font-size: 2rem; 10 | } 11 | 12 | .activity-log { 13 | max-height: 80vw; 14 | padding-top: 0.75rem; 15 | background-color: #fdfdfe; 16 | } -------------------------------------------------------------------------------- /swh/web/alter/assets/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2025 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // bundle for add forge views 9 | 10 | export * from './alter.css'; 11 | -------------------------------------------------------------------------------- /swh/web/alter/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/alter/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/alter/templates/alter_common.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% comment %} 4 | # Copyright (C) 2025 The Software Heritage developers 5 | # See the AUTHORS file at the top-level directory of this distribution 6 | # License: GNU Affero General Public License version 3, or any later version 7 | # See top-level LICENSE file for more information 8 | {% endcomment %} 9 | 10 | {% load render_bundle from webpack_loader %} 11 | 12 | {% block header %} 13 | {% render_bundle 'alter' %} 14 | {% endblock header %} 15 | -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/admin_alteration_notification.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {{ alteration.get_category_display }}: {% absolute_url alteration.get_admin_url %} 9 | 10 | # Origins: 11 | 12 | {% for origin in alteration.origins.all %}- {{ origin.url }} 13 | {% endfor %} 14 | # Reasons 15 | 16 | {{ alteration.reasons|safe }} 17 | 18 | # Expected outcome 19 | 20 | {{ alteration.expected_outcome|safe }} -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/admin_message_notification.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {{ alteration }}: {% absolute_url alteration.get_admin_url %} 9 | 10 | {% if event.author %}From: {{ event.author }}{% endif %} 11 | 12 | {{ event.content }} -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/alteration_confirmation.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {% blocktranslate %}Greetings, 9 | 10 | We have received your alteration request for the following origins: 11 | {% endblocktranslate %} 12 | {% for origin in alteration.origins.all %}- {{ origin.url }} 13 | {% endfor %} 14 | 15 | {% absolute_url alteration.get_absolute_url as url %} 16 | {% blocktranslate %} 17 | You can track its progress here: 18 | 19 | {{ url }} 20 | 21 | Best regards, 22 | The SWH team 23 | {% endblocktranslate %} -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/alteration_magic_link.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {% absolute_url token.get_absolute_url as url %} 9 | {% blocktranslate with expiration=token.expires_at|timeuntil %} 10 | Greetings, 11 | 12 | The following link will give you access to your alteration request: 13 | 14 | {{ url }} 15 | 16 | Please note that this link will expire in {{ expiration }}. 17 | 18 | Best regards, 19 | The SWH team 20 | {% endblocktranslate %} -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/email_magic_link.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {% absolute_url token.get_absolute_url as url %} 9 | {% blocktranslate with expiration=token.expires_at|timeuntil %} 10 | Greetings, 11 | 12 | Please click the following link to confirm your email address: 13 | 14 | {{ url }} 15 | 16 | This link will expire in {{ expiration }}. 17 | 18 | Best regards, 19 | The SWH team 20 | {% endblocktranslate %} -------------------------------------------------------------------------------- /swh/web/alter/templates/emails/message_notification.txt: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2025 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | {% load alter_extras %} 8 | {% absolute_url alteration.get_absolute_url as url %} 9 | {% blocktranslate with category=alteration.get_category_display %}Greetings, 10 | 11 | You've received a new message regarding your «{{ category }}» archive alteration request. Please follow this link to access it: 12 | 13 | {{ url }} 14 | 15 | Best regards, 16 | The SWH team 17 | {% endblocktranslate %} -------------------------------------------------------------------------------- /swh/web/alter/templates/includes/reasons_outcome.html: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | # Copyright (C) 2025 The Software Heritage developers 3 | # See the AUTHORS file at the top-level directory of this distribution 4 | # License: GNU Affero General Public License version 3, or any later version 5 | # See top-level LICENSE file for more information 6 | {% endcomment %} 7 | 8 |
9 |
10 |
11 |
{% translate "Reasons" %}
12 |
13 |
{{ alteration.reasons|linebreaks }}
14 |
15 |
16 |
17 |
18 |
19 |
{% translate "Expected outcome" %}
20 |
{{ alteration.expected_outcome|linebreaks }}
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /swh/web/alter/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/alter/templatetags/__init__.py -------------------------------------------------------------------------------- /swh/web/alter/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/alter/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/api/__init__.py -------------------------------------------------------------------------------- /swh/web/api/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/api/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/api/tests/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/api/tests/views/__init__.py -------------------------------------------------------------------------------- /swh/web/api/tests/views/test_ping.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from swh.web.tests.helpers import check_api_get_responses 7 | from swh.web.utils import reverse 8 | 9 | 10 | def test_api_1_ping(api_client): 11 | url = reverse("api-1-ping") 12 | rv = check_api_get_responses(api_client, url, status_code=200) 13 | assert rv.data == "pong" 14 | -------------------------------------------------------------------------------- /swh/web/api/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/api/views/__init__.py -------------------------------------------------------------------------------- /swh/web/api/views/ping.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from rest_framework.request import Request 7 | 8 | from swh.web.api.apidoc import api_doc 9 | from swh.web.api.apiurls import api_route 10 | 11 | 12 | @api_route(r"/ping/", "api-1-ping") 13 | @api_doc("/ping/", category="Miscellaneous", noargs=True) 14 | def ping(request: Request): 15 | """ 16 | .. http:get:: /api/1/ping/ 17 | 18 | A simple endpoint used to check if the API is working. 19 | 20 | :statuscode 200: no error 21 | 22 | """ 23 | return "pong" 24 | -------------------------------------------------------------------------------- /swh/web/archive_coverage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/archive_coverage/__init__.py -------------------------------------------------------------------------------- /swh/web/archive_coverage/assets/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2022-2024 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | import '@iframe-resizer/child'; 9 | import 'webapp/assets/webapp/webapp.css'; 10 | import './coverage.css'; 11 | -------------------------------------------------------------------------------- /swh/web/archive_coverage/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/archive_coverage/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/archive_coverage/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import re_path as url 7 | 8 | from swh.web.archive_coverage.views import swh_coverage 9 | 10 | urlpatterns = [ 11 | url(r"^coverage/$", swh_coverage, name="swh-coverage"), 12 | ] 13 | -------------------------------------------------------------------------------- /swh/web/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.auth.apps.AuthConfig" 7 | -------------------------------------------------------------------------------- /swh/web/auth/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class AuthConfig(AppConfig): 10 | name = "swh.web.auth" 11 | label = "swh_web_auth" 12 | -------------------------------------------------------------------------------- /swh/web/auth/assets/auth.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | #swh-token-error-message { 9 | color: red; 10 | font-weight: bold; 11 | } 12 | 13 | #swh-token-success-message { 14 | color: green; 15 | font-weight: bold; 16 | } 17 | 18 | #swh-bearer-token { 19 | word-wrap: break-word; 20 | white-space: break-spaces; 21 | } 22 | -------------------------------------------------------------------------------- /swh/web/auth/migrations/0002_remove_stored_tokens.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | 7 | from django.db import migrations 8 | 9 | from swh.web.auth.models import OIDCUserOfflineTokens 10 | 11 | 12 | def _remove_stored_encrypted_tokens(apps, schema_editor): 13 | OIDCUserOfflineTokens.objects.all().delete() 14 | 15 | 16 | class Migration(migrations.Migration): 17 | dependencies = [ 18 | ("swh_web_auth", "0001_initial"), 19 | ] 20 | 21 | operations = [migrations.RunPython(_remove_stored_encrypted_tokens)] 22 | -------------------------------------------------------------------------------- /swh/web/auth/migrations/0003_delete_oidcuser.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.19 on 2021-03-22 15:41 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ("swh_web_auth", "0002_remove_stored_tokens"), 9 | ] 10 | 11 | operations = [ 12 | migrations.DeleteModel( 13 | name="OIDCUser", 14 | ), 15 | ] 16 | -------------------------------------------------------------------------------- /swh/web/auth/migrations/0009_create_provenance_permission.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | 7 | from django.db import migrations 8 | 9 | 10 | def _create_provenance_permissions(apps, schema_editor): 11 | from swh.web.auth.utils import ( 12 | API_PROVENANCE_PERMISSION, 13 | get_or_create_django_permission, 14 | ) 15 | 16 | get_or_create_django_permission(API_PROVENANCE_PERMISSION) 17 | 18 | 19 | class Migration(migrations.Migration): 20 | dependencies = [ 21 | ("swh_web_auth", "0008_create_webapp_permissions"), 22 | ] 23 | 24 | operations = [ 25 | migrations.RunPython(_create_provenance_permissions, migrations.RunPython.noop), 26 | ] 27 | -------------------------------------------------------------------------------- /swh/web/auth/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/auth/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/auth/models.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import models 7 | 8 | 9 | class OIDCUserOfflineTokens(models.Model): 10 | """ 11 | Model storing encrypted bearer tokens generated by users. 12 | """ 13 | 14 | user_id = models.CharField(max_length=50) 15 | creation_date = models.DateTimeField(auto_now_add=True) 16 | offline_token = models.BinaryField() 17 | 18 | class Meta: 19 | app_label = "swh_web_auth" 20 | db_table = "oidc_user_offline_tokens" 21 | -------------------------------------------------------------------------------- /swh/web/auth/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% comment %} 4 | Copyright (C) 2018-2024 The Software Heritage developers 5 | See the AUTHORS file at the top-level directory of this distribution 6 | License: GNU Affero General Public License version 3, or any later version 7 | See top-level LICENSE file for more information 8 | {% endcomment %} 9 | 10 | {% load static %} 11 | 12 | {% block page_title %} 13 | Login 14 | {% endblock page_title %} 15 | 16 | {% block navbar-content %} 17 |

Login

18 | {% endblock navbar-content %} 19 | 20 | {% block content %} 21 |
22 | {% csrf_token %} 23 | {{ form.as_p }} 24 | 25 |
26 | {% endblock content %} 27 | -------------------------------------------------------------------------------- /swh/web/auth/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/auth/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/badges/assets/badges.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2023 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .swh-badge { 9 | padding-bottom: 1rem; 10 | cursor: pointer; 11 | } 12 | 13 | .swh-badge-html, 14 | .swh-iframe-html, 15 | .swh-badge-md, 16 | .swh-badge-rst { 17 | white-space: pre-wrap !important; 18 | } -------------------------------------------------------------------------------- /swh/web/badges/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/badges/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/badges/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022-2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import path as url 7 | 8 | from swh.web.badges import swh_badge, swh_badge_swhid 9 | from swh.web.utils.url_path_converters import register_url_path_converters 10 | 11 | register_url_path_converters() 12 | 13 | urlpatterns = [ 14 | url( 15 | "badge//", 16 | swh_badge_swhid, 17 | name="swh-badge-swhid", 18 | ), 19 | url( 20 | "badge///", 21 | swh_badge, 22 | name="swh-badge", 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /swh/web/banners/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/banners/__init__.py -------------------------------------------------------------------------------- /swh/web/banners/templates/hiring-banner.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | {% if lang == "en" %} 6 | We are hiring ! See our 7 | job offers. 10 | {% elif lang == "fr" %} 11 | Nous recrutons ! Voir nos 12 | offres d'emploi. 15 | {% elif lang == "es" %} 16 | ¡Estamos contratando! Consulta nuestras 17 | ofertas de empleo. 20 | {% endif %} 21 |
22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /swh/web/banners/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/banners/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/banners/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022-2023 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import re_path as url 7 | 8 | from swh.web.banners.views import downtime_banner, fundraising_banner, hiring_banner 9 | 10 | urlpatterns = [ 11 | url(r"^fundraising/banner/$", fundraising_banner, name="swh-fundraising-banner"), 12 | url(r"^hiring/banner/$", hiring_banner, name="swh-hiring-banner"), 13 | url(r"^downtime/banner/$", downtime_banner, name="swh-downtime-banner"), 14 | ] 15 | -------------------------------------------------------------------------------- /swh/web/browse/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/browse/__init__.py -------------------------------------------------------------------------------- /swh/web/browse/assets/browse/breadcrumbs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .swh-browse-bread-crumbs { 9 | font-size: inherit; 10 | vertical-align: text-top; 11 | margin-bottom: 1px; 12 | } 13 | 14 | .swh-browse-bread-crumbs li:nth-child(n+2)::before { 15 | content: ""; 16 | display: inline-block; 17 | margin: 0 2px; 18 | } 19 | -------------------------------------------------------------------------------- /swh/web/browse/assets/browse/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2022 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // main bundle for the swh-web/browse application 9 | 10 | import './breadcrumbs.css'; 11 | import './browse.css'; 12 | import './content.css'; 13 | import './snapshot-navigation.css'; 14 | 15 | export * from './browse-utils'; 16 | export * from './iframe'; 17 | export * from './origin-search'; 18 | export * from './snapshot-navigation'; 19 | export * from './sidetabs'; 20 | -------------------------------------------------------------------------------- /swh/web/browse/assets/guided_tour/swh-introjs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2021 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | .introjs-tooltip { 9 | min-width: 500px; 10 | } 11 | 12 | .introjs-tooltip.introjs-floating { 13 | /* center tooltip not attached to a DOM element to the center of the screen */ 14 | position: fixed !important; 15 | top: 50% !important; 16 | margin: 0 auto !important; 17 | transform: translate(-50%, -50%) !important; 18 | } 19 | -------------------------------------------------------------------------------- /swh/web/browse/assets/origin_visits/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // origin visits reporting bundle 9 | 10 | export * from './visits-reporting'; 11 | -------------------------------------------------------------------------------- /swh/web/browse/assets/origin_visits/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2021 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | export const visitStatusColor = { 9 | full: '#008000', 10 | partial: '#edc344', 11 | failed: '#ff0000', 12 | ongoing: '#0000ff', 13 | not_found: '#000', 14 | created: '#7d8080' 15 | }; 16 | -------------------------------------------------------------------------------- /swh/web/browse/assets/revision/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018 The Software Heritage developers 3 | * See the AUTHORS file at the top-level directory of this distribution 4 | * License: GNU Affero General Public License version 3, or any later version 5 | * See top-level LICENSE file for more information 6 | */ 7 | 8 | // bundle for browse/revision view 9 | 10 | import './revision.css'; 11 | export * from './diff-utils'; 12 | export * from './log-utils'; 13 | -------------------------------------------------------------------------------- /swh/web/browse/identifiers.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.http import HttpRequest, HttpResponse 7 | from django.shortcuts import redirect 8 | 9 | from swh.web.utils.identifiers import resolve_swhid 10 | 11 | 12 | def swhid_browse(request: HttpRequest, swhid: str) -> HttpResponse: 13 | """ 14 | Django view enabling to browse the archive using :ref:`swhids`. 15 | 16 | The url that points to it is :http:get:`/(swhid)/`. 17 | """ 18 | swhid_resolved = resolve_swhid(swhid, query_params=request.GET.dict()) 19 | assert swhid_resolved["browse_url"] 20 | return redirect(swhid_resolved["browse_url"]) 21 | -------------------------------------------------------------------------------- /swh/web/browse/templates/browse-content.html: -------------------------------------------------------------------------------- 1 | {% extends "./browse.html" %} 2 | 3 | {% comment %} 4 | Copyright (C) 2017-2023 The Software Heritage developers 5 | See the AUTHORS file at the top-level directory of this distribution 6 | License: GNU Affero General Public License version 3, or any later version 7 | See top-level LICENSE file for more information 8 | {% endcomment %} 9 | 10 | {% block swh-browse-content %} 11 | {% include "./includes/top-navigation.html" %} 12 | {% include "./includes/content-display.html" %} 13 | {% endblock swh-browse-content %} 14 | -------------------------------------------------------------------------------- /swh/web/browse/templates/browse-directory.html: -------------------------------------------------------------------------------- 1 | {% extends "./browse.html" %} 2 | 3 | {% comment %} 4 | Copyright (C) 2017-2023 The Software Heritage developers 5 | See the AUTHORS file at the top-level directory of this distribution 6 | License: GNU Affero General Public License version 3, or any later version 7 | See top-level LICENSE file for more information 8 | {% endcomment %} 9 | 10 | {% block swh-browse-content %} 11 | {% include "./includes/top-navigation.html" %} 12 | {% include "./includes/directory-display.html" %} 13 | {% endblock swh-browse-content %} 14 | 15 | {% block swh-browse-after-content %} 16 | {% include "./includes/readme-display.html" %} 17 | {% endblock swh-browse-after-content %} 18 | -------------------------------------------------------------------------------- /swh/web/browse/templates/includes/branch-search.html: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2021-2024 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | 8 |
9 | 14 | 17 |
18 | -------------------------------------------------------------------------------- /swh/web/browse/templates/includes/breadcrumbs.html: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2017-2023 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | 8 | {% if breadcrumbs %} 9 | {% if iframe_mode or breadcrumbs|length > 1 or breadcrumbs.0.url %} 10 | 24 | {% endif %} 25 | {% endif %} 26 | -------------------------------------------------------------------------------- /swh/web/browse/templates/includes/empty-snapshot.html: -------------------------------------------------------------------------------- 1 | {% comment %} 2 | Copyright (C) 2018-2023 The Software Heritage developers 3 | See the AUTHORS file at the top-level directory of this distribution 4 | License: GNU Affero General Public License version 3, or any later version 5 | See top-level LICENSE file for more information 6 | {% endcomment %} 7 | 8 | {% load static %} 9 | 10 |
11 |   
12 |   {% if snapshot_context and snapshot_context.origin_info %}
13 |     

14 | The snapshot associated to the visit of origin {{ snapshot_context.origin_info.url }} 15 | on {{ snapshot_context.timestamp }} is empty ! 16 |

17 | {% else %} 18 |

The snapshot is empty !

19 | {% endif %} 20 |
21 | -------------------------------------------------------------------------------- /swh/web/browse/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/browse/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/browse/tests/data/content_iso-8859-7_encoded: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/browse/tests/data/content_iso-8859-7_encoded -------------------------------------------------------------------------------- /swh/web/browse/tests/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/browse/tests/views/__init__.py -------------------------------------------------------------------------------- /swh/web/browse/tests/views/conftest.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import pytest 7 | 8 | 9 | @pytest.fixture 10 | def make_masked_object_exception(): 11 | def _masked_object_exception(swhid_str: str): 12 | from uuid import UUID 13 | 14 | from swh.model.swhids import ExtendedSWHID 15 | from swh.storage.exc import MaskedObjectException 16 | from swh.storage.proxies.masking.db import MaskedState, MaskedStatus 17 | 18 | swhid = ExtendedSWHID.from_string(swhid_str) 19 | status = MaskedStatus( 20 | state=MaskedState.DECISION_PENDING, 21 | request=UUID("da785a27-7e59-4a35-b82a-a5ae3714407c"), 22 | ) 23 | return MaskedObjectException({swhid: [status]}) 24 | 25 | return _masked_object_exception 26 | -------------------------------------------------------------------------------- /swh/web/browse/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/browse/views/__init__.py -------------------------------------------------------------------------------- /swh/web/deposit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/deposit/__init__.py -------------------------------------------------------------------------------- /swh/web/deposit/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/deposit/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/gunicorn_config.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2020 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from sentry_sdk.integrations.django import DjangoIntegration 7 | 8 | from swh.core.sentry import init_sentry 9 | 10 | 11 | def post_fork(server, worker): 12 | init_sentry(sentry_dsn=None, integrations=[DjangoIntegration()]) 13 | -------------------------------------------------------------------------------- /swh/web/inbound_email/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.inbound_email.apps.InboundEmailConfig" 7 | -------------------------------------------------------------------------------- /swh/web/inbound_email/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class InboundEmailConfig(AppConfig): 10 | default_auto_field = "django.db.models.BigAutoField" 11 | name = "swh.web.inbound_email" 12 | -------------------------------------------------------------------------------- /swh/web/inbound_email/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/inbound_email/management/__init__.py -------------------------------------------------------------------------------- /swh/web/inbound_email/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/inbound_email/management/commands/__init__.py -------------------------------------------------------------------------------- /swh/web/inbound_email/management/commands/process_inbound_email.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import sys 7 | 8 | from django.core.management.base import BaseCommand 9 | 10 | from ...handle_message import MessageHandler 11 | 12 | 13 | class Command(BaseCommand): 14 | help = "Process a new inbound email" 15 | 16 | def handle(self, *args, **options): 17 | MessageHandler( 18 | raw_message=sys.stdin.buffer.read(), sender=self.__class__ 19 | ).handle() 20 | -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/inbound_email/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/inbound_email/tests/resources/__init__.py -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/resources/multipart_alternative_text_only.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | X-Mailer: MessagingEngine.com Webmail Interface 3 | User-Agent: Cyrus-JMAP/3.7.0-alpha0-382-g88b93171a9-fm-20220330.001-g88b93171 4 | Mime-Version: 1.0 5 | Message-Id: 6 | Date: Mon, 04 Apr 2022 17:10:00 +0200 7 | From: "Test User" 8 | To: test@example.com 9 | Subject: Multipart email 10 | Content-Type: multipart/alternative; 11 | boundary=67575b1b68b24603a2d00f02e032c975 12 | 13 | --67575b1b68b24603a2d00f02e032c975 14 | Content-Type: text/plain 15 | 16 | *Multipart email.* 17 | 18 | -- 19 | Test User 20 | --67575b1b68b24603a2d00f02e032c975 21 | Content-Type: text/plain 22 | 23 | *Multipart email, but a longer text part.* 24 | 25 | -- 26 | Test User 27 | --67575b1b68b24603a2d00f02e032c975-- 28 | -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/resources/multipart_mixed.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Content-Type: multipart/mixed; boundary="------------BR6CvS06rj0369ladb31gYCL" 3 | Message-ID: <8318382c-b4d3-9239-0805-e8cff4b9187a@inria.fr> 4 | Date: Thu, 7 Apr 2022 10:30:36 +0200 5 | MIME-Version: 1.0 6 | User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 7 | Thunderbird/91.7.0 8 | Content-Language: en-US 9 | To: Test User 10 | From: Test User 11 | Subject: test email 12 | 13 | This is a multi-part message in MIME format. 14 | --------------BR6CvS06rj0369ladb31gYCL 15 | Content-Type: text/plain; charset=UTF-8; format=flowed 16 | Content-Transfer-Encoding: 7bit 17 | 18 | This is plain text 19 | 20 | --------------BR6CvS06rj0369ladb31gYCL 21 | Content-Type: text/html 22 | 23 | and this is HTML 24 | -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/resources/multipart_mixed2.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Content-Type: multipart/mixed; boundary="------------BR6CvS06rj0369ladb31gYCL" 3 | Message-ID: <8318382c-b4d3-9239-0805-e8cff4b9187a@inria.fr> 4 | Date: Thu, 7 Apr 2022 10:30:36 +0200 5 | MIME-Version: 1.0 6 | User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 7 | Thunderbird/91.7.0 8 | Content-Language: en-US 9 | To: Test User 10 | From: Test User 11 | Subject: test email 12 | 13 | This is a multi-part message in MIME format. 14 | --------------BR6CvS06rj0369ladb31gYCL 15 | Content-Type: text/plain; charset=UTF-8; format=flowed 16 | Content-Transfer-Encoding: 7bit 17 | 18 | This is plain text 19 | 20 | --------------BR6CvS06rj0369ladb31gYCL 21 | Content-Type: text/plain; charset=UTF-8; format=flowed 22 | Content-Transfer-Encoding: 7bit 23 | 24 | and this is more text 25 | 26 | -------------------------------------------------------------------------------- /swh/web/inbound_email/tests/resources/plaintext.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | X-Mailer: MessagingEngine.com Webmail Interface 3 | User-Agent: Cyrus-JMAP/3.7.0-alpha0-382-g88b93171a9-fm-20220330.001-g88b93171 4 | Mime-Version: 1.0 5 | Message-Id: <21e17bca-d6a7-40fb-bab8-5dadd939835b@www.fastmail.com> 6 | Date: Mon, 04 Apr 2022 17:08:04 +0200 7 | From: "Test User" 8 | To: test@example.com 9 | Subject: Plain text email 10 | Content-Type: text/plain 11 | 12 | Plain text email. 13 | 14 | -- 15 | Test User 16 | -------------------------------------------------------------------------------- /swh/web/inbound_email/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import re_path as url 7 | 8 | from .views import InboundEmailView 9 | 10 | urlpatterns = [ 11 | url(r"^inbound-email/$", InboundEmailView.as_view(), name="process-inbound-email") 12 | ] 13 | -------------------------------------------------------------------------------- /swh/web/jslicenses/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/jslicenses/__init__.py -------------------------------------------------------------------------------- /swh/web/jslicenses/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/jslicenses/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/jslicenses/tests/test_jslicenses.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from swh.web.tests.helpers import check_html_get_response 7 | from swh.web.utils import reverse 8 | 9 | 10 | def test_js_licenses(client): 11 | url = reverse("jslicenses") 12 | check_html_get_response( 13 | client, url, status_code=200, template_used="jslicenses.html" 14 | ) 15 | -------------------------------------------------------------------------------- /swh/web/jslicenses/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import json 7 | 8 | from django.contrib.staticfiles import finders 9 | from django.shortcuts import render 10 | from django.urls import re_path as url 11 | 12 | 13 | def jslicenses(request): 14 | jslicenses_file = finders.find("jssources/jslicenses.json") 15 | jslicenses_data = {} 16 | if jslicenses_file is not None: 17 | jslicenses_data = json.load(open(jslicenses_file)) 18 | jslicenses_data = sorted( 19 | jslicenses_data.items(), key=lambda item: item[0].split("/")[-1] 20 | ) 21 | return render(request, "jslicenses.html", {"jslicenses_data": jslicenses_data}) 22 | 23 | 24 | urlpatterns = [ 25 | url(r"^jslicenses/$", jslicenses, name="jslicenses"), 26 | ] 27 | -------------------------------------------------------------------------------- /swh/web/mailmap/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.mailmap.apps.MailmapConfig" 7 | -------------------------------------------------------------------------------- /swh/web/mailmap/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class MailmapConfig(AppConfig): 10 | name = "swh.web.mailmap" 11 | label = "swh_web_mailmap" 12 | -------------------------------------------------------------------------------- /swh/web/mailmap/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/mailmap/management/__init__.py -------------------------------------------------------------------------------- /swh/web/mailmap/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/mailmap/management/commands/__init__.py -------------------------------------------------------------------------------- /swh/web/mailmap/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/mailmap/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/mailmap/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/mailmap/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/mailmap/tests/test_migrations.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | 7 | APP_NAME = "swh_web_mailmap" 8 | 9 | MIGRATION_0001 = "0001_initial" 10 | 11 | 12 | def test_mailmap_django_app(migrator): 13 | state = migrator.apply_tested_migration((APP_NAME, MIGRATION_0001)) 14 | UserMailmap = state.apps.get_model(APP_NAME, "UserMailmap") 15 | assert UserMailmap 16 | -------------------------------------------------------------------------------- /swh/web/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/metrics/__init__.py -------------------------------------------------------------------------------- /swh/web/metrics/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/metrics/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/metrics/tests/test_app.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import pytest 7 | 8 | from django.urls import get_resolver 9 | 10 | from swh.web.metrics.urls import urlpatterns 11 | 12 | 13 | @pytest.mark.django_db 14 | def test_metrics_deactivate(django_settings): 15 | """Check metrics feature is deactivated when the swh.web.metrics django 16 | application is not in installed apps.""" 17 | 18 | django_settings.SWH_DJANGO_APPS = [ 19 | app for app in django_settings.SWH_DJANGO_APPS if app != "swh.web.metrics" 20 | ] 21 | 22 | metrics_view_names = set(urlpattern.name for urlpattern in urlpatterns) 23 | all_view_names = set(get_resolver().reverse_dict.keys()) 24 | assert metrics_view_names & all_view_names == set() 25 | -------------------------------------------------------------------------------- /swh/web/metrics/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import re_path as url 7 | 8 | from swh.web.metrics.views import prometheus_metrics 9 | 10 | urlpatterns = [ 11 | url(r"^metrics/prometheus/$", prometheus_metrics, name="metrics-prometheus"), 12 | ] 13 | -------------------------------------------------------------------------------- /swh/web/metrics/views.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from prometheus_client.exposition import CONTENT_TYPE_LATEST, generate_latest 7 | 8 | from django.http import HttpResponse 9 | 10 | from swh.web.metrics.prometheus import ( 11 | SWH_WEB_METRICS_REGISTRY, 12 | compute_save_requests_metrics, 13 | ) 14 | 15 | 16 | def prometheus_metrics(request): 17 | compute_save_requests_metrics() 18 | 19 | return HttpResponse( 20 | content=generate_latest(registry=SWH_WEB_METRICS_REGISTRY), 21 | content_type=CONTENT_TYPE_LATEST, 22 | ) 23 | -------------------------------------------------------------------------------- /swh/web/provenance/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.provenance.apps.ProvenanceConfig" 7 | -------------------------------------------------------------------------------- /swh/web/provenance/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class ProvenanceConfig(AppConfig): 10 | name = "swh.web.provenance" 11 | label = "swh_web_provenance" 12 | -------------------------------------------------------------------------------- /swh/web/provenance/tests/test_apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import pytest 7 | 8 | from django.urls import get_resolver 9 | 10 | from swh.web.provenance.urls import urlpatterns 11 | 12 | 13 | @pytest.mark.django_db 14 | def test_provenance_deactivate(client, staff_user, django_settings): 15 | """Check provenance features are deactivated when the swh.web.provenance django 16 | application is not in installed apps.""" 17 | 18 | django_settings.SWH_DJANGO_APPS = [ 19 | app for app in django_settings.SWH_DJANGO_APPS if app != "swh.web.provenance" 20 | ] 21 | 22 | provenance_view_names = set(urlpattern.name for urlpattern in urlpatterns) 23 | all_view_names = set(get_resolver().reverse_dict.keys()) 24 | assert provenance_view_names & all_view_names == set() 25 | -------------------------------------------------------------------------------- /swh/web/provenance/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from swh.web.provenance.api_views import provenance_api_urls 7 | 8 | urlpatterns = provenance_api_urls.get_url_patterns() 9 | -------------------------------------------------------------------------------- /swh/web/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561. 2 | -------------------------------------------------------------------------------- /swh/web/save_bulk/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.save_bulk.apps.SaveBulkConfig" 7 | -------------------------------------------------------------------------------- /swh/web/save_bulk/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class SaveBulkConfig(AppConfig): 10 | name = "swh.web.save_bulk" 11 | label = "swh_web_save_bulk" 12 | -------------------------------------------------------------------------------- /swh/web/save_bulk/migrations/0002_alter_savebulkorigin_origin_url.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ("swh_web_save_bulk", "0001_initial"), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name="savebulkorigin", 18 | name="origin_url", 19 | field=models.CharField(max_length=4096, null=False), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /swh/web/save_bulk/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_bulk/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/save_bulk/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_bulk/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/save_bulk/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.urls import path as url 7 | 8 | from swh.web.save_bulk.api_views import save_bulk_api_urls 9 | from swh.web.save_bulk.views import api_save_bulk_origins_list 10 | 11 | urlpatterns = [ 12 | url( 13 | "origin/save/bulk//list/", 14 | api_save_bulk_origins_list, 15 | name="save-origin-bulk-origins-list", 16 | ), 17 | ] 18 | urlpatterns += save_bulk_api_urls.get_url_patterns() 19 | -------------------------------------------------------------------------------- /swh/web/save_code_now/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | default_app_config = "swh.web.save_code_now.apps.SaveCodeNowConfig" 7 | -------------------------------------------------------------------------------- /swh/web/save_code_now/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.apps import AppConfig 7 | 8 | 9 | class SaveCodeNowConfig(AppConfig): 10 | name = "swh.web.save_code_now" 11 | label = "swh_web_save_code_now" 12 | -------------------------------------------------------------------------------- /swh/web/save_code_now/assets/index.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2022 The Software Heritage developers 2 | * See the AUTHORS file at the top-level directory of this distribution 3 | * License: GNU Affero General Public License version 3, or any later version 4 | * See top-level LICENSE file for more information 5 | */ 6 | 7 | export * from './origin-save'; 8 | export * from './origin-save-admin'; 9 | -------------------------------------------------------------------------------- /swh/web/save_code_now/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_code_now/management/__init__.py -------------------------------------------------------------------------------- /swh/web/save_code_now/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_code_now/management/commands/__init__.py -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0002_saveoriginrequest_visit_date.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from __future__ import unicode_literals 7 | 8 | from django.db import migrations, models 9 | 10 | 11 | class Migration(migrations.Migration): 12 | dependencies = [ 13 | ("swh_web_save_code_now", "0001_initial"), 14 | ] 15 | 16 | operations = [ 17 | migrations.AddField( 18 | model_name="saveoriginrequest", 19 | name="visit_date", 20 | field=models.DateTimeField(null=True), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0005_remove_duplicated_authorized_origins.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from __future__ import unicode_literals 7 | 8 | from django.db import migrations 9 | 10 | from swh.web.save_code_now.models import SaveAuthorizedOrigin 11 | 12 | 13 | def _remove_duplicated_urls_in_authorized_list(apps, schema_editor): 14 | sao = SaveAuthorizedOrigin.objects 15 | for url in sao.values_list("url", flat=True).distinct(): 16 | sao.filter(pk__in=sao.filter(url=url).values_list("id", flat=True)[1:]).delete() 17 | 18 | 19 | class Migration(migrations.Migration): 20 | dependencies = [ 21 | ("swh_web_save_code_now", "0004_auto_20190204_1324"), 22 | ] 23 | 24 | operations = [migrations.RunPython(_remove_duplicated_urls_in_authorized_list)] 25 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0006_rename_origin_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from __future__ import unicode_literals 7 | 8 | from django.db import migrations 9 | 10 | 11 | class Migration(migrations.Migration): 12 | dependencies = [ 13 | ("swh_web_save_code_now", "0005_remove_duplicated_authorized_origins"), 14 | ] 15 | 16 | operations = [ 17 | migrations.RenameField( 18 | model_name="saveoriginrequest", 19 | old_name="origin_type", 20 | new_name="visit_type", 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0010_saveoriginrequest_user_id.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | # Generated by Django 2.2.20 on 2021-05-03 14:16 6 | 7 | from django.db import migrations, models 8 | 9 | 10 | class Migration(migrations.Migration): 11 | dependencies = [ 12 | ("swh_web_save_code_now", "0009_saveoriginrequest_visit_status"), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name="saveoriginrequest", 18 | name="user_id", 19 | field=models.CharField(max_length=200, null=True), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0011_saveoriginrequest_user_ids.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | dependencies = [ 11 | ("swh_web_save_code_now", "0010_saveoriginrequest_user_id"), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name="saveoriginrequest", 17 | name="user_id", 18 | ), 19 | migrations.AddField( 20 | model_name="saveoriginrequest", 21 | name="user_ids", 22 | field=models.TextField(null=True), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0012_saveoriginrequest_note.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2021 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | dependencies = [ 11 | ("swh_web_save_code_now", "0011_saveoriginrequest_user_ids"), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name="saveoriginrequest", 17 | name="note", 18 | field=models.TextField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0013_saveoriginrequest_webhook_info.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | dependencies = [ 11 | ("swh_web_save_code_now", "0012_saveoriginrequest_note"), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name="saveoriginrequest", 17 | name="from_webhook", 18 | field=models.BooleanField(default=False), 19 | ), 20 | migrations.AddField( 21 | model_name="saveoriginrequest", 22 | name="webhook_origin", 23 | field=models.CharField(max_length=200, null=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0014_saveoriginrequest_snapshot_swhid.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | dependencies = [ 11 | ("swh_web_save_code_now", "0013_saveoriginrequest_webhook_info"), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name="saveoriginrequest", 17 | name="snapshot_swhid", 18 | field=models.CharField(max_length=200, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/0016_alter_saveoriginrequest_origin_url.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ("swh_web_save_code_now", "0015_alter_saveoriginrequest_loading_task_status"), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name="saveoriginrequest", 18 | name="origin_url", 19 | field=models.CharField(max_length=4096, null=False), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /swh/web/save_code_now/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_code_now/migrations/__init__.py -------------------------------------------------------------------------------- /swh/web/save_code_now/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_code_now/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/save_origin_webhooks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_origin_webhooks/__init__.py -------------------------------------------------------------------------------- /swh/web/save_origin_webhooks/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/save_origin_webhooks/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_svn.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "commits": [ 4 | { 5 | "id": "r1", 6 | "url": "https://sourceforge.net/p/webhook-test-svn/code/1/", 7 | "timestamp": "2022-10-25T15:53:04Z", 8 | "message": "Add initial directories", 9 | "author": { 10 | "name": "johndoe", 11 | "email": "", 12 | "username": "" 13 | }, 14 | "committer": { 15 | "name": "johndoe", 16 | "email": "", 17 | "username": "" 18 | }, 19 | "added": [ 20 | "/branches", 21 | "/tags", 22 | "/trunk" 23 | ], 24 | "removed": [], 25 | "modified": [], 26 | "copied": [], 27 | "renamed": [] 28 | } 29 | ], 30 | "before": "", 31 | "after": "r1", 32 | "repository": { 33 | "name": "Code", 34 | "full_name": "/p/webhook-test-svn/code/", 35 | "url": "https://sourceforge.net/p/webhook-test-svn/code/" 36 | } 37 | } -------------------------------------------------------------------------------- /swh/web/save_origin_webhooks/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | 7 | # register Web API endpoints 8 | import swh.web.save_origin_webhooks.bitbucket # noqa 9 | import swh.web.save_origin_webhooks.gitea # noqa 10 | import swh.web.save_origin_webhooks.github # noqa 11 | import swh.web.save_origin_webhooks.gitlab # noqa 12 | import swh.web.save_origin_webhooks.sourceforge # noqa 13 | 14 | from swh.web.save_origin_webhooks.generic_receiver import ( # isort: skip 15 | webhooks_api_urls, 16 | ) 17 | 18 | urlpatterns = webhooks_api_urls.get_url_patterns() 19 | -------------------------------------------------------------------------------- /swh/web/settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/settings/__init__.py -------------------------------------------------------------------------------- /swh/web/settings/development.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | """ 7 | Django development settings for swh-web. 8 | """ 9 | 10 | from django.core.cache import cache 11 | 12 | from swh.web.config import get_config 13 | 14 | swh_web_config = get_config() 15 | 16 | swh_web_config.update( 17 | { 18 | "show_corner_ribbon": True, 19 | "corner_ribbon_text": "Development", 20 | } 21 | ) 22 | 23 | from .common import * # noqa 24 | 25 | AUTH_PASSWORD_VALIDATORS = [] # disable any pwd validation mechanism 26 | 27 | cache.clear() 28 | -------------------------------------------------------------------------------- /swh/web/static/img/arrow-up-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/arrow-up-small.png -------------------------------------------------------------------------------- /swh/web/static/img/icons/swh-logo-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/icons/swh-logo-32x32.png -------------------------------------------------------------------------------- /swh/web/static/img/icons/swh-logo-archive-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/icons/swh-logo-archive-180x180.png -------------------------------------------------------------------------------- /swh/web/static/img/icons/swh-logo-archive-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/icons/swh-logo-archive-192x192.png -------------------------------------------------------------------------------- /swh/web/static/img/icons/swh-logo-archive-270x270.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/icons/swh-logo-archive-270x270.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/arch.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/aur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/aur.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/bioconductor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/bioconductor.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/bitbucket-hg.png: -------------------------------------------------------------------------------- 1 | bitbucket.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/bitbucket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/bitbucket.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/bower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/bower.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/cgit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/cgit.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/conda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/conda.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/cpan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/cpan.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/cran.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/cran.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/crates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/crates.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/debian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/debian.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/dlang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/dlang.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/elife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/elife.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gitea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gitea.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/github.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gitlab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gitlab.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gitorious.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gitorious.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gitweb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gitweb.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gnu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gnu.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/gogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/gogs.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/golang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/golang.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/googlecode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/googlecode.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/guix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/guix.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/hackage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/hackage.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/hal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/hal.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/heptapod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/heptapod.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/inria.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/inria.jpg -------------------------------------------------------------------------------- /swh/web/static/img/logos/ipol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/ipol.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/launchpad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/launchpad.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/maven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/maven.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/nixos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/nixos.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/npm.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/opam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/opam.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/packagist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/packagist.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/pagure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/pagure.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/phabricator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/phabricator.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/pubdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/pubdev.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/puppet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/puppet.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/pypi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/pypi.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/rpm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/rpm.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/rubygems.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/rubygems.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/sourceforge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/sourceforge.png -------------------------------------------------------------------------------- /swh/web/static/img/logos/zenodo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/logos/zenodo.png -------------------------------------------------------------------------------- /swh/web/static/img/swh-donor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-donor.png -------------------------------------------------------------------------------- /swh/web/static/img/swh-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-logo.png -------------------------------------------------------------------------------- /swh/web/static/img/swh-mirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-mirror.png -------------------------------------------------------------------------------- /swh/web/static/img/swh-spinner-small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-spinner-small.gif -------------------------------------------------------------------------------- /swh/web/static/img/swh-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-spinner.gif -------------------------------------------------------------------------------- /swh/web/static/img/swh-vault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/static/img/swh-vault.png -------------------------------------------------------------------------------- /swh/web/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftwareHeritage/swh-web/280a2c3b72fb20d5eb4ee605ff05050db10f98b5/swh/web/tests/__init__.py -------------------------------------------------------------------------------- /swh/web/tests/create_test_admin.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2022 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | 7 | from django.contrib.auth import get_user_model 8 | 9 | username = "admin" 10 | password = "admin" 11 | email = "admin@swh-web.org" 12 | 13 | User = get_user_model() 14 | 15 | try: 16 | user = User.objects.filter(username=username).get() 17 | except User.DoesNotExist: 18 | user = User.objects.create_superuser(username, email, password) 19 | 20 | assert user.is_staff is True 21 | -------------------------------------------------------------------------------- /swh/web/tests/django_asserts.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019-2024 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | from pytest_django.asserts import assertContains, assertNotContains, assertTemplateUsed 7 | 8 | assert_template_used = assertTemplateUsed 9 | assert_contains = assertContains 10 | assert_not_contains = assertNotContains 11 | -------------------------------------------------------------------------------- /swh/web/tests/pytest_plugin.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 The Software Heritage developers 2 | # See the AUTHORS file at the top-level directory of this distribution 3 | # License: GNU Affero General Public License version 3, or any later version 4 | # See top-level LICENSE file for more information 5 | 6 | import os 7 | 8 | import pytest 9 | 10 | 11 | @pytest.hookimpl(tryfirst=True) 12 | def pytest_load_initial_conftests(args, early_config, parser): 13 | # avoid side effects in tests if a local config file exists 14 | os.environ["SWH_CONFIG_FILENAME"] = "non/existing/config" 15 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.abnf: -------------------------------------------------------------------------------- 1 | ; line comment 2 | 3 | ruleset = [optional] *(group1 / group2 / SP) CRLF ; trailing comment 4 | 5 | group1 = alt1 6 | group1 =/ alt2 7 | 8 | alt1 = %x41-4D / %d78-90 9 | 10 | alt2 = %b00100001 11 | 12 | group2 = *1DIGIT / 2*HEXDIG / 3*4OCTET 13 | 14 | optional = hex-codes 15 | / literal 16 | / sensitive 17 | / insensitive 18 | 19 | hex-codes = %x68.65.6C.6C.6F 20 | literal = "string literal" 21 | sensitive = %s"case-sensitive string" 22 | insensitive = %i"case-insensitive string" 23 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.adb: -------------------------------------------------------------------------------- 1 | package body Sqlite.Simple is 2 | 3 | Foo : int := int'Size; 4 | Bar : int := long'Size; 5 | 6 | Error_Message_C : chars_ptr := Sqlite_Errstr (Error); 7 | Error_Message : String := Null_Ignore_Value (Error_Message_C); 8 | begin 9 | 10 | Named : for Index in Foo..Bar loop 11 | Put ("Hi[]{}"); 12 | end loop Named; 13 | 14 | Foo := Bar; 15 | end Message; 16 | 17 | end Sqlite.Simple; 18 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.ahk: -------------------------------------------------------------------------------- 1 | ; hotkeys and hotstrings 2 | #a::WinSet, AlwaysOnTop, Toggle, A 3 | #Space:: 4 | MsgBox, Percent sign (`%) need to be escaped. 5 | Run "C:\Program Files\some\program.exe" 6 | Gosub, label1 7 | return 8 | ::btw::by the way 9 | ; volume 10 | #Numpad8::Send {Volume_Up} 11 | #Numpad5::Send {Volume_Mute} 12 | #Numpad2::Send {Volume_Down} 13 | 14 | label1: 15 | if (Clipboard = "") 16 | { 17 | MsgBox, , Clipboard, Empty! 18 | } 19 | else 20 | { 21 | StringReplace, temp, Clipboard, old, new, All 22 | MsgBox, , Clipboard, %temp% 23 | } 24 | return -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.applescript: -------------------------------------------------------------------------------- 1 | repeat 5 times 2 | if foo is greater than bar then 3 | display dialog "Hello there" 4 | else 5 | beep 6 | end if 7 | end repeat 8 | 9 | (* comment (*nested comment*) *) 10 | on do_something(s, y) 11 | return {s + pi, y mod 4} 12 | end do_something 13 | 14 | do shell script "/bin/echo 'hello'" -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.as: -------------------------------------------------------------------------------- 1 | package org.example.dummy { 2 | import org.dummy.*; 3 | 4 | /*define package inline interface*/ 5 | public interface IFooBarzable { 6 | public function foo(... pairs):Array; 7 | } 8 | 9 | public class FooBar implements IFooBarzable { 10 | static private var cnt:uint = 0; 11 | private var bar:String; 12 | 13 | //constructor 14 | public function TestBar(bar:String):void { 15 | bar = bar; 16 | ++cnt; 17 | } 18 | 19 | public function foo(... pairs):Array { 20 | pairs.push(bar); 21 | return pairs; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.au3: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #AutoIt3Wrapper_Run_Tidy=Y 3 | #include 4 | 5 | _Singleton(@ScriptName) ; Allow only one instance 6 | example(0, 10) 7 | 8 | Func example($min, $max) 9 | For $i = $min To $max 10 | If Mod($i, 2) == 0 Then 11 | MsgBox(64, "Message", $i & ' is even number!') 12 | Else 13 | MsgBox(64, "Message", $i & ' is odd number!') 14 | EndIf 15 | Next 16 | EndFunc ;==>example -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | POPService = "/inet/tcp/0/emailhost/pop3" 3 | RS = ORS = "\r\n" 4 | print "user name" |& POPService 5 | POPService |& getline 6 | print "pass password" |& POPService 7 | POPService |& getline 8 | print "retr 1" |& POPService 9 | POPService |& getline 10 | if ($1 != "+OK") exit 11 | print "quit" |& POPService 12 | RS = "\r\n\\.\r\n" 13 | POPService |& getline 14 | print $0 15 | close(POPService) 16 | } -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.bas: -------------------------------------------------------------------------------- 1 | 10 CLS 2 | 20 FOR I = 0 TO 15 3 | 22 FOR J = 0 TO 7 4 | 30 COLOR I,J 5 | 40 PRINT " ** "; 6 | 45 NEXT J 7 | 46 COLOR I,0 8 | 47 GOSUB 100 9 | 48 PRINT 10 | 50 NEXT I 11 | 60 COLOR 15,0 12 | 99 END 13 | 100 FOR T = 65 TO 90 14 | 101 PRINT CHR$(T); 15 | 102 NEXT T 16 | 103 RETURN 17 | 200 REM Data types test 18 | 201 TOTAL# = 3.30# 'Double precision variable 19 | 202 BALANCE! = 3! 'Single precision variable 20 | 203 B2! = 12e5 '120000 21 | 204 ITEMS% = 10 'Integer variable 22 | 205 HEXTEST = &H12DB 'Hex value 23 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.bat: -------------------------------------------------------------------------------- 1 | cd \ 2 | copy a b 3 | ping 192.168.0.1 4 | @rem ping 192.168.0.1 5 | net stop sharedaccess 6 | del %tmp% /f /s /q 7 | del %temp% /f /s /q 8 | ipconfig /flushdns 9 | taskkill /F /IM JAVA.EXE /T 10 | 11 | cd Photoshop/Adobe Photoshop CS3/AMT/ 12 | if exist application.sif ( 13 | ren application.sif _application.sif 14 | ) else ( 15 | ren _application.sif application.sif 16 | ) 17 | 18 | taskkill /F /IM proquota.exe /T 19 | 20 | sfc /SCANNOW 21 | 22 | set path = test 23 | 24 | xcopy %1\*.* %2 -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.bf: -------------------------------------------------------------------------------- 1 | ++++++++++ 2 | [ 3*10 and 10*10 3 | ->+++>++++++++++<< 4 | ]>> 5 | [ filling cells 6 | ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[> 7 | ]< 8 | +++++++++<< 9 | [ rough codes correction loop 10 | ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]< 11 | ] 12 | more accurate сodes correction 13 | >>>++> 14 | -->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++> 15 | ++>+++++++++++>++++++++++++>------>+++ 16 | rewind and output 17 | [<]>[.>] 18 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.bnf: -------------------------------------------------------------------------------- 1 | ::= | 2 | ::= "<" ">" "::=" 3 | ::= " " | "" 4 | ::= | "|" 5 | ::= | 6 | ::= | 7 | ::= | "<" ">" 8 | ::= '"' '"' | "'" "'" 9 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cal: -------------------------------------------------------------------------------- 1 | OBJECT Codeunit 11 Gen. Jnl.-Check Line 2 | { 3 | OBJECT-PROPERTIES 4 | { 5 | Date=09-09-14; 6 | Time=12:00:00; 7 | Version List=NAVW18.00; 8 | } 9 | PROPERTIES 10 | { 11 | TableNo=81; 12 | Permissions=TableData 252=rimd; 13 | OnRun=BEGIN 14 | GLSetup.GET; 15 | RunCheck(Rec); 16 | END; 17 | 18 | } 19 | CODE 20 | { 21 | VAR 22 | Text000@1000 : TextConst 'ENU=can only be a closing date for G/L entries'; 23 | Text001@1001 : TextConst 'ENU=is not within your range of allowed posting dates'; 24 | 25 | PROCEDURE ErrorIfPositiveAmt@2(GenJnlLine@1000 : Record 81); 26 | BEGIN 27 | IF GenJnlLine.Amount > 0 THEN 28 | GenJnlLine.FIELDERROR(Amount,Text008); 29 | END; 30 | 31 | LOCAL PROCEDURE CheckGenJnlLineDocType@7(GenJnlLine@1001 : Record 81); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.ceylon: -------------------------------------------------------------------------------- 1 | shared void run() { 2 | print("Hello, `` process.arguments.first else "World" ``!"); 3 | } 4 | class Counter(count=0) { 5 | variable Integer count; 6 | shared Integer currentValue => count; 7 | shared void increment() => count++; 8 | } -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.clj: -------------------------------------------------------------------------------- 1 | (def ^:dynamic chunk-size 17) 2 | 3 | (defn next-chunk [rdr] 4 | (let [buf (char-array chunk-size) 5 | s (.read rdr buf)] 6 | (when (pos? s) 7 | (java.nio.CharBuffer/wrap buf 0 s)))) 8 | 9 | (defn chunk-seq [rdr] 10 | (when-let [chunk (next-chunk rdr)] 11 | (cons chunk (lazy-seq (chunk-seq rdr))))) -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cls: -------------------------------------------------------------------------------- 1 | #dim test as %Library.Integer 2 | SET test = 123.099 3 | set ^global = %request.Content 4 | Write "Current date """, $ztimestamp, """, result: ", test + ^global = 125.099 5 | do ##class(Cinema.Utils).AddShow("test") // class method call 6 | do ##super() ; another one-line comment 7 | d:(^global = 2) ..thisClassMethod(1, 2, "test") 8 | /* 9 | * Sub-languages support: 10 | */ 11 | &sql( SELECT * FROM Cinema.Film WHERE Length > 2 ) 12 | &js 15 | &html< 16 | 17 | 18 | Test 19 | > 20 | 21 | quit $$$OK 22 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.8) 2 | project(cmake_example) 3 | 4 | # Show message on Linux platform 5 | if (${CMAKE_SYSTEM_NAME} MATCHES Linux) 6 | message("Good choice, bro!") 7 | endif() 8 | 9 | # Tell CMake to run moc when necessary: 10 | set(CMAKE_AUTOMOC ON) 11 | # As moc files are generated in the binary dir, 12 | # tell CMake to always look for includes there: 13 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 14 | 15 | # Widgets finds its own dependencies. 16 | find_package(Qt5Widgets REQUIRED) 17 | 18 | add_executable(myproject main.cpp mainwindow.cpp) 19 | qt5_use_modules(myproject Widgets) 20 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.coffee: -------------------------------------------------------------------------------- 1 | grade = (student, period=(if b? then 7 else 6)) -> 2 | if student.excellentWork 3 | "A+" 4 | else if student.okayStuff 5 | if student.triedHard then "B" else "B-" 6 | else 7 | "C" 8 | 9 | class Animal extends Being 10 | constructor: (@name) -> 11 | 12 | move: (meters) -> 13 | alert @name + " moved #{meters}m." -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main(int argc, char *argv[]) { 8 | 9 | /* An annoying "Hello World" example */ 10 | for (auto i = 0; i < 0xFFFF; i++) 11 | cout << "Hello, World!" << endl; 12 | 13 | char c = '\n'; 14 | unordered_map> m; 15 | m["key"] = "\\\\"; // this is an error 16 | 17 | return -2e3 + 12l; 18 | } -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cr: -------------------------------------------------------------------------------- 1 | class Person 2 | def initialize(@name : String) 3 | end 4 | 5 | def greet 6 | puts "Hi, I'm #{@name}" 7 | end 8 | end 9 | 10 | class Employee < Person 11 | end 12 | 13 | employee = Employee.new "John" 14 | employee.greet # => "Hi, I'm John" 15 | employee.is_a?(Person) # => true 16 | 17 | @[Link("m")] 18 | lib C 19 | # In C: double cos(double x) 20 | fun cos(value : Float64) : Float64 21 | end 22 | 23 | C.cos(1.5_f64) # => 0.0707372 24 | 25 | s = uninitialized String 26 | s = <<-'STR' 27 | \hello\world 28 | \hello\world 29 | STR -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Compression; 2 | 3 | #pragma warning disable 414, 3021 4 | 5 | namespace MyApplication 6 | { 7 | [Obsolete("...")] 8 | class Program : IInterface 9 | { 10 | public static List JustDoIt(int count) 11 | { 12 | Console.WriteLine($"Hello {Name}!"); 13 | return new List(new int[] { 1, 2, 3 }) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: Chunkfive; src: url('Chunkfive.otf'); 3 | } 4 | 5 | body, .usertext { 6 | color: #F0F0F0; background: #600; 7 | font-family: Chunkfive, sans; 8 | } 9 | 10 | @import url(print.css); 11 | @media print { 12 | a[href^=http]::after { 13 | content: attr(href) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.dart: -------------------------------------------------------------------------------- 1 | library app; 2 | import 'dart:html'; 3 | 4 | part 'app2.dart'; 5 | 6 | /** 7 | * Class description and [link](http://dartlang.org/). 8 | */ 9 | @Awesome('it works!') 10 | class SomeClass extends BaseClass implements Comparable { 11 | factory SomeClass(num param); 12 | SomeClass._internal(int q) : super() { 13 | assert(q != 1); 14 | double z = 0.0; 15 | } 16 | 17 | /// **Sum** function 18 | int sum(int a, int b) => a + b; 19 | 20 | ElementList els() => querySelectorAll('.dart'); 21 | } 22 | 23 | String str = ' (${'parameter' + 'zxc'})'; 24 | String str = " (${true ? 2 + 2 / 2 : null})"; 25 | String str = " ($variable)"; 26 | String str = r'\nraw\'; 27 | String str = r"\nraw\"; 28 | var str = ''' 29 | Something ${2+3} 30 | '''; 31 | var str = r""" 32 | Something ${2+3} 33 | """; 34 | 35 | checkVersion() async { 36 | var version = await lookUpVersion(); 37 | } 38 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.dcl: -------------------------------------------------------------------------------- 1 | module fsieve 2 | 3 | import StdClass; // RWS 4 | import StdInt, StdReal 5 | 6 | NrOfPrimes :== 3000 7 | 8 | primes :: [Int] 9 | primes = pr where pr = [5 : sieve 7 4 pr] 10 | 11 | sieve :: Int !Int [Int] -> [Int] 12 | sieve g i prs 13 | | isPrime prs g (toInt (sqrt (toReal g))) = [g : sieve` g i prs] 14 | | otherwise = sieve (g + i) (6 - i) prs 15 | 16 | sieve` :: Int Int [Int] -> [Int] 17 | sieve` g i prs = sieve (g + i) (6 - i) prs 18 | 19 | isPrime :: [Int] !Int Int -> Bool 20 | isPrime [f:r] pr bd 21 | | f>bd = True 22 | | pr rem f==0 = False 23 | | otherwise = isPrime r pr bd 24 | 25 | select :: [x] Int -> x 26 | select [f:r] 1 = f 27 | select [f:r] n = select r (n - 1) 28 | 29 | Start :: Int 30 | Start = select [2, 3 : primes] NrOfPrimes -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.dfm: -------------------------------------------------------------------------------- 1 | TList = Class(TObject) 2 | Private 3 | Some: String; 4 | Public 5 | Procedure Inside; // Suxx 6 | End;{TList} 7 | 8 | Procedure CopyFile(InFileName, var OutFileName: String); 9 | Const 10 | BufSize = 4096; (* Huh? *) 11 | Var 12 | InFile, OutFile: TStream; 13 | Buffer: Array[1..BufSize] Of Byte; 14 | ReadBufSize: Integer; 15 | Begin 16 | InFile := Nil; 17 | OutFile := Nil; 18 | Try 19 | InFile := TFileStream.Create(InFileName, fmOpenRead); 20 | OutFile := TFileStream.Create(OutFileName, fmCreate); 21 | Repeat 22 | ReadBufSize := InFile.Read(Buffer, BufSize); 23 | OutFile.Write(Buffer, ReadBufSize); 24 | Until ReadBufSize<>BufSize; 25 | Log('File ''' + InFileName + ''' copied'#13#10); 26 | Finally 27 | InFile.Free; 28 | OutFile.Free; 29 | End;{Try} 30 | End;{CopyFile} -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.diff: -------------------------------------------------------------------------------- 1 | Index: languages/ini.js 2 | =================================================================== 3 | --- languages/ini.js (revision 199) 4 | +++ languages/ini.js (revision 200) 5 | @@ -1,8 +1,7 @@ 6 | hljs.LANGUAGES.ini = 7 | { 8 | case_insensitive: true, 9 | - defaultMode: 10 | - { 11 | + defaultMode: { 12 | contains: ['comment', 'title', 'setting'], 13 | illegal: '[^\\s]' 14 | }, 15 | 16 | *** /path/to/original timestamp 17 | --- /path/to/new timestamp 18 | *************** 19 | *** 1,3 **** 20 | --- 1,9 ---- 21 | + This is an important 22 | + notice! It should 23 | + therefore be located at 24 | + the beginning of this 25 | + document! 26 | 27 | ! compress the size of the 28 | ! changes. 29 | 30 | It is important to spell 31 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.do: -------------------------------------------------------------------------------- 1 | program define gr_log 2 | version 6.0 3 | 4 | local or = `2' 5 | local xunits = `3' 6 | local b1 = ln(`or') 7 | 8 | * make summary of logistic data from equation 9 | set obs `xunits' 10 | generate pgty = 1 - 1/(1 + exp(score)) 11 | /** 12 | * Comment 1 13 | */ 14 | reg y x 15 | * Comment 2 16 | reg y2 x //comment 3 17 | This is a `loc' $glob ${glob2} 18 | This is a `"string " "' "string`1'two${hi}" bad `"string " "' good `"string " "' 19 | 20 | //Limit to just the project ados 21 | cap adopath - SITE 22 | cap adopath - PLUS 23 | /*cap adopath - PERSONAL 24 | cap adopath - OLDPLACE*/ 25 | adopath ++ "${dir_base}/code/ado/" 26 | A string `"Wow"'. `""one" "two""' 27 | A `local' em`b'ed 28 | a global ${dir_base} $dir_base em${b}ed 29 | 30 | forval i=1/4{ 31 | if `i'==2{ 32 | cap reg y x1, robust 33 | local x = ln(4) 34 | local x =ln(4) 35 | local ln = ln 36 | } 37 | } 38 | 39 | * add mlibs in the new adopath to the index 40 | mata: mata mlib index -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | 4 | / { 5 | compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; 6 | 7 | fragment@0 { 8 | target = <&pio>; 9 | __overlay__ { 10 | apds9960_pin_irq: apds9960_pin_irq { 11 | pins = "PA10"; 12 | function = "irq"; 13 | bias-pull-up; 14 | }; 15 | }; 16 | }; 17 | 18 | fragment@1 { 19 | target = <&i2c0>; 20 | __overlay__ { 21 | #address-cells = <1>; 22 | #size-cells = <0>; 23 | apds9960@39 { 24 | compatible = "avago,apds9960"; 25 | reg = <0x39>; 26 | pinctrl-names = "default"; 27 | pinctrl-0 = <&apds9960_pin_irq>; 28 | interrupt-parent = <&pio>; 29 | interrupts = <0 10 2>; /* PA10 IRQ_TYPE_EDGE_FALLING */ 30 | status = "okay"; 31 | }; 32 | }; 33 | }; 34 | }; -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.dust: -------------------------------------------------------------------------------- 1 |

Hours

2 | 3 |
    4 | {#users} 5 |
  • {firstName}
  • {~n} 6 | {/users} 7 |
8 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.ebnf: -------------------------------------------------------------------------------- 1 | (* line comment *) 2 | 3 | rule = [optional] , symbol , { letters } , ( digit | symbol ) ; 4 | 5 | optional = ? something unnecessary ? ; (* trailing comment *) 6 | 7 | symbol = '!' | '@' | '#' | '$' | '%' | '&' | '*' ; 8 | digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; 9 | letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" 10 | | "H" | "I" | "J" | "K" | "L" | "M" | "N" 11 | | "O" | "P" | "Q" | "R" | "S" | "T" | "U" 12 | | "V" | "W" | "X" | "Y" | "Z" ; -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.elm: -------------------------------------------------------------------------------- 1 | import Html exposing (div, button, text) 2 | import Html.App exposing (beginnerProgram) 3 | import Html.Events exposing (onClick) 4 | 5 | type Msg 6 | = Increment 7 | 8 | main = 9 | beginnerProgram 10 | { model = 0, view = view 11 | , update = \Increment model -> model + 1 } 12 | 13 | view model = 14 | div [] [ div [] [ text (toString model) ] 15 | , button [ onClick Increment ] [ text "+" ] ] 16 | 17 | chars = 18 | String.cons 'C' <| String.cons 'h' <| "ars" 19 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.ep: -------------------------------------------------------------------------------- 1 | %layout 'bootstrap'; 2 | % title "Import your subs"; 3 | %= form_for '/settings/import' => (method => 'post', enctype => 'multipart/form-data') => begin 4 | %= file_field 'opmlfile' => multiple => 'true' 5 | %= submit_button 'Import', 'class' => 'btn' 6 | % end 7 |
8 | % if ($subs) { 9 |
10 | % for my $item (@$subs) { 11 | % my ($dir, $align) = ($item->{rtl}) ? ('rtl', 'right') : ('ltr', 'left'); 12 |
rss 13 | <%== $item->{title} %> 14 |
15 |
Categories 16 | %= join q{, }, sort @{ $item->{categories} || [] }; 17 |
18 |
19 | % } 20 |
21 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.erb: -------------------------------------------------------------------------------- 1 | <%# this is a comment %> 2 | 3 | <% @posts.each do |post| %> 4 |

<%= link_to post.title, post %>

5 | <% end %> 6 | 7 | <%- available_things = things.select(&:available?) -%> 8 | <%%- x = 1 + 2 -%%> 9 | <%% value = 'real string #{@value}' %%> 10 | <%%= available_things.inspect %%> 11 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.f90: -------------------------------------------------------------------------------- 1 | subroutine test_sub(k) 2 | implicit none 3 | 4 | !=============================== 5 | ! This is a test subroutine 6 | !=============================== 7 | 8 | integer, intent(in) :: k 9 | double precision, allocatable :: a(:) 10 | integer, parameter :: nmax=10 11 | integer :: i 12 | 13 | allocate (a(nmax)) 14 | 15 | do i=1,nmax 16 | a(i) = dble(i)*5.d0 17 | enddo 18 | 19 | print *, 'Hello world' 20 | write (*,*) a(:) 21 | 22 | end subroutine test_sub 23 | -------------------------------------------------------------------------------- /swh/web/tests/resources/contents/code/extensions/test.feature: -------------------------------------------------------------------------------- 1 | # language: en 2 | Feature: Addition 3 | In order to avoid silly mistakes 4 | As a math idiot 5 | I want to be told the sum of two numbers 6 | 7 | @this_is_a_tag 8 | Scenario Outline: Add two numbers 9 | * I have a calculator 10 | Given I have entered into the calculator 11 | And I have entered into the calculator 12 | When I press