Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Custom exercises: a device without room for a picked file says so, instead of that the browser cannot read it

Duarte Santos3493d3fc50d5
diff --git a/frontend/src/components/CustomMediaField.jsx b/frontend/src/components/CustomMediaField.jsx
index d35452831..8c76e99c7 100644
--- a/frontend/src/components/CustomMediaField.jsx
+++ b/frontend/src/components/CustomMediaField.jsx
@@ -25,8 +25,15 @@ import Icon from './Icon.jsx'
const toast = m => useUI.getState().toast(m)
-/** The sentence for a refused file (MediaError codes from lib/media-ingest.js). */
+// A write the local store refused for room — IndexedDB's quota (Firefox names it its own way), or
+// a full phone under the file store. The file itself was fine; saying the browser cannot read it
+// would send someone looking for a different file.
+const noRoom = e => e?.name === 'QuotaExceededError' || e?.name === 'NS_ERROR_DOM_QUOTA_REACHED' || /ENOSPC|no space left/i.test(String(e?.message || ''))
+
+/** The sentence for a refused file (MediaError codes from lib/media-ingest.js), or for a device
+ * that had no room to keep it. */
export function mediaErrorText(e) {
+ if (noRoom(e)) return t('There is no room left on this device for that file.')
switch (e?.code) {
case 'type': return t('That file type is not supported — use a photo, a GIF, or an MP4, MOV or WebM video.')
case 'too-large': return t('That file is too large — up to {0} MB.', fmtMB(e.mb))
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index a923645d3..7bbebd3d6 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1611,6 +1611,7 @@ export default {
'That video is too long — up to {0} seconds.': 'هذا الفيديو طويل جدًا — الحد الأقصى {0} ثانية.',
'That photo is too large to process on this device.': 'هذه الصورة أكبر من أن تُعالَج على هذا الجهاز.',
'This browser cannot read that file.': 'لا يستطيع هذا المتصفح قراءة ذلك الملف.',
+ 'There is no room left on this device for that file.': 'لم تعد هناك مساحة على هذا الجهاز لذلك الملف.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'قد لا يعمل هذا الفيديو على كل الأجهزة — صيغة MP4 (H.264) تعمل في كل مكان.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'امتلأت مساحة الصور والفيديو الخاصة بك على الخادم ({0} من {1} م.ب).',
'The server refused the file as too large.': 'رفض الخادم الملف لأنه كبير جدًا.',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index d088637f2..1dfc132ea 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1578,6 +1578,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Dieses Video ist zu lang — höchstens {0} Sekunden.',
'That photo is too large to process on this device.': 'Dieses Foto ist zu groß, um es auf diesem Gerät zu verarbeiten.',
'This browser cannot read that file.': 'Dieser Browser kann diese Datei nicht lesen.',
+ 'There is no room left on this device for that file.': 'Auf diesem Gerät ist kein Platz mehr für diese Datei.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Dieses Video läuft womöglich nicht auf jedem Gerät — MP4 (H.264) läuft überall.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Dein Platz für Fotos und Videos auf dem Server ist voll ({0} von {1} MB).',
'The server refused the file as too large.': 'Der Server hat die Datei als zu groß abgelehnt.',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index dc40e1f98..153a47783 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Ese vídeo es demasiado largo — hasta {0} segundos.',
'That photo is too large to process on this device.': 'Esa foto es demasiado grande para procesarla en este dispositivo.',
'This browser cannot read that file.': 'Este navegador no puede leer ese archivo.',
+ 'There is no room left on this device for that file.': 'No queda espacio en este dispositivo para ese archivo.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Puede que este vídeo no se reproduzca en todos los dispositivos — MP4 (H.264) funciona en todas partes.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Tu espacio para fotos y vídeos en el servidor está lleno ({0} de {1} MB).',
'The server refused the file as too large.': 'El servidor rechazó el archivo por ser demasiado grande.',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index d67d44b0f..7c338fe1e 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Cette vidéo est trop longue — {0} secondes maximum.',
'That photo is too large to process on this device.': 'Cette photo est trop grande pour être traitée sur cet appareil.',
'This browser cannot read that file.': 'Ce navigateur ne peut pas lire ce fichier.',
+ 'There is no room left on this device for that file.': 'Il n’y a plus de place sur cet appareil pour ce fichier.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Cette vidéo risque de ne pas se lire sur tous les appareils — le MP4 (H.264) se lit partout.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Votre espace pour les photos et vidéos sur le serveur est plein ({0} sur {1} Mo).',
'The server refused the file as too large.': 'Le serveur a refusé le fichier, jugé trop volumineux.',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 8c408528f..809847488 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'यह वीडियो बहुत लंबा है — अधिकतम {0} सेकंड।',
'That photo is too large to process on this device.': 'यह फ़ोटो इस डिवाइस पर प्रोसेस करने के लिए बहुत बड़ी है।',
'This browser cannot read that file.': 'यह ब्राउज़र उस फ़ाइल को नहीं पढ़ सकता।',
+ 'There is no room left on this device for that file.': 'इस डिवाइस पर उस फ़ाइल के लिए जगह नहीं बची है।',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'यह वीडियो शायद हर डिवाइस पर न चले — MP4 (H.264) हर जगह चलता है।',
'Your photo and video space on the server is full ({0} of {1} MB).': 'सर्वर पर आपकी फ़ोटो और वीडियो की जगह भर गई है ({1} में से {0} MB)।',
'The server refused the file as too large.': 'सर्वर ने फ़ाइल को बहुत बड़ी बताकर अस्वीकार कर दिया।',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 53d61272d..46df136b8 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1561,6 +1561,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Ez a videó túl hosszú — legfeljebb {0} másodperc.',
'That photo is too large to process on this device.': 'Ez a fotó túl nagy ahhoz, hogy ezen az eszközön feldolgozható legyen.',
'This browser cannot read that file.': 'Ez a böngésző nem tudja beolvasni a fájlt.',
+ 'There is no room left on this device for that file.': 'Ezen az eszközön nincs már hely ehhez a fájlhoz.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Lehet, hogy ez a videó nem minden eszközön játszható le — az MP4 (H.264) mindenhol működik.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'A szerveren a fotóknak és videóknak szánt helyed megtelt ({0} / {1} MB).',
'The server refused the file as too large.': 'A szerver túl nagynak találta és elutasította a fájlt.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 8160437da..d7c44e41c 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Il video è troppo lungo — massimo {0} secondi.',
'That photo is too large to process on this device.': 'Questa foto è troppo grande per essere elaborata su questo dispositivo.',
'This browser cannot read that file.': 'Questo browser non riesce a leggere il file.',
+ 'There is no room left on this device for that file.': 'Su questo dispositivo non c’è più spazio per il file.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Questo video potrebbe non funzionare su tutti i dispositivi — l’MP4 (H.264) funziona ovunque.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Il tuo spazio per foto e video sul server è pieno ({0} di {1} MB).',
'The server refused the file as too large.': 'Il server ha rifiutato il file perché troppo grande.',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 3b54cc3fe..d0d185f4a 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': '동영상이 너무 깁니다 — 최대 {0}초.',
'That photo is too large to process on this device.': '이 사진은 이 기기에서 처리하기에 너무 큽니다.',
'This browser cannot read that file.': '이 브라우저는 해당 파일을 읽을 수 없습니다.',
+ 'There is no room left on this device for that file.': '이 기기에 해당 파일을 저장할 공간이 없습니다.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': '이 동영상은 일부 기기에서 재생되지 않을 수 있습니다 — MP4(H.264)는 어디서나 재생됩니다.',
'Your photo and video space on the server is full ({0} of {1} MB).': '서버의 사진·동영상 공간이 가득 찼습니다 ({0} / {1} MB).',
'The server refused the file as too large.': '파일이 너무 커서 서버가 거부했습니다.',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 2dd696d56..6ba19bf79 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Ten film jest za długi — maksymalnie {0} sekund.',
'That photo is too large to process on this device.': 'To zdjęcie jest za duże, by przetworzyć je na tym urządzeniu.',
'This browser cannot read that file.': 'Ta przeglądarka nie może odczytać tego pliku.',
+ 'There is no room left on this device for that file.': 'Na tym urządzeniu nie ma już miejsca na ten plik.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Ten film może nie działać na każdym urządzeniu — MP4 (H.264) działa wszędzie.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Twoje miejsce na zdjęcia i filmy na serwerze jest pełne ({0} z {1} MB).',
'The server refused the file as too large.': 'Serwer odrzucił plik jako zbyt duży.',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 291e5b0f9..0388df4dc 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -917,6 +917,7 @@ export const PT_BR_OVERRIDES = {
'That video is too long — up to {0} seconds.': 'Esse vídeo é longo demais — até {0} segundos.',
'That photo is too large to process on this device.': 'Essa foto é grande demais para ser processada neste dispositivo.',
'This browser cannot read that file.': 'Este navegador não consegue ler esse arquivo.',
+ 'There is no room left on this device for that file.': 'Não há mais espaço neste dispositivo para esse arquivo.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Este vídeo pode não rodar em todos os dispositivos — MP4 (H.264) funciona em qualquer lugar.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Seu espaço para fotos e vídeos no servidor está cheio ({0} de {1} MB).',
'The server refused the file as too large.': 'O servidor recusou o arquivo por ser grande demais.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index f1848240b..482e74c7b 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Esse vídeo é demasiado longo — até {0} segundos.',
'That photo is too large to process on this device.': 'Essa foto é demasiado grande para ser processada neste dispositivo.',
'This browser cannot read that file.': 'Este navegador não consegue ler esse ficheiro.',
+ 'There is no room left on this device for that file.': 'Já não há espaço neste dispositivo para esse ficheiro.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Este vídeo pode não reproduzir em todos os dispositivos — MP4 (H.264) funciona em todo o lado.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'O teu espaço para fotos e vídeos no servidor está cheio ({0} de {1} MB).',
'The server refused the file as too large.': 'O servidor recusou o ficheiro por ser demasiado grande.',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 4e03741e0..f512a50aa 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Видео слишком длинное — не дольше {0} секунд.',
'That photo is too large to process on this device.': 'Это фото слишком большое, чтобы обработать его на этом устройстве.',
'This browser cannot read that file.': 'Этот браузер не может прочитать файл.',
+ 'There is no room left on this device for that file.': 'На этом устройстве не осталось места для этого файла.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Это видео может воспроизводиться не на всех устройствах — MP4 (H.264) работает везде.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Место для фото и видео на сервере закончилось ({0} из {1} МБ).',
'The server refused the file as too large.': 'Сервер отклонил файл как слишком большой.',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index a55418112..244ee1bba 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1569,6 +1569,7 @@ export default {
'That video is too long — up to {0} seconds.': 'วิดีโอยาวเกินไป — ไม่เกิน {0} วินาที',
'That photo is too large to process on this device.': 'รูปนี้ใหญ่เกินกว่าจะประมวลผลบนอุปกรณ์นี้ได้',
'This browser cannot read that file.': 'เบราว์เซอร์นี้อ่านไฟล์นั้นไม่ได้',
+ 'There is no room left on this device for that file.': 'อุปกรณ์นี้ไม่มีพื้นที่เหลือสำหรับไฟล์นั้น',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'วิดีโอนี้อาจเล่นไม่ได้ในทุกอุปกรณ์ — MP4 (H.264) เล่นได้ทุกที่',
'Your photo and video space on the server is full ({0} of {1} MB).': 'พื้นที่รูปภาพและวิดีโอของคุณบนเซิร์ฟเวอร์เต็มแล้ว ({0} จาก {1} MB)',
'The server refused the file as too large.': 'เซิร์ฟเวอร์ปฏิเสธไฟล์เพราะใหญ่เกินไป',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 8bc2722bc..f762a5df3 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Bu video çok uzun — en fazla {0} saniye.',
'That photo is too large to process on this device.': 'Bu fotoğraf bu cihazda işlenemeyecek kadar büyük.',
'This browser cannot read that file.': 'Bu tarayıcı bu dosyayı okuyamıyor.',
+ 'There is no room left on this device for that file.': 'Bu cihazda bu dosya için yer kalmadı.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Bu video her cihazda oynamayabilir — MP4 (H.264) her yerde oynar.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Sunucudaki fotoğraf ve video alanın dolu ({0} / {1} MB).',
'The server refused the file as too large.': 'Sunucu dosyayı çok büyük olduğu için reddetti.',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index ee22c11b6..d5f45de15 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1555,6 +1555,7 @@ export default {
'That video is too long — up to {0} seconds.': 'Відео задовге — не довше {0} секунд.',
'That photo is too large to process on this device.': 'Це фото завелике, щоб обробити його на цьому пристрої.',
'This browser cannot read that file.': 'Цей браузер не може прочитати файл.',
+ 'There is no room left on this device for that file.': 'На цьому пристрої не залишилося місця для цього файлу.',
'This video may not play on every device — MP4 (H.264) plays everywhere.': 'Це відео може відтворюватися не на всіх пристроях — MP4 (H.264) працює скрізь.',
'Your photo and video space on the server is full ({0} of {1} MB).': 'Місце для фото й відео на сервері закінчилося ({0} з {1} МБ).',
'The server refused the file as too large.': 'Сервер відхилив файл як завеликий.',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index c0702d4f0..0900043d7 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1558,6 +1558,7 @@ export default {
'That video is too long — up to {0} seconds.': '视频太长——最长 {0} 秒。',
'That photo is too large to process on this device.': '照片太大,无法在此设备上处理。',
'This browser cannot read that file.': '此浏览器无法读取该文件。',
+ 'There is no room left on this device for that file.': '此设备上已没有空间存放该文件。',
'This video may not play on every device — MP4 (H.264) plays everywhere.': '此视频可能无法在所有设备上播放——MP4(H.264)在任何设备上都能播放。',
'Your photo and video space on the server is full ({0} of {1} MB).': '你在服务器上的照片和视频空间已满({0} / {1} MB)。',
'The server refused the file as too large.': '服务器因文件过大而拒绝了它。',
diff --git a/frontend/src/sheets.custom-media.test.jsx b/frontend/src/sheets.custom-media.test.jsx
index d67d1ef13..fb84b13ca 100644
--- a/frontend/src/sheets.custom-media.test.jsx
+++ b/frontend/src/sheets.custom-media.test.jsx
@@ -165,6 +165,15 @@ describe('custom exercise photo, GIF or video, and link', () => {
expect(form.querySelector('.cmf-thumb')).toBeNull()
})
+ it('a device with no room for the file says so, rather than that the file cannot be read', async () => {
+ media.put = vi.fn(async () => { throw new DOMException('The quota has been exceeded.', 'QuotaExceededError') })
+ customExSheet(null)
+ const form = renderTop()
+ await pick(form)
+ expect(useUI.getState().toastMsg).toBe('There is no room left on this device for that file.')
+ expect(form.querySelector('.cmf-thumb')).toBeNull()
+ })
+
it('says a guest keeps it on this device only, and hides Add on a server that stores no media', async () => {
customExSheet(null)
let form = renderTop()