-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arxiv.base v0.9.1 #65
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3352691
ARXIVNG-962 added arxiv.forms, which provides tools for CSRF protection
erickpeirson 87310d3
ARXIVNG-962 added additional documentation
erickpeirson f2af184
minor
erickpeirson 45a6876
minor fix
erickpeirson d870341
minor fix
erickpeirson dc89fa5
ARXIVNG-1005 implemented a better solution for cross-app URL routing
erickpeirson 638659a
ARXIVNG-1005 removed config_url, added documentation
erickpeirson 8854157
cleanup
erickpeirson 0142780
cleanup
erickpeirson 9445fbf
added fallback to session ID when nonce is not available
erickpeirson ae2a41b
ARXIVNG-1005 added some additional routes to arxiv.base.config
erickpeirson 06c2a9a
Merge pull request #64 from cul-it/bug/ARXIVNG-1005
erickpeirson 6677eab
Merge branch 'develop' into task/ARXIVNG-962
erickpeirson e590c0b
updated pipfile.lock
erickpeirson c48df33
Merge pull request #63 from cul-it/task/ARXIVNG-962
erickpeirson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ pytz = "*" | |
uwsgi = "*" | ||
pydocstyle = "*" | ||
"boto3" = "*" | ||
wtforms = "*" | ||
|
||
[dev-packages] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,58 @@ | ||
"""Flask configuration.""" | ||
|
||
from typing import Optional | ||
import os | ||
from urllib.parse import urlparse | ||
|
||
SERVER_NAME = None | ||
|
||
EXTERNAL_URLS = [ | ||
("twitter", os.environ.get("ARXIV_TWITTER_URL", | ||
"https://twitter.com/arxiv")), | ||
("blog", os.environ.get("ARXIV_BLOG_URL", | ||
"https://blogs.cornell.edu/arxiv/")), | ||
("wiki", os.environ.get("ARXIV_WIKI_URL", | ||
"https://confluence.cornell.edu/display/arxivpub/" | ||
"arXiv+Public+Wiki")), | ||
("accessibility", os.environ.get("ARXIV_ACCESSIBILITY_URL", | ||
"mailto:[email protected]")), | ||
("library", os.environ.get("ARXIV_LIBRARY_URL", | ||
"https://library.cornell.edu")), | ||
("acknowledgment", os.environ.get( | ||
"ARXIV_ACKNOWLEDGEMENT_URL", | ||
"https://confluence.cornell.edu/x/ALlRF" | ||
)), | ||
] | ||
"""External URLs, configurable via environment variables.""" | ||
|
||
ARXIV_URLS = [ | ||
("help", "/help"), | ||
("contact", "/help/contact"), | ||
("search_box", "/search"), | ||
("search_advanced", "/search/advanced"), | ||
("account", "/user"), | ||
("login", "/user/login"), | ||
("logout", "/user/logout"), | ||
("home", "/"), | ||
("pdf", "/pdf/<arxiv:paper_id>"), | ||
A11Y_URL = os.environ.get("ARXIV_ACCESSIBILITY_URL", | ||
"mailto:[email protected]") | ||
|
||
BASE_SERVER = os.environ.get('BASE_SERVER', 'arxiv.org') | ||
|
||
URLS = [ | ||
("help", "/help", BASE_SERVER), | ||
("help_identifier", "/help/arxiv_identifier", BASE_SERVER), | ||
("help_trackback", "/help/trackback", BASE_SERVER), | ||
("help_mathjax", "/help/mathjax", BASE_SERVER), | ||
("help_social_bookmarking", "/help/social_bookmarking", BASE_SERVER), | ||
("contact", "/help/contact", BASE_SERVER), | ||
("search_box", "/search", BASE_SERVER), | ||
("search_advanced", "/search/advanced", BASE_SERVER), | ||
("account", "/user", BASE_SERVER), | ||
("login", "/user/login", BASE_SERVER), | ||
("logout", "/user/logout", BASE_SERVER), | ||
("home", "/", BASE_SERVER), | ||
("ignore_me", "/IgnoreMe", BASE_SERVER), # Anti-robot honneypot. | ||
("pdf", "/pdf/<arxiv:paper_id>", BASE_SERVER), | ||
("twitter", "/arxiv", "twitter.com"), | ||
("blog", "/arxiv", "blogs.cornell.edu"), | ||
("wiki", "/display/arxivpub/arXiv+Public+Wiki", "confluence.cornell.edu"), | ||
("library", "/", "library.cornell.edu"), | ||
("acknowledgment", "/x/ALlRF", "confluence.cornell.edu") | ||
] | ||
""" | ||
URLs for other services, for use with :func:`flask.url_for`. | ||
URLs for external services, for use with :func:`flask.url_for`. | ||
|
||
This only works for services at the same hostname, since Flask uses the | ||
hostname on the request to generate the full URL. For addresses at a different | ||
hostname, use :func:`arxiv.base.urls.config_url`, which relies on | ||
``EXTERNAL_URLS`` in this configuration file. | ||
For details, see :mod:`arxiv.base.urls`. | ||
""" | ||
|
||
# In order to provide something close to the config_url behavior, this will | ||
# look for ARXIV_{endpoint}_URL variables in the environ, and update `URLS` | ||
# accordingly. | ||
for key, value in os.environ.items(): | ||
if key.startswith('ARXIV_') and key.endswith('_URL'): | ||
endpoint = "_".join(key.split('_')[1:-1]).lower() | ||
o = urlparse(value) | ||
if not o.netloc: # Doesn't raise an exception. | ||
continue | ||
i: Optional[int] | ||
try: | ||
i = list(zip(*URLS))[0].index(endpoint) | ||
except ValueError: | ||
i = None | ||
if i is not None: | ||
URLS[i] = (endpoint, o.path, o.netloc) | ||
|
||
ARXIV_BUSINESS_TZ = os.environ.get("ARXIV_BUSINESS_TZ", "US/Eastern") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!