satis icon indicating copy to clipboard operation
satis copied to clipboard

Remove links to packages from HTML

Open sonecms opened this issue 4 years ago • 2 comments

Tell me how you can remove active links from the package versions so that the user cannot download them. I found the following line in the package.html.twig file:

                {%- if package.highest.type == 'metapackage' -%}
                {{ version.prettyVersion }}
                {%- elseif version.distType -%}
                <a class="badge badge-pill badge-secondary" href="{{ version.distUrl }}" title="dist-reference: {{ version.distReference }}{{ branch_alias }}">{{ version.prettyVersion }}</a>
                {%- elseif version.sourceUrl matches '#^https?:\/\/#' -%}
                <a class="badge badge-pill badge-secondary"  href="{{ version.sourceUrl }}" title="source-reference: {{ version.sourceReference }}{{ branch_alias }}">{{ version.prettyVersion }}</a>
                {%- else -%}
                <span class="badge badge-pill badge-secondary"  title="source-reference: {{ version.sourceReference }}{{ branch_alias }}">{{ version.prettyVersion }}</span>
                {%- endif -%}

Is there any section in the satis.json responsible for this?

sonecms avatar Jul 29 '21 08:07 sonecms

Satis just uses the template file. So if you modify the template.. :shrug:

alcohol avatar Jul 29 '21 13:07 alcohol

remove the if statements and keep {{ version.prettyVersion }} only or replace the section with the following code to show a bill shape instead of the version text only:

  <dd class="{{ col2_class }} field-releases filter-by" data-package-name="{{ package.highest.name }}">
        {% for version in package.versions %}

        {% set branch_alias = attribute(version.extra['branch-alias'], version.prettyVersion) %}
        {%- if branch_alias -%}
        {% set branch_alias = ", branch-alias: " ~ branch_alias %}
        {%- endif -%}

        <span class="badge rounded-pill bg-secondary text-light" title="source-reference: {{ version.sourceReference }}{{ branch_alias }}">{{ version.prettyVersion }}</span>

        {% endfor %}
   </dd>

moneef avatar Jul 10 '23 00:07 moneef