jorisvaneyghen commited on
Commit
3c021b8
·
1 Parent(s): 57628a7

fix: file input fallback when app is embedded with iframe

Browse files
Files changed (2) hide show
  1. index.html +12 -20
  2. sw.js +1 -1
index.html CHANGED
@@ -948,27 +948,19 @@
948
  }
949
 
950
  async openFileWithFileSystemAPI() {
951
- try {
952
- const [fileHandle] = await window.showOpenFilePicker({
953
- types: [{
954
- description: 'Audio Files',
955
- accept: {
956
- 'audio/*': ['.mp3', '.wav', '.aac', '.ogg', '.flac', '.m4a']
957
- }
958
- }],
959
- multiple: false
960
- });
961
-
962
- const file = await fileHandle.getFile();
963
- const fileId = await this.saveFileHandle(fileHandle, file.name, file.size);
964
- await this.handleAudioFile(file, fileId);
965
 
966
- } catch (error) {
967
- if (error.name !== 'AbortError') {
968
- console.error('Error opening file:', error);
969
- alert('Error opening file. Please try again.');
970
- }
971
- }
972
  }
973
 
974
  async loadFileFromHandle(fileId) {
 
948
  }
949
 
950
  async openFileWithFileSystemAPI() {
951
+ const [fileHandle] = await window.showOpenFilePicker({
952
+ types: [{
953
+ description: 'Audio Files',
954
+ accept: {
955
+ 'audio/*': ['.mp3', '.wav', '.aac', '.ogg', '.flac', '.m4a']
956
+ }
957
+ }],
958
+ multiple: false
959
+ });
 
 
 
 
 
960
 
961
+ const file = await fileHandle.getFile();
962
+ const fileId = await this.saveFileHandle(fileHandle, file.name, file.size);
963
+ await this.handleAudioFile(file, fileId);
 
 
 
964
  }
965
 
966
  async loadFileFromHandle(fileId) {
sw.js CHANGED
@@ -1,5 +1,5 @@
1
  // Use a version that you can update with each release
2
- const APP_VERSION = '0.1.11';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache
 
1
  // Use a version that you can update with each release
2
+ const APP_VERSION = '0.1.12';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache