Fix coding style and reset.js

This commit is contained in:
henryruhs
2024-01-04 22:25:47 +01:00
parent 62a7f1fcd9
commit b429641620
2 changed files with 132 additions and 119 deletions
+114 -112
View File
@@ -1,4 +1,5 @@
const path = require('path')
const path = require('path');
module.exports = async kernel =>
{
const hasEnv = await kernel.exists(__dirname, 'facefusion', 'env');
@@ -10,117 +11,118 @@ module.exports = async kernel =>
{
if (kernel.running(__dirname, 'start.js'))
{
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
}
}
]
)
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
{
+18 -7
View File
@@ -1,8 +1,19 @@
module.exports = () =>
{
"run": [{
"method": "fs.rm",
"params": {
"path": "facefusion"
}
}]
}
const config =
{
run:
[
{
method: 'fs.rm',
params:
{
'path': 'facefusion'
}
}
]
};
return config;
};