Skip to content

Commit

Permalink
modified: remove uninstall/switch/disable button for ComfyUI-Manager …
Browse files Browse the repository at this point in the history
…in the list

feat: support favorites list
  • Loading branch information
ltdrdata committed Sep 8, 2024
1 parent 6f2e134 commit a952009
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
1 change: 1 addition & 0 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ files=(
"alter-list.json"
"extension-node-map.json"
"github-stats.json"
"extras.json"
"node_db/new/custom-node-list.json"
"node_db/new/model-list.json"
"node_db/new/extension-node-map.json"
Expand Down
25 changes: 25 additions & 0 deletions extras.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"favorites": [
"comfyui_ipadapter_plus",
"comfyui-animatediff-evolved",
"comfyui_controlnet_aux",
"comfyui-impact-pack",
"comfyui-custom-scripts",
"comfyui-layerdiffuse",
"comfyui-liveportraitkj",
"aigodlike-comfyui-translation",
"comfyui-reactor-node",
"comfyui_instantid",
"sd-dynamic-thresholding",
"pr-was-node-suite-comfyui-47064894",
"comfyui-advancedliveportrait",
"comfyui_layerstyle",
"efficiency-nodes-comfyui",
"comfyui-crystools",
"comfyui-advanced-controlnet",
"comfyui-videohelpersuite",
"comfyui-kjnodes",
"comfy-mtb",
"comfyui_essentials"
]
}
9 changes: 9 additions & 0 deletions glob/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,15 @@ def populate_github_stats(node_packs, json_obj_github):
v['trust'] = False


def populate_favorites(node_packs, json_obj_extras):
favorites = set(json_obj_extras['favorites'])

for k, v in node_packs.items():
if v.get('version') != 'unknown':
if k in favorites:
v['is_favorite'] = True


async def restore_snapshot(snapshot_path, git_helper_extras=None):
cloned_repos = []
checkout_repos = []
Expand Down
7 changes: 5 additions & 2 deletions glob/manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,11 @@ async def fetch_customnode_list(request):
channel = core.get_config()['channel_url']

node_packs = await core.get_unified_total_nodes(channel, request.rel_url.query["mode"])
json_obj_github = await core.get_data_by_mode(request.rel_url.query["mode"], 'github-stats.json', 'default')
core.populate_github_stats(node_packs, json_obj_github)
json_obj_github = core.get_data_by_mode(request.rel_url.query["mode"], 'github-stats.json', 'default')
json_obj_extras = core.get_data_by_mode(request.rel_url.query["mode"], 'extras.json', 'default')

core.populate_github_stats(node_packs, await json_obj_github)
core.populate_favorites(node_packs, await json_obj_extras)

check_state_of_git_node_pack(node_packs, False, do_update_check=not skip_update)

Expand Down
21 changes: 19 additions & 2 deletions js/custom-nodes-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ const ShowMode = {
NORMAL: "Normal",
UPDATE: "Update",
MISSING: "Missing",
FAVORITES: "Favorites",
ALTERNATIVES: "Alternatives"
};

Expand Down Expand Up @@ -552,6 +553,10 @@ export class CustomNodesManager {
label: "Missing",
value: ShowMode.MISSING,
hasData: false
}, {
label: "Favorites",
value: ShowMode.FAVORITES,
hasData: false
}, {
label: "Alternatives of A1111",
value: ShowMode.ALTERNATIVES,
Expand Down Expand Up @@ -633,7 +638,7 @@ export class CustomNodesManager {
}

if (rowItem?.title === "ComfyUI-Manager") {
installGroups.enabled = installGroups.enabled.filter(it => it !== "disable");
installGroups.enabled = installGroups.enabled.filter(it => it !== "disable" && it !== "uninstall" && it !== "switch");
}

let list = installGroups[action];
Expand Down Expand Up @@ -1461,8 +1466,18 @@ export class CustomNodesManager {
return hashMap;
}

async getAlternatives() {
async getFavorites() {
const hashMap = {};
for(let k in this.custom_nodes) {
let item = this.custom_nodes[k];
if(item.is_favorite)
hashMap[item.hash] = true;
}

return hashMap;
}

async getAlternatives() {
const mode = manager_instance.datasrc_combo.value;
this.showStatus(`Loading alternatives (${mode}) ...`);
const res = await fetchData(`/customnode/alternatives?mode=${mode}`);
Expand Down Expand Up @@ -1545,6 +1560,8 @@ export class CustomNodesManager {
hashMap = await this.getMissingNodes();
} else if(this.show_mode == ShowMode.ALTERNATIVES) {
hashMap = await this.getAlternatives();
} else if(this.show_mode == ShowMode.FAVORITES) {
hashMap = await this.getFavorites();
}
filterItem.hashMap = hashMap;
filterItem.hasData = true;
Expand Down
10 changes: 0 additions & 10 deletions node_db/dev/custom-node-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@
"install_type": "git-clone",
"description": "Basic functionality for converting an image to ASCII art returned as a png image based on [a/ascii_magic](https://github.com/LeandroBarone/python-ascii_magic)"
},
{
"author": "AIFSH",
"title": "HivisionIDPhotos-ComfyUI",
"reference": "https://github.com/AIFSH/HivisionIDPhotos-ComfyUI",
"files": [
"https://github.com/AIFSH/HivisionIDPhotos-ComfyUI"
],
"install_type": "git-clone",
"description": "a custom node for [a/HivisionIDPhotos](https://github.com/Zeyi-Lin/HivisionIDPhotos).\nNOTE: Unsuitable for international users"
},
{
"author": "LyazS",
"title": "comfyui-nettools",
Expand Down

0 comments on commit a952009

Please sign in to comment.