Merge pull request #4 from cocktailpeanut/master

Pinokio 1.0 Support + Minor addition
This commit is contained in:
Henry Ruhs
2024-01-04 22:20:44 +01:00
committed by GitHub
3 changed files with 123 additions and 83 deletions
+112 -76
View File
@@ -1,3 +1,4 @@
const path = require('path')
module.exports = async kernel =>
{
const hasEnv = await kernel.exists(__dirname, 'facefusion', 'env');
@@ -9,82 +10,117 @@ module.exports = async kernel =>
{
if (kernel.running(__dirname, 'start.js'))
{
const session = await kernel.require(__dirname, 'session.json');
menu =
[
{
icon: 'fa-solid fa-spin fa-circle-notch',
text: 'Running ' + session.mode
},
{
icon: 'fa-solid fa-desktop',
text: 'Server',
href: 'start.js',
params:
{
fullscreen: true
}
}
];
if (session && session.url)
{
menu.push(
{
icon: 'fa-solid fa-rocket',
text: 'Open session',
href: session.url,
target: '_blank'
});
}
return menu;
}
menu =
[
{
icon: 'fa-solid fa-power-off',
text: 'Launch default',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Default'
}
},
{
icon: 'fa-solid fa-gauge',
text: 'Launch benchmark',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Benchmark'
}
},
{
icon: 'fa-solid fa-camera',
text: 'Launch webcam',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Webcam'
}
},
{
icon: 'fa-solid fa-rotate',
text: 'Update',
href: 'update.js',
params:
{
run: true,
fullscreen: true
}
}
];
const memory = kernel.memory.local[path.resolve(__dirname, "start.js")]
if (memory && memory.url && memory.mode)
{
menu =
[
{
icon: 'fa-solid fa-rocket',
text: 'Open session',
href: memory.url,
target: '_blank'
},
{
icon: 'fa-solid fa-desktop',
text: 'Server (' + memory.mode + ')',
href: 'start.js',
params:
{
fullscreen: true
}
}
];
}
else
{
menu =
[
{
icon: 'fa-solid fa-desktop',
text: 'Server',
href: 'start.js',
params:
{
fullscreen: true
}
}
];
}
}
else
{
menu =
[
{
icon: 'fa-solid fa-power-off',
text: 'Launch default',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Default'
}
},
{
icon: 'fa-solid fa-gauge',
text: 'Launch benchmark',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Benchmark'
}
},
{
icon: 'fa-solid fa-camera',
text: 'Launch webcam',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Webcam'
}
}
];
}
menu = menu.concat(
[
{
icon: 'fa-solid fa-rotate',
text: 'Update',
href: 'update.js',
params:
{
run: true,
fullscreen: true
}
},
{
icon: 'fa-solid fa-plug',
text: 'Install',
href: 'install.js',
params:
{
run: true,
fullscreen: true
}
},
{
icon: 'fa-regular fa-circle-xmark',
text: 'Factory Reset',
href: 'reset.js',
params:
{
run: true,
fullscreen: true
}
}
]
)
}
else
{
+8
View File
@@ -0,0 +1,8 @@
{
"run": [{
"method": "fs.rm",
"params": {
"path": "facefusion"
}
}]
}
+3 -7
View File
@@ -35,21 +35,17 @@ module.exports = () =>
}
},
{
method: 'self.set',
method: 'local.set',
params:
{
'session.json':
{
mode: '{{local.mode}}',
url: '{{input.stdout.match(/(http:\\S+)/gi)[0]}}'
}
url: '{{input.stdout.match(/(http:\\S+)/gi)[0]}}'
}
},
{
method: 'browser.open',
params:
{
uri: '{{self.session.url}}',
uri: '{{local.url}}',
target: '_blank'
}
}