Skip to content

Commit

Permalink
add known package list to settings
Browse files Browse the repository at this point in the history
also adds not-available cursor
  • Loading branch information
datkat21 committed Jan 23, 2024
1 parent 0a62177 commit 5c8bbbd
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 64 deletions.
4 changes: 3 additions & 1 deletion assets/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
confirm: "Confirm",
finish: "Finish",
close: "Close",
delete: "Delete",
notice: "Notice",
launchApp: "Start App",
system: "System",
Expand Down Expand Up @@ -53,7 +54,8 @@ export default {
core_appAccessControl_privilege_services: "Interact with system services",
core_appAccessControl_privilege_setLanguage: "Change the system language",
core_appAccessControl_privilege_full: "Full system access",
core_appAccessControl_privilege_desktopOnlyHostPermission: "Interact with host system integrations (only in Pluto Desktop)",
core_appAccessControl_privilege_desktopOnlyHostPermission:
"Interact with host system integrations (only in Pluto Desktop)",
core_appAccessControl_authorNote: "Author note: {note}",
core_appAccessControl_noAuthorNote: "No author note",
core_appLaunch_notification:
Expand Down
157 changes: 98 additions & 59 deletions pkgs/apps/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export default {
securityTableItemName: "Name",
securityTableItemSafe: "Safe",
securityTableItemDelete: "Delete App",
installedApplications: "Installed applications",
knownPackageList: "Loaded packages",
},
de_DE: {
thisSystem: "Dieses System",
Expand Down Expand Up @@ -182,7 +184,7 @@ export default {
useThemeWallpaper: true,
theme: "dark.theme",
sidebarType: "vertical",
dockStyle: 'full',
dockStyle: "full",
dockShowTray: true,
};

Expand Down Expand Up @@ -874,34 +876,34 @@ export default {
);

new Html("span")
.appendMany(
new Html("input")
.attr({
type: "checkbox",
id: Root.PID + "ds",
checked:
desktopConfig.dockShowTray === true ? true : null,
})
.on("input", async (e) => {
desktopConfig.dockShowTray = e.target.checked;
.appendMany(
new Html("input")
.attr({
type: "checkbox",
id: Root.PID + "ds",
checked: desktopConfig.dockShowTray === true ? true : null,
})
.on("input", async (e) => {
desktopConfig.dockShowTray = e.target.checked;

Html.qs(".desktop .dock").classOn("hiding");
Html.qs(".desktop .dock").classOn("hiding");

setTimeout(() => {
// a bit hacky to do the animation
Html.qs(".desktop .dock").classOff("hiding");
document.documentElement.dataset.dockShowTray = e.target.checked;
}, 600);
setTimeout(() => {
// a bit hacky to do the animation
Html.qs(".desktop .dock").classOff("hiding");
document.documentElement.dataset.dockShowTray =
e.target.checked;
}, 600);

save();
}),
new Html("label")
.attr({
for: Root.PID + "ds",
})
.text(Root.Lib.getString("dockShowTray"))
)
.appendTo(container);
save();
}),
new Html("label")
.attr({
for: Root.PID + "ds",
})
.text(Root.Lib.getString("dockShowTray"))
)
.appendTo(container);

const languageSelectSpan = new Html("span")
.class("row", "ac", "js", "gap")
Expand Down Expand Up @@ -1011,49 +1013,86 @@ export default {
async applications() {
await this.clear("applications");
makeHeading("h1", Root.Lib.getString("applications"));

new Html("span")
.class("h2", "mt-1")
.text(Root.Lib.getString("installedApplications"))
.appendTo(container);

let installedApps = (await vfs.list("Root/Pluto/apps"))
.filter((p) => p.type === "file" && p.item.endsWith(".app"))
.map((i) => i.item);
console.log(installedApps);
if (installedApps.length > 0) {
installedApps.forEach(async (e) => {
let splitE = e.split(".");
let name = splitE[0];
let extension = splitE[1];
console.log(name, extension);

const a = (
await import(
`data:text/javascript;base64,${btoa(
await vfs.readFile(`Root/Pluto/apps/${name}.app`)
)}`
)
).default;
console.log(a);

Card.new(
container,
new Html("div").class("flex-group", "col").appendMany(
new Html("span").class("h2").text(a.name), // Actual name
new Html("code")
.class("label")
.style({
"margin-top": "-4px",
})
.text(`${name}.app`), // Type
// Filename and Version
new Html("span").text(a.description), // Description
new Html("span")
.class("label-light")
.text(`(supports core ${a.ver})`) //
)
);
});
await Promise.all(
installedApps.map(async (e) => {
let splitE = e.split(".");
let name = splitE[0];
let extension = splitE[1];
console.log(name, extension);

const a = (
await import(
`data:text/javascript;base64,${btoa(
await vfs.readFile(`Root/Pluto/apps/${name}.app`)
)}`
)
).default;

if (a === undefined) return false;

console.log(a);

Card.new(
container,
new Html("div").class("flex-group", "col").appendMany(
new Html("span").class("h2").text(a.name), // Actual name
new Html("code")
.class("label")
.style({
"margin-top": "-4px",
})
.text(`${name}.app`), // Type
// Filename and Version
new Html("span").text(a.description), // Description
new Html("span")
.class("label-light")
.text(`(supports core ${a.ver})`) //
)
);
})
);
} else {
new Html("span")
.text(Root.Lib.getString("noInstalledApps"))
.appendTo(container);
}

new Html("span")
.class("h2", "mt-1")
.text(Root.Lib.getString("knownPackageList"))
.appendTo(container);

Root.Core.knownPackageList.forEach((p, i) => {
new Html("hr").appendTo(container);

new Html("div")
.class("flex-group", "col")
.appendMany(
new Html("span")
.class("flex-group", "gap", "js", "ac")
.appendMany(
new Html("span")
.styleJs({ fontWeight: "bold" })
.text(p.pkg.name),
new Html("span").class("badge").text(p.pkg.type)
),
new Html("span")
.styleJs({ fontWeight: "normal" })
.text(p.pkg.description)
)
.appendTo(container);
});
},
async security() {
async function performSecurityScan() {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/lib/CodeScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ let C = {};
let vfs = {};

export default {
name: "Test library",
description: "Example baseplate library",
name: "Code Scanner",
description: "Scans application files for dangerous code.",
ver: 1, // Compatible with core v1
type: "library",
init: async (l, c) => {
Expand Down
Loading

0 comments on commit 5c8bbbd

Please sign in to comment.