Skip to content

Commit 8c4bff4

Browse files
committed
Disable compatibility with Google Drive, because it blocks direct downloads from web applications.
1 parent 3491a22 commit 8c4bff4

6 files changed

Lines changed: 31 additions & 16 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The application runs entirely in your browser. When you load a file from your de
1414

1515
- Load `.zip` or `.elpx` files from your device (drag and drop or file browser)
1616
- Load content from a URL (direct links to `.zip` or `.elpx` files)
17-
- Support for shared links from Nextcloud, ownCloud and Google Drive
17+
- Support for shared links from Nextcloud or ownCloud
1818
- Generate shareable links when viewing URL-loaded content
1919
- In-memory extraction (no files written to disk)
2020
- Full navigation support for HTML, CSS, JavaScript, images, and media
@@ -42,7 +42,6 @@ The file never leaves your device. All processing happens in your browser.
4242
This works with:
4343
- Direct links to files on any server
4444
- Shared links from Nextcloud and ownCloud
45-
- Shared links from Google Drive
4645

4746
### Downloading and sharing content
4847

@@ -52,7 +51,7 @@ When you load content from a URL, two buttons appear in the top bar:
5251

5352
**This solves a common problem**: many eXeLearning users create content but don’t have a place to publish it. With eXeViewer:
5453

55-
1. Upload your `.zip` or `.elpx` file to a cloud service (Nextcloud, ownCloud, Google Drive, or any file hosting)
54+
1. Upload your `.zip` or `.elpx` file to a cloud service (Nextcloud, ownCloud, or any file server)
5655
2. Generate a share link from your cloud service
5756
3. Paste the link in eXeViewer
5857
4. Click the "Share" button to get a viewer URL

README_es.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ La aplicación se ejecuta completamente en tu navegador. Cuando cargas un ficher
1414

1515
- Carga ficheros `.zip` o `.elpx` desde tu dispositivo (arrastrándolos o seleccionándolos)
1616
- Carga contenido desde una URL (enlaces directos a ficheros `.zip` o `.elpx`)
17-
- Admite enlaces compartidos de Nextcloud, ownCloud y Google Drive
17+
- Admite enlaces compartidos de Nextcloud y ownCloud
1818
- Genera enlaces para compartir cuando visualizas contenido cargado desde URL
1919
- Extracción en memoria (no se escribe nada en disco)
2020
- Navegación completa con soporte para HTML, CSS, JavaScript, imágenes y multimedia
@@ -42,7 +42,6 @@ El fichero nunca sale de tu dispositivo. Todo el procesamiento ocurre en tu nave
4242
Funciona con:
4343
- Enlaces directos a ficheros .zip o .elpx en cualquier servidor
4444
- Enlaces compartidos de Nextcloud y ownCloud
45-
- Enlaces compartidos de Google Drive
4645

4746
### Descargar y compartir contenido
4847

@@ -52,7 +51,7 @@ Cuando cargas contenido desde una URL, aparecen dos botones en la barra superior
5251

5352
**Esto resuelve un problema común**: muchos usuarios de eXeLearning crean contenido pero no tienen dónde publicarlo. Con eXeViewer:
5453

55-
1. Sube tu fichero `.zip` o `.elpx` a un servicio en la nube (Nextcloud, ownCloud, Google Drive o cualquier alojamiento de ficheros)
54+
1. Sube tu fichero `.zip` o `.elpx` a un servicio en la nube (Nextcloud, ownCloud o cualquier servidor)
5655
2. Genera un enlace para compartir desde tu servicio en la nube
5756
3. Pega el enlace en eXeViewer
5857
4. Haz clic en el botón "Compartir" para obtener una URL del visor

js/app.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,14 @@
524524

525525
// Google Drive: convert /view to direct download
526526
// Format: https://drive.google.com/file/d/FILE_ID/view?usp=sharing
527-
// Convert to: https://drive.google.com/uc?export=download&id=FILE_ID
527+
// Convert to: https://drive.usercontent.google.com/download?id=FILE_ID&export=download&confirm=t
528+
// Note: drive.usercontent.google.com is Google's dedicated download domain
529+
// The confirm=t parameter bypasses the virus scan warning for large files
528530
if (urlObj.hostname === 'drive.google.com') {
529531
const match = url.match(/\/file\/d\/([^/]+)/);
530532
if (match && match[1]) {
531533
const fileId = match[1];
532-
return `https://drive.google.com/uc?export=download&id=${fileId}`;
534+
return `https://drive.usercontent.google.com/download?id=${fileId}&export=download&confirm=t`;
533535
}
534536
}
535537

@@ -662,16 +664,26 @@
662664
const downloadUrl = convertToDirectDownloadUrl(url.trim());
663665
console.log('[App] Downloading from:', downloadUrl);
664666

667+
// Check if this is a Google Drive URL
668+
// Google Drive blocks CORS and public proxies, so we only try direct fetch
669+
const isGoogleDrive = url.includes('drive.google.com') || url.includes('drive.usercontent.google.com');
670+
665671
let response;
666672
let usedProxy = false;
667673

668-
// Try direct fetch first, then fallback to CORS proxy
674+
// Try direct fetch first, then fallback to CORS proxy (except for Google Drive)
669675
try {
670676
response = await fetchWithCorsProxy(downloadUrl, false);
671677
if (!response.ok) {
672678
throw new Error('Direct fetch failed');
673679
}
674680
} catch (directError) {
681+
// For Google Drive, don't try proxies - they are blocked
682+
// Show specific error message immediately
683+
if (isGoogleDrive) {
684+
throw new Error('GOOGLE_DRIVE_BLOCKED');
685+
}
686+
675687
console.log('[App] Direct fetch failed, trying CORS proxy...');
676688
usedProxy = true;
677689
response = await fetchWithCorsProxy(downloadUrl, true);
@@ -758,8 +770,11 @@
758770
} catch (error) {
759771
console.error('[App] Error downloading from URL:', error);
760772

761-
// Handle network errors
762-
if (error.name === 'TypeError' && error.message.includes('fetch')) {
773+
if (error.message === 'GOOGLE_DRIVE_BLOCKED') {
774+
// Google Drive blocks CORS and public proxies, suggest manual download
775+
showError(i18n.t('errors.googleDriveBlocked'));
776+
} else if (error.name === 'TypeError' && error.message.includes('fetch')) {
777+
// Handle network errors
763778
showError(i18n.t('errors.networkError'));
764779
} else {
765780
showError(error.message || i18n.t('errors.downloadFailed'));

lang/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dragDrop": "Drag and drop your <strong>.zip</strong> or <strong>.elpx</strong> file here",
88
"or": "or",
99
"browseFiles": "Browse Files",
10-
"loadFromUrl": "Load from URL (supports Nextcloud, ownCloud, and Google Drive links)",
10+
"loadFromUrl": "Load from URL (supports Nextcloud and ownCloud links)",
1111
"shareHint": "You will be able to generate a direct link to share the content.",
1212
"urlPlaceholder": "https://example.com/content.zip",
1313
"loadUrl": "Load",
@@ -48,7 +48,8 @@
4848
"notAZipFile": "Could not process the file. It may not be a valid .zip or .elpx file.",
4949
"notExeContent": "The file does not appear to be an eXeLearning package. Please select a valid .zip or .elpx file exported from eXeLearning.",
5050
"storageQuotaExceeded": "The file is too large for your browser's storage limit. Try closing other tabs or clearing browser data.",
51-
"storageQuotaWarning": "The file ({fileSize}) may exceed available storage ({available}). Saving might fail."
51+
"storageQuotaWarning": "The file ({fileSize}) may exceed available storage ({available}). Saving might fail.",
52+
"googleDriveBlocked": "Google Drive blocks direct downloads from web applications. Please download the file from Google Drive, then drag and drop it here."
5253
},
5354
"accessibility": {
5455
"loading": "Loading...",

lang/es.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dragDrop": "Arrastra y suelta tu archivo <strong>.zip</strong> o <strong>.elpx</strong> aquí",
88
"or": "o",
99
"browseFiles": "Selecciona el fichero",
10-
"loadFromUrl": "Cargar desde URL (admite enlaces de Nextcloud, ownCloud y Drive)",
10+
"loadFromUrl": "Cargar desde URL (admite enlaces de Nextcloud y ownCloud)",
1111
"shareHint": "Podrás generar un enlace directo para compartir el contenido.",
1212
"urlPlaceholder": "https://ejemplo.com/contenido.zip",
1313
"loadUrl": "Cargar",
@@ -48,7 +48,8 @@
4848
"notAZipFile": "No se pudo procesar el archivo. Tal vez no sea un archivo .zip o .elpx válido.",
4949
"notExeContent": "No parece un contenido generado con eXeLearning. Selecciona un .zip o .elpx válido exportado desde eXeLearning.",
5050
"storageQuotaExceeded": "El archivo es demasiado grande para el límite de tu navegador. Intenta cerrar otras pestañas o borrar datos de navegación.",
51-
"storageQuotaWarning": "El archivo ({fileSize}) podría exceder el almacenamiento disponible ({available}). El guardado podría fallar."
51+
"storageQuotaWarning": "El archivo ({fileSize}) podría exceder el almacenamiento disponible ({available}). El guardado podría fallar.",
52+
"googleDriveBlocked": "Google Drive bloquea las descargas directas desde aplicaciones web. Descarga el archivo desde Google Drive y arrástralo aquí."
5253
},
5354
"accessibility": {
5455
"loading": "Cargando...",

sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Handles PWA caching and serves extracted ZIP content from memory/IndexedDB
44
*/
55

6-
const SW_VERSION = '1.7.0';
6+
const SW_VERSION = '1.0.0';
77
const CACHE_NAME = `exeviewer-v${SW_VERSION}`;
88

99
// IndexedDB configuration

0 commit comments

Comments
 (0)