Rennes rebranding

This commit is contained in:
krek0 2026-04-24 21:53:44 +02:00
parent 931c264a44
commit aa348d2b04
8 changed files with 52 additions and 54 deletions

View file

@ -1,5 +1,7 @@
# Photo server 2021-2023 # Photo server 2021-2023
This project is a fork of [Photo21](https://gitlab.crans.org/bde/photo21/) developped at ENS Paris-Saclay.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.txt) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.txt)
This is the source code for the webserver hosting pictures from the This is the source code for the webserver hosting pictures from the
@ -25,7 +27,7 @@ run and to maintain.
In production, we usually use `/var/www/photos/` as the `root` user. In production, we usually use `/var/www/photos/` as the `root` user.
```bash ```bash
git clone https://gitlab.crans.org/bde/photo21.git && cd photo21 git clone https://codeberg.org/krek0/photo21.git && cd photo21
``` ```
3. **Configuration (production only).** 3. **Configuration (production only).**

View file

@ -13,8 +13,7 @@ class CustomSignupForm(SignupForm):
# Add description on email field # Add description on email field
self.fields["email"].help_text = _( self.fields["email"].help_text = _(
"Please enter a valid email address ending with `@crans.org` or " "Please enter a valid email address ending with `@ens-rennes.fr`"
"`@ens-paris-saclay.fr`."
) )
def clean_email(self): def clean_email(self):
@ -22,10 +21,8 @@ class CustomSignupForm(SignupForm):
Check that the email address ends with a trusted domain. Check that the email address ends with a trusted domain.
""" """
email = super().clean_email() email = super().clean_email()
if not email.endswith("@crans.org") and not email.endswith( if not email.endswith("@ens-rennes.fr"):
"@ens-paris-saclay.fr"
):
raise forms.ValidationError( raise forms.ValidationError(
_("Must end with `@crans.org` or `@ens-paris-saclay.fr`.") _("Must end with `@ens-rennes.fr`.")
) )
return email return email

View file

@ -39,5 +39,5 @@ SPDX-License-Identifier: GPL-3.0-or-later
<a class="link-secondary" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a> <a class="link-secondary" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</div> </div>
</div> </div>
<p class="small text-center mt-1">{% trans "If any problem, please contact the server owners at" %} <code>photos[at]crans.org</code>.</p> <!-- <p class="small text-center mt-1">{% trans "If any problem, please contact the server owners at" %} <code>photos[at]crans.org</code>.</p> -->
{% endblock %} {% endblock %}

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'"> <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'">
<meta http-equiv="Referrer-Policy" content="no-referrer"> <meta http-equiv="Referrer-Policy" content="no-referrer">
<title>{% block title %}{{ title }}{% endblock title %} - {{ request.site.name }}</title> <title>{% block title %}{{ title }}{% endblock title %} - {{ request.site.name }}</title>
<meta name="description" content="{% trans "The ENS Paris-Saclay pictures server." %}"> <meta name="description" content="{% trans "The ENS Rennes pictures server." %}">
<script src="{% static "theme.js" %}"></script> <script src="{% static "theme.js" %}"></script>
<link rel="stylesheet" href="{% static "bootstrap5/css/bootstrap.min.css" %}"> <link rel="stylesheet" href="{% static "bootstrap5/css/bootstrap.min.css" %}">
<link rel="stylesheet" href="{% static "layout.css" %}"> <link rel="stylesheet" href="{% static "layout.css" %}">
@ -118,16 +118,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{% trans "Connected as" %} <code>{{ request.user.username }}</code> &middot; {% trans "Connected as" %} <code>{{ request.user.username }}</code> &middot;
{% endif %} {% endif %}
<a class="text-reset" href="https://gitlab.crans.org/bde/photo21/">{% trans "Source code" %}</a> &middot; <a class="text-reset" href="https://github.com/krek0/photo21">{% trans "Source code" %}</a> &middot;
<select title="language" name="language" class="lang-select"> <!-- <select title="language" name="language" class="lang-select"> -->
{% get_current_language as LANGUAGE_CODE %} <!-- {% get_current_language as LANGUAGE_CODE %} -->
{% get_available_languages as LANGUAGES %} <!-- {% get_available_languages as LANGUAGES %} -->
{% for lang_code, lang_name in LANGUAGES %} <!-- {% for lang_code, lang_name in LANGUAGES %} -->
<option value="{{ lang_code }}" {% if lang_code == LANGUAGE_CODE %}selected{% endif %}> <!-- <option value="{{ lang_code }}" {% if lang_code == LANGUAGE_CODE %}selected{% endif %}> -->
{{ lang_name }} ({{ lang_code }}) <!-- {{ lang_name }} ({{ lang_code }}) -->
</option> <!-- </option> -->
{% endfor %} <!-- {% endfor %} -->
</select> <!-- </select> -->
<noscript><input type="submit"></noscript> <noscript><input type="submit"></noscript>
</p> </p>
</form> </form>

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<p> <p>
{% blocktrans trimmed %} {% blocktrans trimmed %}
This website aims to collect the pictures and movies taken in the student This website aims to collect the pictures and movies taken in the student
life of ENS Paris-Saclay or involving its students. life of ENS Rennes or involving its students.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p> <p>
@ -25,21 +25,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p> {% if not perms.photologue.add_photo %}
{% blocktrans trimmed %}
If you want a photo to be deleted, please let us know:
<a href="mailto:photos@crans.org?subject=[ABUS] Nouvelle requête" class="btn btn-secondary btn-sm">Abuse request</a>
{% endblocktrans %}
</p>
{% if not perms.photologue.add_photo %}
<p> <p>
{% blocktrans trimmed %} {% blocktrans trimmed %}
If you want to obtain the right to upload pictures, please let us know: If you want to obtain the right to upload pictures, please let us know:
<a href="mailto:photos@crans.org?subject=[Photographe] Demande de droits photographe" class="btn btn-secondary btn-sm">Become a photograph</a> <a href="mailto:sinfonie@ens-rennes.fr?subject=[Photographe] Demande de droits photographe" class="btn btn-secondary btn-sm">Become a photograph</a>
{% endblocktrans %} {% endblocktrans %}
</p> </p>
{% endif %} {% endif %}
<h3>{% trans "Last galleries" %}</h3> <h3>{% trans "Last galleries" %}</h3>
<div class="row mb-2"> <div class="row mb-2">
{% for gallery in object_list %} {% for gallery in object_list %}
@ -52,15 +47,15 @@ SPDX-License-Identifier: GPL-3.0-or-later
<h3 class="mt-4">{% trans "Behind the scene" %}</h3> <h3 class="mt-4">{% trans "Behind the scene" %}</h3>
<p> <p>
{% blocktrans trimmed %} {% blocktrans trimmed %}
This project if a fork of <a href="https://gitlab.crans.org/bde/photo21/">Photo21</a>.
Because we value your privacy, we do not sell the data on this site, Because we value your privacy, we do not sell the data on this site,
unlike many free online platforms. unlike many free online platforms.
The dedicated server running this website is kindly hosted by the <!-- The dedicated server running this website is kindly hosted by -->
<a href="https://www.crans.org/">Crans</a> at the ENS Paris-Saclay <!-- <a href="https://sinfonie.org/">Sinfonie</a> at the ENS Rennes. -->
basement. <!-- Current active administrators are: -->
It is not managed by the Crans. Current active administrators are: <!-- {% endblocktrans %} -->
{% endblocktrans %} <!-- {% for user in superusers %} <code>{{ user.username }}</code>{% endfor %}. -->
{% for user in superusers %} <code>{{ user.username }}</code>{% endfor %}. <!-- {% trans "They should be contacted at" %} -->
{% trans "They should be contacted at" %} <!-- <a href="mailto:photos@crans.org">photos@crans.org</a>. -->
<a href="mailto:photos@crans.org">photos@crans.org</a>.
</p> </p>
{% endblock %} {% endblock %}

View file

@ -34,20 +34,20 @@ lgContainer.addEventListener('lgAfterOpen', () => {
const downloadUrl = this.getAttribute('href'); const downloadUrl = this.getAttribute('href');
// Affichage de la modale stylisée // // Affichage de la modale stylisée
Swal.fire({ // Swal.fire({
title: gettext('Download'), // title: gettext('Download'),
text: gettext("This image is free to download, but permission from the photographer and the people in the photo is required before republishing it on another website. Furthermore, it is good practice to credit L[ENS] and the photographers in any republications."), // text: gettext("This image is free to download, but permission from the photographer and the people in the photo is required before republishing it on another website. Furthermore, it is good practice to credit L[ENS] and the photographers in any republications."),
icon: 'info', // icon: 'info',
showCancelButton: true, // showCancelButton: true,
confirmButtonColor: '#3085d6', // confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33', // cancelButtonColor: '#d33',
confirmButtonText: gettext('Download'), // confirmButtonText: gettext('Download'),
cancelButtonText: gettext('Cancel'), // cancelButtonText: gettext('Cancel'),
background: '#1a1a1a', // Optionnel : pour matcher le thème sombre de LightGallery // background: '#1a1a1a', // Optionnel : pour matcher le thème sombre de LightGallery
color: '#fff' // color: '#fff'
}).then((result) => { // }).then((result) => {
if (result.isConfirmed) { // if (result.isConfirmed) {
// Si validé, on déclenche le téléchargement // Si validé, on déclenche le téléchargement
const link = document.createElement('a'); const link = document.createElement('a');
link.href = downloadUrl; link.href = downloadUrl;
@ -55,8 +55,8 @@ lgContainer.addEventListener('lgAfterOpen', () => {
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
} // }
}); // });
}, true); // Utilisation du mode capture pour intercepter avant le script interne }, true); // Utilisation du mode capture pour intercepter avant le script interne
} }
}); });

View file

@ -13,6 +13,7 @@ class lgAdmin {
this.isStaff = document.querySelector('[name=is_staff]').value === "true"; this.isStaff = document.querySelector('[name=is_staff]').value === "true";
this.userId = document.querySelector('[name=user_id]').value; this.userId = document.querySelector('[name=user_id]').value;
this.canResolveCensorship = document.querySelector('[name=can_resolve_censorship]').value === "true"; this.canResolveCensorship = document.querySelector('[name=can_resolve_censorship]').value === "true";
this.guestMode = document.querySelector('[name=guest_mode]').value === "true";
this.csrfToken = document.querySelector('[name=csrfmiddlewaretoken]').value; this.csrfToken = document.querySelector('[name=csrfmiddlewaretoken]').value;
this.photoId = 0; this.photoId = 0;
return this; return this;
@ -33,7 +34,8 @@ class lgAdmin {
document.getElementById("lg-delete").addEventListener('click', this.onDelete.bind(this)); document.getElementById("lg-delete").addEventListener('click', this.onDelete.bind(this));
// Add button to report photo // Add button to report photo
this.core.$toolbar.append(`<a href="#" id="lg-report" title="Notify abuse" class="lg-icon lg-bi-icon">${reportIcon}</a>`); this.core.$toolbar.append(`<a href="#" id="lg-report" title="Request removal" class="lg-icon lg-bi-icon">${deleteIcon}</a>`);
document.getElementById("lg-report").style.display = 'none';
document.getElementById("lg-report").addEventListener('click', this.onReport.bind(this)); document.getElementById("lg-report").addEventListener('click', this.onReport.bind(this));
// Add button to restore a censored photo // Add button to restore a censored photo
@ -53,6 +55,7 @@ class lgAdmin {
const ownerId = el ? el.dataset.ownerId : null; const ownerId = el ? el.dataset.ownerId : null;
const canDelete = this.isStaff || (ownerId && ownerId === this.userId); const canDelete = this.isStaff || (ownerId && ownerId === this.userId);
document.getElementById("lg-delete").style.display = canDelete ? 'block' : 'none'; document.getElementById("lg-delete").style.display = canDelete ? 'block' : 'none';
document.getElementById("lg-report").style.display = canDelete ? 'none' : 'block';
const isCensored = el ? el.dataset.isPublic === 'false' : false; const isCensored = el ? el.dataset.isPublic === 'false' : false;
document.getElementById("lg-restore").style.display = (this.canResolveCensorship && isCensored) ? 'block' : 'none'; document.getElementById("lg-restore").style.display = (this.canResolveCensorship && isCensored) ? 'block' : 'none';
} }
@ -135,7 +138,7 @@ class lgAdmin {
// Event called when user click on report button // Event called when user click on report button
onReport(event) { onReport(event) {
event.preventDefault(); event.preventDefault();
if(confirm("Are you sure to report this photo?")) { if(confirm("Are you sure to ask removal for this photo?")) {
// Build form request // Build form request
const photoId = this.photoId; const photoId = this.photoId;
const currentIndex = this.core.index; const currentIndex = this.core.index;

View file

@ -20,6 +20,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<input type="hidden" name="is_staff" value="{{ request.user.is_staff|yesno:'true,false' }}"> <input type="hidden" name="is_staff" value="{{ request.user.is_staff|yesno:'true,false' }}">
<input type="hidden" name="user_id" value="{{ request.user.id }}"> <input type="hidden" name="user_id" value="{{ request.user.id }}">
<input type="hidden" name="can_resolve_censorship" value="{{ can_resolve_censorship|yesno:'true,false' }}"> <input type="hidden" name="can_resolve_censorship" value="{{ can_resolve_censorship|yesno:'true,false' }}">
<input type="hidden" name="guest_mode" value="{{ guest_mode|yesno:'true,false' }}">
<script src="{% static 'lightgallery/lightgallery.min.js' %}"></script> <script src="{% static 'lightgallery/lightgallery.min.js' %}"></script>
<script src="{% static 'lightgallery/plugins/admin/lg-admin.js' %}"></script> <script src="{% static 'lightgallery/plugins/admin/lg-admin.js' %}"></script>
<script src="{% static 'lightgallery/plugins/hash/lg-hash.min.js' %}"></script> <script src="{% static 'lightgallery/plugins/hash/lg-hash.min.js' %}"></script>