Browse Source

Expose the documents directory in the user home

Alessandro Pignotti 8 tháng trước cách đây
mục cha
commit
ce162c9e8c
4 tập tin đã thay đổi với 14 bổ sung2 xóa
  1. 5 0
      documents/Welcome.txt
  2. 1 0
      documents/index.list
  3. 6 1
      src/lib/WebVM.svelte
  4. 2 1
      vite.config.js

+ 5 - 0
documents/Welcome.txt

@@ -0,0 +1,5 @@
+Welcome to WebVM: A complete desktop environment running in the browser
+
+WebVM is powered by CheerpX: a x86-to-WebAssembly virtualization engine and Just-in-Time compiler
+
+For more info: https://cheerpx.io

+ 1 - 0
documents/index.list

@@ -0,0 +1 @@
+Welcome.txt

+ 6 - 1
src/lib/WebVM.svelte

@@ -261,6 +261,7 @@
 		blockCache = await CheerpX.IDBDevice.create(cacheId);
 		var overlayDevice = await CheerpX.OverlayDevice.create(blockDevice, blockCache);
 		var webDevice = await CheerpX.WebDevice.create("");
+		var documentsDevice = await CheerpX.WebDevice.create("documents");
 		var dataDevice = await CheerpX.DataDevice.create();
 		var mountPoints = [
 			// The root filesystem, as an Ext2 image
@@ -271,8 +272,12 @@
 			{type:"dir", dev:dataDevice, path:"/data"},
 			// Automatically created device files
 			{type:"devs", path:"/dev"},
+			// Pseudo-terminals
+			{type:"devpts", path:"/dev/pts"},
 			// The Linux 'proc' filesystem which provides information about running processes
-			{type:"proc", path:"/proc"}
+			{type:"proc", path:"/proc"},
+			// Convenient access to sample documents in the user directory
+			{type:"dir", dev:documentsDevice, path:"/home/user/documents"}
 		];
 		try
 		{

+ 2 - 1
vite.config.js

@@ -20,7 +20,8 @@ export default defineConfig({
 				{ src: 'scrollbar.css', dest: '' },
 				{ src: 'serviceWorker.js', dest: '' },
 				{ src: 'login.html', dest: '' },
-				{ src: 'assets/', dest: '' }
+				{ src: 'assets/', dest: '' },
+				{ src: 'documents/', dest: '' }
 			]
 		})
 	]