Fix desktop mode in finder

This commit is contained in:
cyber-dream 2023-05-11 02:45:38 +03:00
parent 6dc162f3ff
commit 08473aab11
2 changed files with 21 additions and 10 deletions

View File

@ -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])

View File

@ -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",])
}
/**