Skip to content

Commit 1fba0da

Browse files
authored
[RELEASE] 4.1.0
2 parents 2907d8c + f3b8d1b commit 1fba0da

39 files changed

+2222
-518
lines changed

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ module.exports = {
4747
overrides: [
4848
{
4949
// Allow use of import & export functions
50-
files: [ "pod/main/static/js/utils.js", "pod/video/static/js/regroup_videos_by_theme.js" ],
50+
files: [
51+
"pod/main/static/js/utils.js",
52+
"pod/video/static/js/regroup_videos_by_theme.js"
53+
],
5154
parserOptions: { sourceType: "module" },
5255
}
5356
]

.github/workflows/pod_dev.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ jobs:
3030
runs-on: ubuntu-latest
3131

3232
steps:
33+
34+
- name: Free Disk Space (Ubuntu)
35+
uses: jlumbroso/free-disk-space@main
36+
with:
37+
# this might remove tools that are actually needed,
38+
# if set to "true" but frees about 6 GB
39+
tool-cache: false
40+
41+
# all of these default to true, but feel free to set to
42+
# "false" if necessary for your workflow
43+
android: true
44+
dotnet: true
45+
haskell: true
46+
large-packages: true
47+
docker-images: false
48+
swap-storage: true
49+
3350
- uses: actions/checkout@v4
3451

3552
- uses: actions/setup-node@v4

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ help:
1010
@echo "Syntax: [make target] where target is in this list:"
1111
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
1212

13+
# Affiche la doc technique de Pod v4
14+
doc:
15+
open https://esupportail.github.io/Esup-Pod/4.x/index
16+
1317
# Démarre le serveur de test
1418
start:
1519
(sleep 15 ; open http://pod.localhost:8000) &
@@ -33,17 +37,17 @@ install:
3337

3438
# Mise à jour de Pod
3539
upgrade:
36-
git pull origin master
40+
git pull origin main
3741
python3 -m pip install -r requirements.txt
3842
make updatedb
3943
make migrate
4044
make statics
4145

4246
# Création des données initiales dans la BDD SQLite intégrée
4347
createDB:
44-
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
45-
find . -path "*/migrations/*.pyc" -delete
4648
python3 manage.py delete_flatpages_migrations
49+
find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./.venv/*" -delete
50+
find . -path "*/migrations/*.pyc" -delete
4751
make updatedb
4852
make migrate
4953
python3 -Wd manage.py loaddata initial_data

pod/ai_enhancement/templates/choose_video_element.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@
122122
{{ form.media }}
123123
<script src="{% static 'ai_enhancement/js/enrich-form.js' %}?ver={{ VERSION }}"></script>
124124
<script>
125-
addEventListeners("{{ video.slug }}", "{{ video.title }}", "{{ video.description|safe }}", "{{ video.disciplines }}", "{% url 'ai_enhancement:enhance_video_json' video_slug=video.slug %}");
125+
addEventListeners("{{ video.slug }}", "{{ video.title|escapejs }}", "{{ video.description|escapejs }}", "{{ video.disciplines|escapejs }}", "{% url 'ai_enhancement:enhance_video_json' video_slug=video.slug %}");
126126
</script>
127127
{% endblock more_script %}

pod/ai_enhancement/utils.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,19 @@ def enhancement_is_ready(video: Video) -> bool:
253253
return AIEnhancement.objects.filter(video=video, is_ready=True).exists()
254254

255255

256-
def notify_user(video: Video):
256+
def notify_user(video: Video, success: bool = True):
257257
"""Notify user at the end of enhancement."""
258258
if (
259259
USE_NOTIFICATIONS
260260
and video.owner.owner.accepts_notifications
261261
and PushInformation.objects.filter(user=video.owner).exists()
262262
):
263-
send_notification_enhancement(video)
263+
send_notification_enhancement(video, success)
264264
if EMAIL_ON_ENHANCEMENT_COMPLETION:
265-
send_email_enhancement(video)
265+
send_email_enhancement(video, success)
266266

267267

268-
def send_notification_enhancement(video):
268+
def send_notification_enhancement(video, success: bool = True):
269269
"""Send push notification on video encoding or transcripting completion."""
270270
subject = "[%s] %s" % (
271271
__TITLE_SITE__,
@@ -279,6 +279,14 @@ def send_notification_enhancement(video):
279279
"content_title": video.title,
280280
"site_title": __TITLE_SITE__,
281281
}
282+
if not success:
283+
message = _(
284+
"Something went wrong with AI improvement on “%(content_title)s”."
285+
+ " Suggestions for improvement can’t be available on %(site_title)s."
286+
) % {
287+
"content_title": video.title,
288+
"site_title": __TITLE_SITE__,
289+
}
282290

283291
pwa_notify_user(
284292
video.owner,
@@ -288,30 +296,38 @@ def send_notification_enhancement(video):
288296
)
289297

290298

291-
def send_email_enhancement(video) -> None:
299+
def send_email_enhancement(video, success: bool = True) -> None:
292300
"""Send email notification on video improvement completion."""
293301
if DEBUG:
294-
logger.info("SEND EMAIL ON IA IMPROVEMENT COMPLETION")
302+
logger.info("SEND EMAIL ON AI IMPROVEMENT COMPLETION %s", success)
295303
url_scheme = "https" if SECURE_SSL_REDIRECT else "http"
296304
content_url = "%s:%s" % (url_scheme, video.get_full_url())
297305
subject = "[%s] %s" % (
298306
__TITLE_SITE__,
299-
_("IA improvement #%(content_id)s completed") % {"content_id": video.id},
307+
_("AI improvement #%(content_id)s completed") % {"content_id": video.id},
300308
)
309+
main_text = _(
310+
"AI improvement “%(content_title)s” has been completed"
311+
+ ", and is now available on %(site_title)s."
312+
) % {
313+
"content_title": "<strong>%s</strong>" % video.title,
314+
"site_title": __TITLE_SITE__,
315+
}
316+
if not success:
317+
main_text = _(
318+
"Something went wrong with AI improvement on “%(content_title)s” "
319+
+ " on %(site_title)s."
320+
) % {
321+
"content_title": "<strong>%s</strong>" % video.title,
322+
"site_title": __TITLE_SITE__,
323+
}
301324

302325
html_message = (
303326
'<p>%s</p><p>%s</p><p>%s<br><a href="%s"><i>%s</i></a>\
304327
</p><p>%s</p>'
305328
% (
306329
_("Hello,"),
307-
_(
308-
"IA improvement “%(content_title)s” has been completed"
309-
+ ", and is now available on %(site_title)s."
310-
)
311-
% {
312-
"content_title": "<strong>%s</strong>" % video.title,
313-
"site_title": __TITLE_SITE__,
314-
},
330+
main_text,
315331
_("You will find it here:"),
316332
content_url,
317333
content_url,

pod/ai_enhancement/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def toggle_webhook(request: WSGIRequest):
7272
notify_user(enhancement.video)
7373
return JsonResponse({"status": "OK"}, status=200)
7474
else:
75+
notify_user(enhancement.video, success=False)
7576
return JsonResponse(
7677
{"status": "Enhancement has not yet been successfully achieved."},
7778
status=500,

pod/authentication/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
def authentication_login(request):
2424
"""Handle authentication login attempt."""
2525
referrer = request.GET["referrer"] if request.GET.get("referrer") else "/"
26+
27+
if referrer.startswith("https:/") and not referrer.startswith("https://"):
28+
referrer = "https://" + referrer[len("https:/") :]
29+
elif referrer.startswith("http:/") and not referrer.startswith("http://"):
30+
referrer = "http://" + referrer[len("http:/") :]
31+
2632
host = (
2733
"https://%s" % request.get_host()
2834
if (request.is_secure())
2.74 KB
Binary file not shown.

0 commit comments

Comments
 (0)