File size: 641 Bytes
bee6636
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { ScramjetClient } from "../client";

export default function (client: ScramjetClient) {
	client.Proxy("StorageManager.prototype.getDirectory", {
		apply(ctx) {
			const rootPromise = ctx.call() as Promise<FileSystemDirectoryHandle>;
			ctx.return(
				(async () => {
					const root = await rootPromise;
					const directory = await root.getDirectoryHandle(
						`${client.url.origin.replace(/\/|\s|\./g, "-")}`,
						{
							create: true,
						}
					);
					Object.defineProperty(directory, "name", {
						value: "",
						writable: false,
					});

					return directory;
				})()
			);
		},
	});
}