Skip to content

Commit

Permalink
rm for now
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Sep 8, 2024
1 parent fb5b3e3 commit 8f781bc
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions api/neurolibre_preview_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,29 +291,29 @@ def get_theme_dir(username,repo,commit,type):
# commit=commit,
# frontend_data=frontend_data)

@app.route('/myst/<username>/<repo>/<commit>/')
@app.route('/myst/<username>/<repo>/<commit>/<path:page_path>')
def render_page(username, repo, commit, page_path=''):
user_build_dir = get_user_build_dir(username, repo, commit)
if not page_path:
# If no specific page is requested, serve index.html
index_path = os.path.join(user_build_dir, 'index.html')
if os.path.exists(index_path):
return send_file(index_path)
else:
return abort(404, description="Index file not found")

page_path = os.path.join(user_build_dir, page_path)
if os.path.exists(page_path):
return send_file(page_path)
else:
return abort(404, description="Page not found")

@app.route('/myst/<username>/<repo>/<commit>/public/<path:filename>')
def serve_public(username, repo, commit, filename):
user_build_dir = get_user_build_dir(username, repo, commit)
return send_from_directory(os.path.join(user_build_dir, 'public'), filename)
# @app.route('/myst/<username>/<repo>/<commit>/')
# @app.route('/myst/<username>/<repo>/<commit>/<path:page_path>')
# def render_page(username, repo, commit, page_path=''):
# user_build_dir = get_user_build_dir(username, repo, commit)
# if not page_path:
# # If no specific page is requested, serve index.html
# index_path = os.path.join(user_build_dir, 'index.html')
# if os.path.exists(index_path):
# return send_file(index_path)
# else:
# return abort(404, description="Index file not found")

# page_path = os.path.join(user_build_dir, page_path)
# if os.path.exists(page_path):
# return send_file(page_path)
# else:
# return abort(404, description="Page not found")

# @app.route('/myst/<username>/<repo>/<commit>/public/<path:filename>')
# def serve_public(username, repo, commit, filename):
# user_build_dir = get_user_build_dir(username, repo, commit)
# return send_from_directory(os.path.join(user_build_dir, 'public'), filename)

@app.route('/theme/<path:filename>')
def serve_theme(filename,username,repo,commit):
return send_from_directory(os.path.join(get_theme_dir(username,repo,commit,'article-theme'), 'build'), filename)
# @app.route('/theme/<path:filename>')
# def serve_theme(filename,username,repo,commit):
# return send_from_directory(os.path.join(get_theme_dir(username,repo,commit,'article-theme'), 'build'), filename)

0 comments on commit 8f781bc

Please sign in to comment.