Skip to content

Commit 49efcf1

Browse files
committed
Fix various bugs in check_outdated script
1 parent 3b4bdef commit 49efcf1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/check_outdated.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import os
22
import re
33

4-
from settings import ENDPOINTS_DIR
5-
4+
ENDPOINTS_DIR = "<SITE-API/API/Endpoints PATH>"
65
DOCUMENTATION_DIR = os.path.join(os.path.dirname(__file__), "../source/includes")
76

8-
def get_all_endpoints():
7+
def get_all_endpoints(with_disabled=False):
98
endpoints = []
109
for root, dirs, files in os.walk(ENDPOINTS_DIR):
1110
for file in files:
12-
with open(os.path.join(root, file), 'r') as f:
13-
if re.search(r"public bool \$api_disabled = true;", f.read()):
14-
continue
11+
if not with_disabled:
12+
with open(os.path.join(root, file), 'r') as f:
13+
if re.search(r"public *bool *\$api_disabled *= true;", f.read()):
14+
continue
1515

1616
endpoints.append(root.split(ENDPOINTS_DIR)[1] + "/" + file[:-4])
1717

@@ -25,12 +25,12 @@ def get_all_documented_endpoints():
2525
file_cat = file[1:-3]
2626
with open(os.path.join(DOCUMENTATION_DIR, file), 'r') as f:
2727
for line in f.readlines():
28-
match = re.match(r"curl https:\/\/api\.simplyprint\.io\/\{id\}(.*?)(\?| \\).*$", line)
28+
match = re.match(r"(?:curl)?.*https:\/\/api\.simplyprint\.io\/\{id\}(.*?)(\?| \\).*$", line)
2929

3030
if not match:
3131
continue
3232

33-
endpoints.append(match.group(1))
33+
endpoints.append(match.group(1).replace("\"", ""))
3434

3535
endpoints.sort()
3636
return endpoints

0 commit comments

Comments
 (0)