forked from cocktailpeanut/illusion.pinokio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pinokio.js
42 lines (42 loc) · 1.45 KB
/
pinokio.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const os = require('os')
const fs = require('fs')
const path = require("path")
const exists = (filepath) => {
return new Promise(r=>fs.access(filepath, fs.constants.F_OK, e => r(!e)))
}
module.exports = {
title: "IllusionDiffusion",
description: "Generate stunning illusion artwork with StableDiffusion (A space by @angrypenguinPNGAP - created with Monster Labs QR ControlNet.",
icon: "icon.png",
menu: async (kernel) => {
let installed = await exists(path.resolve(__dirname, "env"))
if (installed) {
let session = (await kernel.loader.load(path.resolve(__dirname, "session.json"))).resolved
return [{
when: "start.json",
on: "<i class='fa-solid fa-spin fa-circle-notch'></i> Running",
type: "label",
href: "start.json"
}, {
when: "start.json",
off: "<i class='fa-solid fa-power-off'></i> Launch",
href: "start.json?fullscreen=true&run=true",
}, {
when: "start.json",
on: (session && session.url ? "<i class='fa-solid fa-rocket'></i> Open Web UI" : null),
href: (session && session.url ? session.url : null),
target: "_blank"
}, {
when: "start.json",
on: "<i class='fa-solid fa-desktop'></i> Server",
href: "start.json?fullscreen=true"
}]
} else {
return [{
html: '<i class="fa-solid fa-plug"></i> Install',
type: "link",
href: "install.json?run=true&fullscreen=true"
}]
}
}
}