mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Fixes: #1358 - Refresh the apt cache if required packages for an app are not found and if the cache is more than 1 hour old (or non-existent). - If required packages are found, don't refresh the package cache even if the cache is outdated. This is because the check operation could lead to many minutes of waiting before app can be installed. Tests: - Remove /var/lib/apt/lists/* and /var/cache/apt/pkgcache.bin. Visit an app setup page. apt cache is updated and it take a while to check that the app is available. App is shown as available. If page is refreshed, this time, the cache is not updated. - Set the modification of /var/cache/apt/pkgcache.bin file to more than 2 hours ago with 'touch -d "2 hours ago" /var/cache/apt/pkgcache.bin'. Then refreshing the page will not refresh the cache. - Repeat test with an app that is not available such as Janus. Again apt cache is refreshed. App is shown as not available. On refresh, the cache is not updated. - Set the modification of /var/cache/apt/pkgcache.bin file to more than 2 hours ago with 'touch -d "2 hours ago" /var/cache/apt/pkgcache.bin'. Then refreshing the page will not refresh the cache. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net> - Remove redundant if condition in setup.html template - Use JavaScript fetch() API instead of XMLHTTPRequest class - Update a comment in test_package.py Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
99 lines
3.0 KiB
HTML
99 lines
3.0 KiB
HTML
{% extends "base.html" %}
|
|
{% comment %}
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
{% endcomment %}
|
|
|
|
{% load bootstrap %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
|
|
{% block content %}
|
|
|
|
{% include "app-header.html" with setup=True %}
|
|
|
|
{% include "toolbar.html" %}
|
|
|
|
{% if setup_state.value == 'up-to-date' %}
|
|
|
|
<div class="app-just-installed">
|
|
{% trans "Application installed." %}
|
|
</div>
|
|
|
|
{% elif not operations %}
|
|
|
|
<p>
|
|
{% if setup_state.value == 'needs-setup' %}
|
|
{% blocktrans trimmed %}
|
|
Install this application?
|
|
{% endblocktrans %}
|
|
{% elif setup_state.value == 'needs-update' %}
|
|
{% blocktrans trimmed %}
|
|
This application needs an update. Update now?
|
|
{% endblocktrans %}
|
|
{% endif %}
|
|
</p>
|
|
|
|
<div class="app-unavailable d-none">
|
|
<div class="alert alert-warning d-flex align-items-center" role="alert">
|
|
<div class="me-2">
|
|
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
|
|
<span class="visually-hidden">{% trans "Caution:" %}</span>
|
|
</div>
|
|
<div>
|
|
{% blocktrans trimmed %}
|
|
This application is currently not available in your distribution.
|
|
{% endblocktrans %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p class="app-checking-availability d-none" data-app-id="{{ app_id }}"
|
|
data-setup-state="{{ setup_state.value }}">
|
|
{% blocktrans trimmed %}
|
|
Checking app availability...
|
|
{% endblocktrans %}
|
|
<span class="spinner-border spinner-border-sm" role="status"></span>
|
|
</p>
|
|
<p class="app-checking-availability-error d-none">
|
|
{% blocktrans trimmed %}
|
|
Error checking app availability. Please refresh page.
|
|
{% endblocktrans %}
|
|
</p>
|
|
|
|
<form class="form-install" action="" method="post">
|
|
{% csrf_token %}
|
|
|
|
{% if package_conflicts and package_conflicts_action.value != 'ignore' %}
|
|
<div class="alert alert-warning d-flex align-items-center" role="alert">
|
|
<div class="me-2">
|
|
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
|
|
<span class="visually-hidden">{% trans "Caution:" %}</span>
|
|
</div>
|
|
<div>
|
|
{% blocktrans trimmed %}
|
|
<strong>Conflicting Packages:</strong> Some packages installed on
|
|
the system conflict with the installation of this app. The following
|
|
packages will be removed if you proceed:
|
|
{% endblocktrans %}
|
|
{% for package in package_conflicts %}
|
|
{{ package }}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<input type="submit" class="btn btn-md btn-primary install-button"
|
|
name="install"
|
|
{% if setup_state.value == 'needs-setup' %}
|
|
value="{% trans "Install" %}"
|
|
{% elif setup_state.value == 'needs-update' %}
|
|
value="{% trans "Update" %}"
|
|
{% endif %} />
|
|
|
|
</form>
|
|
|
|
{% else %}
|
|
{% include "operations.html" %}
|
|
{% endif %}
|
|
|
|
{% endblock %}
|