leditsplusplus / pinokio.js
cocktailpeanut's picture
add reset and autostart (#4)
e8efb42 verified
module.exports = {
title: "LEDITS++",
icon: "magician.png",
description: "Limitless Image Editing using Text-to-Image Models",
menu: async (kernel) => {
let installed = await kernel.exists(__dirname, "venv")
let installing = await kernel.running(__dirname, "install.json")
if (installing) {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Installing",
href: "install.json",
params: { fullscreen: true }
}]
} else if (installed) {
let session = await kernel.require(__dirname, "session.json")
let running = await kernel.running(__dirname, "start.json")
if (running) {
if (session && session.url) {
return [{
icon: "fa-solid fa-spin fa-circle-notch",
text: "Running"
}, {
default: true,
icon: "fa-solid fa-rocket",
text: "Open Web UI",
href: session.url,
target: "_blank"
}, {
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.json",
params: { fullscreen: true }
}]
} else {
return [{
icon: "fa-solid fa-spin fa-circle-notch",
text: "Running"
}, {
default: true,
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.json",
params: { fullscreen: true }
}]
}
} else {
return [{
default: true,
icon: "fa-solid fa-power-off",
text: "Launch",
href: "start.json",
params: { fullscreen: true, run: true }
}, {
icon: "fa-regular fa-circle-xmark",
text: "Reset",
href: "reset.json",
}]
}
} else {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Install",
href: "install.json",
params: { run: true, fullscreen: true }
}]
}
}
}