mirror of
https://github.com/JonasunderscoreJones/selfhosted-overleaf-project-share.git
synced 2025-10-24 09:39:19 +02:00
Compare commits
2 commits
0142211c81
...
d638dfe38c
| Author | SHA1 | Date | |
|---|---|---|---|
| d638dfe38c | |||
| 9143d783ba |
2 changed files with 11 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
PORT = 8000
|
PORT = 8000
|
||||||
GRAB_SYMLINKS = true
|
GRAB_SYMLINKS = true
|
||||||
SYMLINKS_DIR = "symlinks"
|
SYMLINK_DIR = "symlinks"
|
||||||
STATIC_SHARE_RESTRICTION = true
|
STATIC_SHARE_RESTRICTION = true
|
||||||
10
serve.py
10
serve.py
|
|
@ -56,6 +56,8 @@ class CustomHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
project_id = parts[0]
|
project_id = parts[0]
|
||||||
project_dir = get_project_directory(project_id)
|
project_dir = get_project_directory(project_id)
|
||||||
|
|
||||||
|
if not project_dir:
|
||||||
|
return os.path.join(BASE_DIR, "404.html")
|
||||||
# Check .staticshare restriction
|
# Check .staticshare restriction
|
||||||
if STATIC_SHARE_RESTRICTION:
|
if STATIC_SHARE_RESTRICTION:
|
||||||
staticshare_path = os.path.join(project_dir, ".staticshare")
|
staticshare_path = os.path.join(project_dir, ".staticshare")
|
||||||
|
|
@ -88,6 +90,14 @@ class CustomHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
|
|
||||||
project_dir = get_project_directory(project_id)
|
project_dir = get_project_directory(project_id)
|
||||||
|
|
||||||
|
if not project_dir:
|
||||||
|
self.send_response(404)
|
||||||
|
self.send_header("Content-type", "text/html")
|
||||||
|
self.end_headers()
|
||||||
|
with open(os.path.join(BASE_DIR, "404.html"), "rb") as f:
|
||||||
|
self.wfile.write(f.read())
|
||||||
|
return
|
||||||
|
|
||||||
if STATIC_SHARE_RESTRICTION:
|
if STATIC_SHARE_RESTRICTION:
|
||||||
staticshare_path = os.path.join(project_dir, ".staticshare")
|
staticshare_path = os.path.join(project_dir, ".staticshare")
|
||||||
if not os.path.isfile(staticshare_path):
|
if not os.path.isfile(staticshare_path):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue