Skip to content

Commit

Permalink
Fix various bugs in check_outdated script
Browse files Browse the repository at this point in the history
  • Loading branch information
johanohly committed Oct 5, 2024
1 parent 3b4bdef commit 49efcf1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/check_outdated.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import os
import re

from settings import ENDPOINTS_DIR

ENDPOINTS_DIR = "<SITE-API/API/Endpoints PATH>"
DOCUMENTATION_DIR = os.path.join(os.path.dirname(__file__), "../source/includes")

def get_all_endpoints():
def get_all_endpoints(with_disabled=False):
endpoints = []
for root, dirs, files in os.walk(ENDPOINTS_DIR):
for file in files:
with open(os.path.join(root, file), 'r') as f:
if re.search(r"public bool \$api_disabled = true;", f.read()):
continue
if not with_disabled:
with open(os.path.join(root, file), 'r') as f:
if re.search(r"public *bool *\$api_disabled *= true;", f.read()):
continue

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

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

if not match:
continue

endpoints.append(match.group(1))
endpoints.append(match.group(1).replace("\"", ""))

endpoints.sort()
return endpoints
Expand Down

0 comments on commit 49efcf1

Please sign in to comment.