minimalistic-server 0.0.58 → 0.0.60
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/index.mjs +5 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1565,7 +1565,7 @@ export class Response {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
1567
|
setCookies(cookies) {
|
|
1568
|
-
this.#cookies = cookies;
|
|
1568
|
+
this.#cookies = { ...cookies };
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
addCookies(cookies) {
|
|
@@ -1883,22 +1883,22 @@ export class FileResponse extends Response {
|
|
|
1883
1883
|
<body>
|
|
1884
1884
|
${urlPath ? `<a href="/${parentUrlPath}">Up</a><hr>` : ''}
|
|
1885
1885
|
`;
|
|
1886
|
-
|
|
1887
|
-
const files = await currentFsPromiseModule.readdir(filePath);
|
|
1886
|
+
const entries = await currentFsPromiseModule.readdir(filePath, { withFileTypes: true });
|
|
1888
1887
|
let counter = 0;
|
|
1889
1888
|
|
|
1890
|
-
for (const
|
|
1889
|
+
for (const entry of entries) {
|
|
1891
1890
|
if (this.#blocked) {
|
|
1892
1891
|
break;
|
|
1893
1892
|
}
|
|
1894
1893
|
|
|
1895
1894
|
if (counter === 100) {
|
|
1896
1895
|
await new Promise(resolve => setTimeout(resolve, 50));
|
|
1896
|
+
counter = 0;
|
|
1897
1897
|
}
|
|
1898
1898
|
|
|
1899
1899
|
++counter;
|
|
1900
1900
|
|
|
1901
|
-
yield `<a href="/${urlPath}/${encodeURIComponent(
|
|
1901
|
+
yield `<a${entry.isFile ? '' : ' target="_blank"'} href="/${urlPath}/${encodeURIComponent(entry.name)}">${escapeHtml(entry.name)}</a><br>`;
|
|
1902
1902
|
}
|
|
1903
1903
|
|
|
1904
1904
|
|