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
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)
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.
```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).**

View file

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

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="Referrer-Policy" content="no-referrer">
<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>
<link rel="stylesheet" href="{% static "bootstrap5/css/bootstrap.min.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 %}
{% trans "Connected as" %} <code>{{ request.user.username }}</code> &middot;
{% endif %}
<a class="text-reset" href="https://gitlab.crans.org/bde/photo21/">{% trans "Source code" %}</a> &middot;
<select title="language" name="language" class="lang-select">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
<option value="{{ lang_code }}" {% if lang_code == LANGUAGE_CODE %}selected{% endif %}>
{{ lang_name }} ({{ lang_code }})
</option>
{% endfor %}
</select>
<a class="text-reset" href="https://github.com/krek0/photo21">{% trans "Source code" %}</a> &middot;
<!-- <select title="language" name="language" class="lang-select"> -->
<!-- {% get_current_language as LANGUAGE_CODE %} -->
<!-- {% get_available_languages as LANGUAGES %} -->
<!-- {% for lang_code, lang_name in LANGUAGES %} -->
<!-- <option value="{{ lang_code }}" {% if lang_code == LANGUAGE_CODE %}selected{% endif %}> -->
<!-- {{ lang_name }} ({{ lang_code }}) -->
<!-- </option> -->
<!-- {% endfor %} -->
<!-- </select> -->
<noscript><input type="submit"></noscript>
</p>
</form>

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<p>
{% blocktrans trimmed %}
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 %}
</p>
<p>
@ -25,21 +25,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endblocktrans %}
</p>
<p>
{% 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>
{% blocktrans trimmed %}
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 %}
</p>
{% endif %}
<h3>{% trans "Last galleries" %}</h3>
<div class="row mb-2">
{% 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>
<p>
{% 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,
unlike many free online platforms.
The dedicated server running this website is kindly hosted by the
<a href="https://www.crans.org/">Crans</a> at the ENS Paris-Saclay
basement.
It is not managed by the Crans. Current active administrators are:
{% endblocktrans %}
{% for user in superusers %} <code>{{ user.username }}</code>{% endfor %}.
{% trans "They should be contacted at" %}
<a href="mailto:photos@crans.org">photos@crans.org</a>.
<!-- The dedicated server running this website is kindly hosted by -->
<!-- <a href="https://sinfonie.org/">Sinfonie</a> at the ENS Rennes. -->
<!-- Current active administrators are: -->
<!-- {% endblocktrans %} -->
<!-- {% for user in superusers %} <code>{{ user.username }}</code>{% endfor %}. -->
<!-- {% trans "They should be contacted at" %} -->
<!-- <a href="mailto:photos@crans.org">photos@crans.org</a>. -->
</p>
{% endblock %}

View file

@ -34,20 +34,20 @@ lgContainer.addEventListener('lgAfterOpen', () => {
const downloadUrl = this.getAttribute('href');
// Affichage de la modale stylisée
Swal.fire({
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."),
icon: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: gettext('Download'),
cancelButtonText: gettext('Cancel'),
background: '#1a1a1a', // Optionnel : pour matcher le thème sombre de LightGallery
color: '#fff'
}).then((result) => {
if (result.isConfirmed) {
// // Affichage de la modale stylisée
// Swal.fire({
// 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."),
// icon: 'info',
// showCancelButton: true,
// confirmButtonColor: '#3085d6',
// cancelButtonColor: '#d33',
// confirmButtonText: gettext('Download'),
// cancelButtonText: gettext('Cancel'),
// background: '#1a1a1a', // Optionnel : pour matcher le thème sombre de LightGallery
// color: '#fff'
// }).then((result) => {
// if (result.isConfirmed) {
// Si validé, on déclenche le téléchargement
const link = document.createElement('a');
link.href = downloadUrl;
@ -55,8 +55,8 @@ lgContainer.addEventListener('lgAfterOpen', () => {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
});
// }
// });
}, 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.userId = document.querySelector('[name=user_id]').value;
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.photoId = 0;
return this;
@ -33,7 +34,8 @@ class lgAdmin {
document.getElementById("lg-delete").addEventListener('click', this.onDelete.bind(this));
// 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));
// Add button to restore a censored photo
@ -53,6 +55,7 @@ class lgAdmin {
const ownerId = el ? el.dataset.ownerId : null;
const canDelete = this.isStaff || (ownerId && ownerId === this.userId);
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;
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
onReport(event) {
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
const photoId = this.photoId;
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="user_id" value="{{ request.user.id }}">
<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/plugins/admin/lg-admin.js' %}"></script>
<script src="{% static 'lightgallery/plugins/hash/lg-hash.min.js' %}"></script>