forked from reflex-dev/reflex-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhitelist.py
28 lines (21 loc) · 820 Bytes
/
whitelist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# A list of whitelist paths that should be built.
# If the list is empty, all pages will be built.
# Tips:
# - Ensure that the path starts with a forward slash '/'.
# - Do not include a trailing slash '/' at the end of the path.
# Examples:
# - Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
# - Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
WHITELISTED_PAGES = []
def _check_whitelisted_path(path):
if len(WHITELISTED_PAGES) == 0:
return True
# If the path is the root, always build it.
if path == "/":
return True
if len(WHITELISTED_PAGES) == 1 and WHITELISTED_PAGES[0] == "/":
return False
for whitelisted_path in WHITELISTED_PAGES:
if path.startswith(whitelisted_path):
return True
return False