@daugasauron/dolly-host-upload 0.1.5-rc.0 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abi.mjs +1 -1
- package/module.json +2 -1
- package/package.json +2 -2
- package/transport.mjs +12 -4
package/abi.mjs
CHANGED
|
@@ -14,4 +14,4 @@ export const DOLLY_UPLOAD_CHUNK_CAPACITY = 1048576;
|
|
|
14
14
|
export const DOLLY_UPLOAD_MAX_SIZE = 1073741824;
|
|
15
15
|
export const DOLLY_UPLOAD_FILE = 57;
|
|
16
16
|
export const DOLLY_ERRNO = Object.freeze({ E2BIG: 1, EACCES: 2, EADDRINUSE: 3, EADDRNOTAVAIL: 4, EAFNOSUPPORT: 5, EAGAIN: 6, EALREADY: 7, EBADF: 8, EBADMSG: 9, EBUSY: 10, ECANCELED: 11, ECHILD: 12, ECONNABORTED: 13, ECONNREFUSED: 14, ECONNRESET: 15, EDEADLK: 16, EDESTADDRREQ: 17, EDOM: 18, EDQUOT: 19, EEXIST: 20, EFAULT: 21, EFBIG: 22, EHOSTUNREACH: 23, EIDRM: 24, EILSEQ: 25, EINPROGRESS: 26, EINTR: 27, EINVAL: 28, EIO: 29, EISCONN: 30, EISDIR: 31, ELOOP: 32, EMFILE: 33, EMLINK: 34, EMSGSIZE: 35, EMULTIHOP: 36, ENAMETOOLONG: 37, ENETDOWN: 38, ENETRESET: 39, ENETUNREACH: 40, ENFILE: 41, ENOBUFS: 42, ENODEV: 43, ENOENT: 44, ENOEXEC: 45, ENOLCK: 46, ENOLINK: 47, ENOMEM: 48, ENOMSG: 49, ENOPROTOOPT: 50, ENOSPC: 51, ENOSYS: 52, ENOTCONN: 53, ENOTDIR: 54, ENOTEMPTY: 55, ENOTRECOVERABLE: 56, ENOTSOCK: 57, ENOTTY: 59, ENXIO: 60, EOVERFLOW: 61, EOWNERDEAD: 62, EPERM: 63, EPIPE: 64, EPROTO: 65, EPROTONOSUPPORT: 66, EPROTOTYPE: 67, ERANGE: 68, EROFS: 69, ESPIPE: 70, ESRCH: 71, ESTALE: 72, ETIMEDOUT: 73, ETXTBSY: 74, EXDEV: 75, ENODATA: 116, ENOTSUP: 138 });
|
|
17
|
-
export const DOLLY_UPLOAD_ABI_DIGEST = "
|
|
17
|
+
export const DOLLY_UPLOAD_ABI_DIGEST = "85e49943553075827c7c6b8a73a2c41b7a281cbd63b0a98fdce40fda8d7ebf25";
|
package/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.6",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"name": "@daugasauron/dolly-host-upload",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@daugasauron/dolly": "0.1.
|
|
7
|
+
"@daugasauron/dolly": "0.1.6"
|
|
8
8
|
},
|
|
9
9
|
"description": "Dolly's upload@0 host module: ask for a file; the user picks it.",
|
|
10
10
|
"repository": {
|
package/transport.mjs
CHANGED
|
@@ -122,10 +122,12 @@ export function chooseUploadFile(mount, controller) {
|
|
|
122
122
|
if (signal.aborted) { resolve(null); return; }
|
|
123
123
|
const dialog = document.createElement("dialog");
|
|
124
124
|
dialog.id = "file-upload";
|
|
125
|
-
|
|
125
|
+
// An adopted style sheet, which a page's style-src without 'unsafe-inline' allows.
|
|
126
|
+
const look = new CSSStyleSheet();
|
|
127
|
+
look.replaceSync(`#file-upload { color: var(--dolly-ui-color); background: var(--dolly-ui-background); border: 1px solid var(--dolly-ui-quiet);
|
|
126
128
|
max-width: calc(100vw - 2rem); font: inherit; } #file-upload::backdrop { background: #0008; }
|
|
127
|
-
#file-upload input, #file-upload button { font: inherit; }
|
|
128
|
-
|
|
129
|
+
#file-upload input, #file-upload button { font: inherit; }`);
|
|
130
|
+
dialog.innerHTML = `<form method="dialog"><p>Upload one file into Dolly</p>
|
|
129
131
|
<p>Up to ${DOLLY_UPLOAD_MAX_SIZE / 1073741824} GiB. Only the file you choose enters the sandbox.</p>
|
|
130
132
|
<input type="file" aria-label="Choose file to upload"><progress hidden></progress>
|
|
131
133
|
<output></output><button>Cancel</button></form>`;
|
|
@@ -144,7 +146,13 @@ export function chooseUploadFile(mount, controller) {
|
|
|
144
146
|
showUploadProgress(0, file.size);
|
|
145
147
|
resolve(file);
|
|
146
148
|
});
|
|
147
|
-
signal.addEventListener("abort", () => {
|
|
149
|
+
signal.addEventListener("abort", () => {
|
|
150
|
+
dialog.close();
|
|
151
|
+
dialog.remove();
|
|
152
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sheet => sheet !== look);
|
|
153
|
+
resolve(null);
|
|
154
|
+
}, { once: true });
|
|
155
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, look];
|
|
148
156
|
mount.append(dialog);
|
|
149
157
|
if (document.pointerLockElement) document.exitPointerLock();
|
|
150
158
|
dialog.showModal();
|