Skip to content

Commit d6d1dc0

Browse files
committed
cleanup code
1 parent 2046f5c commit d6d1dc0

File tree

3 files changed

+7
-122
lines changed

3 files changed

+7
-122
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Comfyui Serverless - a static comfyui serverless web interface
22

3-
Live at comfyui.nodeface.org
3+
Live at [comfyui.nodeface.org](https://comfyui.nodecafe.org/)
44

5-
more coming soon!
5+
## Credits
66

7+
Sincerely thanks to these open source projects:
8+
9+
ComfyUI: https://github.com/comfyanonymous/ComfyUI
10+
11+
ComfyUI-Manager for nodes list and install scripts reference: https://github.com/ltdrdata/ComfyUI-Manager

scanner/githubUtils.py

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,5 @@
1-
import mimetypes
21
import subprocess
32
import requests
4-
import os
5-
import shutil
6-
7-
github_key = os.environ.get('GITHUB_API_KEY')
8-
9-
def get_github_repo_stars(repo_url):
10-
if github_key is None:
11-
print('🔴🔴 no github api key provided!!')
12-
# Extracting the owner and repo name from the URL
13-
parts = repo_url.split("/")
14-
owner, repo = parts[-2], parts[-1]
15-
16-
# GitHub API endpoint for fetching repo details
17-
api_url = f"https://api.github.com/repos/{owner}/{repo}"
18-
19-
headers = {
20-
"Authorization": f"token {github_key}", # Adding the authentication token to the request header
21-
"Accept": "application/vnd.github.v3+json"
22-
}
23-
24-
# Making the authenticated request
25-
response = requests.get(api_url, headers=headers)
26-
if response.status_code == 200:
27-
# Extracting the number of stars
28-
repo_data = response.json()
29-
stars = repo_data.get("stargazers_count", 0)
30-
owner_avatar_url = repo_data['owner']['avatar_url']
31-
# image_url = get_first_image_url_from_readme(owner, repo)
32-
description = repo_data.get('description')
33-
if not description:
34-
# Fetch README content
35-
readme_url = f"https://api.github.com/repos/{owner}/{repo}/readme"
36-
readme_info = requests.get(readme_url, headers=headers).json()
37-
readme_content = readme_info.get('content', '')
38-
readme_text = requests.get(readme_info['download_url']).text if 'download_url' in readme_info else ""
39-
paragraphs = readme_text.split('\n\n')
40-
# Keep only the first two paragraphs
41-
first_two_paragraphs = paragraphs[:2]
42-
description = '\n'.join(first_two_paragraphs)
43-
44-
return {
45-
"stars": stars,
46-
"owner_avatar_url": owner_avatar_url,
47-
'description': description,
48-
# "image_url": image_url
49-
}
50-
else:
51-
print(f"Failed to retrieve repository data. Status Code: {response.status_code}")
52-
return {}
533
import base64
544
import re
555

@@ -78,34 +28,6 @@ def get_first_image_url_from_readme(owner, repo):
7828
else:
7929
return "Error: Unable to fetch README information"
8030

81-
def clear_except_allowed_folder(path, allowedFolder):
82-
"""
83-
Clears everything in the specified path except for the allowedFolder.
84-
85-
:param path: Path to the directory to clear.
86-
:param allowedFolder: The name of the folder to keep.
87-
"""
88-
# Make sure the path is a directory
89-
if not os.path.isdir(path):
90-
print(f"The provided path {path} is not a directory.")
91-
return
92-
93-
# Iterate through items in the directory
94-
for item in os.listdir(path):
95-
item_path = os.path.join(path, item)
96-
# Check if the current item is the allowedFolder
97-
if item == allowedFolder:
98-
continue # Skip the allowedFolder
99-
100-
# If item is a directory, remove it and its contents
101-
if os.path.isdir(item_path):
102-
shutil.rmtree(item_path)
103-
print(f"Removed directory: {item_path}")
104-
# If item is a file, remove it
105-
else:
106-
os.remove(item_path)
107-
print(f"Removed file: {item_path}")
108-
10931
######v2
11032
def get_repo_user_and_name(module_path):
11133
command = ['git', 'config', '--get', 'remote.origin.url']

wm_scanner.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)