-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - Large file support (finally) - New custom resize cursors - Theme transition should work better on WebKit browsers - App store caching issue fixed - Added AudioPlayer and VideoPlayer as modified versions of ImageViewer - Loading screen can be stopped if it doesn't finish in time - Proper file mappings for MP4, MOV, MKV, AVI, WebM, WAV, MPEG and MP3. Co-authored-by: Lap <[email protected]> Co-authored-by: tuck <[email protected]>
- Loading branch information
1 parent
8f41a0c
commit 6e5940d
Showing
16 changed files
with
810 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Pluto v1.4 | ||
# Pluto v1.5 | ||
|
||
![Pluto banner](assets/images/banner.svg) | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
export default { | ||
name: "Audio Player", | ||
description: "Listen to your music in this app.", | ||
ver: 1, // Compatible with core v1 | ||
type: "process", | ||
exec: async function (Root) { | ||
let wrapper; // Lib.html | undefined | ||
let MyWindow; | ||
|
||
console.log("Hello from example package", Root.Lib); | ||
|
||
Root.Lib.setOnEnd(function () { | ||
MyWindow.close(); | ||
}); | ||
const Win = (await Root.Lib.loadLibrary("WindowSystem")).win; | ||
|
||
MyWindow = new Win({ | ||
title: "Audio Player", | ||
pid: Root.PID, | ||
onclose: () => { | ||
Root.Lib.onEnd(); | ||
}, | ||
}); | ||
|
||
// initializing wrappers and vfs | ||
wrapper = MyWindow.window.querySelector(".win-content"); | ||
|
||
const vfs = await Root.Lib.loadLibrary("VirtualFS"); | ||
const FileDialog = await Root.Lib.loadLibrary("FileDialog"); | ||
|
||
await vfs.importFS(); | ||
|
||
wrapper.classList.add("with-sidebar", "row", "o-h", "h-100"); | ||
|
||
const Sidebar = await Root.Lib.loadComponent("Sidebar"); | ||
|
||
// this function opens the file and changes the title to the file name, | ||
// we load the file into a buffer | ||
async function openFile(path) { | ||
let file; | ||
if (path) file = path; | ||
else file = await FileDialog.pickFile("Root"); | ||
if (file === false) return; | ||
let result = updateAudio(await vfs.readFile(file)); | ||
if (result === false) return; | ||
MyWindow.window.querySelector(".win-titlebar .title").innerText = | ||
"Audio Player - " + file.split("/").pop(); | ||
MyWindow.focus(); | ||
} | ||
|
||
// creates sidebar | ||
Sidebar.new(wrapper, [ | ||
{ | ||
onclick: async (_) => { | ||
openFile(); | ||
}, | ||
html: Root.Lib.icons.fileAudio, | ||
title: "Select Audio...", | ||
}, | ||
{ | ||
style: { | ||
"margin-top": "auto", | ||
}, | ||
onclick: (_) => { | ||
alert("Not implemented"); | ||
}, | ||
html: Root.Lib.icons.help, | ||
title: "Help", | ||
}, | ||
]); | ||
|
||
// creates the wrapper that the image is in | ||
let vidWrapper = new Root.Lib.html("div") | ||
.class("ovh", "fg", "fc", "row") | ||
.appendTo(wrapper); | ||
|
||
// creates the actual img element | ||
let img = new Root.Lib.html("audio") | ||
.appendTo(vidWrapper) | ||
.style({ | ||
width: "100%", | ||
"object-fit": "contain", | ||
border: "none", | ||
}) | ||
.attr({ draggable: "false", controls: 'on' }); | ||
|
||
// updates the video on the next load | ||
function updateAudio(content) { | ||
if (!content.startsWith("data:audio/") && !content.startsWith("blob:")) { | ||
Root.Modal.alert("Error", "This does not look like an audio file").then( | ||
(_) => { | ||
MyWindow.focus(); | ||
} | ||
); | ||
return false; | ||
} | ||
img.elm.src = content; | ||
} | ||
|
||
return Root.Lib.setupReturns((m) => { | ||
if (typeof m === "object" && m.type && m.type === "loadFile" && m.path) { | ||
openFile(m.path); | ||
} | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.