admin/lang: pick only json files
Massimo Melina committed
Mar 3, 2023 at 15:29 UTC
8d1244d52fa87781145388cc2e63f33d9d69eecd
2 files changed
+3
-2
admin/src/LangPage.ts
+1
-1
@@ -71,6 +71,6 @@ export default function LangPage() {
71
await apiCall('add_langs', { langs })
72
reload()
73
toast("Loaded")
74
- })
74
+ }, { accept: '.json' })
75
}
76
}
shared/index.ts
+2
-1
@@ -101,10 +101,11 @@ export function findFirst<I=any, O=any>(a: I[], cb:(v:I)=>O): any {
101
}
102
}
103
104
-export function selectFiles(cb: (list: FileList | null)=>void, { multiple=true, folder=false }={}) {
104
+export function selectFiles(cb: (list: FileList | null)=>void, { accept='', multiple=true, folder=false }={}) {
105
const el = Object.assign(document.createElement('input'), {
106
type: 'file',
107
name: 'file',
108
+ accept,
109
multiple: multiple,
110
webkitdirectory: folder,
111
})