From 08473aab11622a6ec2c11a626a30fb5bfc7422f5 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 11 May 2023 02:45:38 +0300 Subject: [PATCH] Fix desktop mode in finder --- resources/sys/finder/finder.js | 27 +++++++++++++++++++-------- resources/wde.js | 4 ++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/resources/sys/finder/finder.js b/resources/sys/finder/finder.js index 99b485d..4fa21b0 100644 --- a/resources/sys/finder/finder.js +++ b/resources/sys/finder/finder.js @@ -140,6 +140,25 @@ class FinderWindow{ windowElem = undefined async Init(args){ + console.log(args) + if (args[1] === "-desktop"){ + const params = new URLSearchParams({ + isMobile: WebDesktopEnvironment.isMobile, + path: args[0] + }) + const response = await fetch(`/app/${Finder.appId}/renderDesktop?` + params) + if (response.status != 200){ + WebDesktopEnvironment.Alert("Error in render desktop") //TODO + } + const html = await response.text() + args[2].innerHTML = html + + this.fileView = new FileView(args[2].querySelector(".FileTileView"), (event) =>{ + this.Click(event, true) + }) + this.RenderDir(args[0]) + return + } const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile}) const response = await fetch(`/app/${Finder.appId}/render?` + params) if (response.status != 200){ @@ -232,7 +251,6 @@ class FinderWindow{ } } - /** * @param {MouseEvent} event */ @@ -251,13 +269,6 @@ class FinderWindow{ case "blog": WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`]) break - case "personal-properties": - WebDesktopEnvironment.Open("personal-properties", [`${this.CurPath}/${fileName}`]) - break - // case "app": - // //TODO get real id - // WebDesktopEnvironment.Open("personal-properties", []) - // break; case "jpeg": case "png": WebDesktopEnvironment.Open("img-viewer", [this.CurPath + "/" + fileName]) diff --git a/resources/wde.js b/resources/wde.js index 7c28db1..678eb31 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -79,8 +79,8 @@ class WebDesktopEnvironment{ async loadWDE(){ // await WebDesktopEnvironment.load2('/Applications/Finder.app', [ "desktop", document.querySelector('#desktop-layer')]) - // WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user", "desktop", document.querySelector('#desktop-layer')]) - WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user",]) + WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user/.Desktop", "-desktop", document.querySelector('#desktop-layer')]) + // WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user",]) } /**