Browse Source

Fix 4chanX complaint, add notification when operation succeeds/fails

pull/7/head
coomdev 2 years ago
parent
commit
bcbcec6b97
  1. 1
      README.md
  2. 11
      src/main.ts

1
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

11
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
}
}));
}
});

Loading…
Cancel
Save