diff --git a/README.md b/README.md index 42b6a34..4f9e8e5 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,5 @@ The format used by Zip anon won't be supported because: Bugs ==== -- When embedding a file, 4ChanX complains about an unsupported format, but the file can still be posted just fine - Cannot expand a file that was embedded in a post that was inlined. - more to come \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index cc696da..359ce71 100644 --- a/src/main.ts +++ b/src/main.ts @@ -201,6 +201,7 @@ const startup = async () => { return; const input = document.createElement('input') as HTMLInputElement; input.setAttribute("type", "file"); + const type = file.type; input.onchange = (async ev => { if (input.files) { const proc = processors.find(e => file.name.match(e[0])); @@ -208,7 +209,15 @@ const startup = async () => { return; const buff = await proc[2](file, input.files[0]); document.dispatchEvent(new CustomEvent('QRSetFile', { - detail: { file: new Blob([buff]), name: file.name } + //detail: { file: new Blob([buff]), name: file.name, type: file.type } + detail: { file: new Blob([buff], { type }), name: file.name } + })); + document.dispatchEvent(new CustomEvent("CreateNotification", { + detail: { + type: 'success', + content: 'File successfully embedded!', + lifetime: 3 + } })); } });