From fc5f35b3887044e057367331dbc384d12522db70 Mon Sep 17 00:00:00 2001 From: Harrison Rose Date: Thu, 21 Nov 2024 02:06:53 +0000 Subject: [PATCH 1/3] on iOS, do not restrict file types for upload --- client/pages/upload/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/pages/upload/index.vue b/client/pages/upload/index.vue index 0efa1456..8bc57de5 100644 --- a/client/pages/upload/index.vue +++ b/client/pages/upload/index.vue @@ -84,7 +84,7 @@ - + @@ -127,6 +127,10 @@ export default { }) return extensions }, + isIOS() { + const ua = window.navigator.userAgent + return /iPad|iPhone|iPod/.test(ua) && !window.MSStream + }, streamLibraryItem() { return this.$store.state.streamLibraryItem }, From 268fb2ce9a29ff5acce81d030537141fca2a7bc1 Mon Sep 17 00:00:00 2001 From: Harrison Rose Date: Thu, 21 Nov 2024 04:43:03 +0000 Subject: [PATCH 2/3] on iOS, hide UI on upload page related to folder selection (since iOS Webkit does not support folder selection) --- client/pages/upload/index.vue | 8 ++++---- client/strings/en-us.json | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/pages/upload/index.vue b/client/pages/upload/index.vue index 8bc57de5..7c1b4767 100644 --- a/client/pages/upload/index.vue +++ b/client/pages/upload/index.vue @@ -34,12 +34,12 @@
-

{{ isDragging ? $strings.LabelUploaderDropFiles : $strings.LabelUploaderDragAndDrop }}

+

{{ isDragging ? $strings.LabelUploaderDropFiles : $strings.LabelUploaderDragAndDrop + (isIOS ? '' : ' ' + $strings.LabelUploaderDragAndDropOrFolders) }}

{{ $strings.MessageOr }}

{{ $strings.ButtonChooseFiles }} - {{ $strings.ButtonChooseAFolder }} + {{ $strings.ButtonChooseAFolder }}
@@ -48,7 +48,7 @@

- {{ $strings.NoteUploaderFoldersWithMediaFiles }} {{ $strings.NoteUploaderOnlyAudioFiles }} + {{ $strings.NoteUploaderFoldersWithMediaFiles }} {{ $strings.NoteUploaderOnlyAudioFiles }}

@@ -85,7 +85,7 @@ - + diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 8eb37550..e6392c0f 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -662,7 +662,8 @@ "LabelUpdateDetails": "Update Details", "LabelUpdateDetailsHelp": "Allow overwriting of existing details for the selected books when a match is located", "LabelUpdatedAt": "Updated At", - "LabelUploaderDragAndDrop": "Drag & drop files or folders", + "LabelUploaderDragAndDrop": "Drag & drop files", + "LabelUploaderDragAndDropOrFolders": "or folders", "LabelUploaderDropFiles": "Drop files", "LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series", "LabelUseAdvancedOptions": "Use Advanced Options", From 1d4e6993fc09a954b150eeaed69156559cc892c8 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 21 Nov 2024 14:56:43 -0600 Subject: [PATCH 3/3] Upload page UI updates for mobile --- client/mixins/uploadHelpers.js | 32 ++++++++++++++++---------------- client/pages/upload/index.vue | 16 ++++++++-------- client/strings/en-us.json | 4 ++-- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/client/mixins/uploadHelpers.js b/client/mixins/uploadHelpers.js index 2d7a554f..994d36c6 100644 --- a/client/mixins/uploadHelpers.js +++ b/client/mixins/uploadHelpers.js @@ -28,10 +28,8 @@ export default { var validOtherFiles = [] var ignoredFiles = [] files.forEach((file) => { - // var filetype = this.checkFileType(file.name) if (!file.filetype) ignoredFiles.push(file) else { - // file.filetype = filetype if (file.filetype === 'audio' || (file.filetype === 'ebook' && mediaType === 'book')) validItemFiles.push(file) else validOtherFiles.push(file) } @@ -165,7 +163,7 @@ export default { var firstBookPath = Path.dirname(firstBookFile.filepath) - var dirs = firstBookPath.split('/').filter(d => !!d && d !== '.') + var dirs = firstBookPath.split('/').filter((d) => !!d && d !== '.') if (dirs.length) { audiobook.title = dirs.pop() if (dirs.length > 1) { @@ -189,7 +187,7 @@ export default { var firstAudioFile = podcast.itemFiles[0] if (!firstAudioFile.filepath) return podcast // No path var firstPath = Path.dirname(firstAudioFile.filepath) - var dirs = firstPath.split('/').filter(d => !!d && d !== '.') + var dirs = firstPath.split('/').filter((d) => !!d && d !== '.') if (dirs.length) { podcast.title = dirs.length > 1 ? dirs[1] : dirs[0] } else { @@ -212,13 +210,15 @@ export default { } var ignoredFiles = itemData.ignoredFiles var index = 1 - var items = itemData.items.filter((ab) => { - if (!ab.itemFiles.length) { - if (ab.otherFiles.length) ignoredFiles = ignoredFiles.concat(ab.otherFiles) - if (ab.ignoredFiles.length) ignoredFiles = ignoredFiles.concat(ab.ignoredFiles) - } - return ab.itemFiles.length - }).map(ab => this.cleanItem(ab, mediaType, index++)) + var items = itemData.items + .filter((ab) => { + if (!ab.itemFiles.length) { + if (ab.otherFiles.length) ignoredFiles = ignoredFiles.concat(ab.otherFiles) + if (ab.ignoredFiles.length) ignoredFiles = ignoredFiles.concat(ab.ignoredFiles) + } + return ab.itemFiles.length + }) + .map((ab) => this.cleanItem(ab, mediaType, index++)) return { items, ignoredFiles @@ -259,7 +259,7 @@ export default { otherFiles.forEach((file) => { var dir = Path.dirname(file.filepath) - var findItem = Object.values(itemMap).find(b => dir.startsWith(b.path)) + var findItem = Object.values(itemMap).find((b) => dir.startsWith(b.path)) if (findItem) { findItem.otherFiles.push(file) } else { @@ -270,18 +270,18 @@ export default { var items = [] var index = 1 // If book media type and all files are audio files then treat each one as an audiobook - if (itemMap[''] && !otherFiles.length && mediaType === 'book' && !itemMap[''].itemFiles.some(f => f.filetype !== 'audio')) { + if (itemMap[''] && !otherFiles.length && mediaType === 'book' && !itemMap[''].itemFiles.some((f) => f.filetype !== 'audio')) { items = itemMap[''].itemFiles.map((audioFile) => { return this.cleanItem({ itemFiles: [audioFile], otherFiles: [], ignoredFiles: [] }, mediaType, index++) }) } else { - items = Object.values(itemMap).map(i => this.cleanItem(i, mediaType, index++)) + items = Object.values(itemMap).map((i) => this.cleanItem(i, mediaType, index++)) } return { items, ignoredFiles: ignoredFiles } - }, + } } -} \ No newline at end of file +} diff --git a/client/pages/upload/index.vue b/client/pages/upload/index.vue index 7c1b4767..441ce88e 100644 --- a/client/pages/upload/index.vue +++ b/client/pages/upload/index.vue @@ -1,20 +1,20 @@