feat: install pip
This commit is contained in:
25
js/common.js
25
js/common.js
@@ -80,10 +80,35 @@ export function setManagerInstance(obj) {
|
||||
}
|
||||
|
||||
function isValidURL(url) {
|
||||
if(url.includes('&'))
|
||||
return false;
|
||||
|
||||
const pattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
|
||||
return pattern.test(url);
|
||||
}
|
||||
|
||||
export async function install_pip(packages) {
|
||||
if(packages.includes('&'))
|
||||
app.ui.dialog.show(`Invalid PIP package enumeration: '${packages}'`);
|
||||
|
||||
const res = await api.fetchApi(`/customnode/install/pip?packages=${packages}`);
|
||||
|
||||
if(res.status == 200) {
|
||||
app.ui.dialog.show(`PIP package installation is processed.<br>To apply the pip packages, please click the <button id='cm-reboot-button'><font size='3px'>RESTART</font></button> button in ComfyUI.`);
|
||||
|
||||
const rebootButton = document.getElementById('cm-reboot-button');
|
||||
const self = this;
|
||||
|
||||
rebootButton.addEventListener("click", rebootAPI);
|
||||
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
}
|
||||
else {
|
||||
app.ui.dialog.show(`Failed to install '${packages}'<BR>See terminal log.`);
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
}
|
||||
}
|
||||
|
||||
export async function install_via_git_url(url, manager_dialog) {
|
||||
if(!url) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user