application.routes package#
Submodules#
application.routes.api module#
application.routes.api
- application.routes.api.graphql()#
Handle API requests for GraphQL queries.
- Returns:
A Flask Response object containing the result of the GraphQL query.
- Return type:
Response
application.routes.auth module#
application.routes.auth
- application.routes.auth.auth_user()#
Authenticate a user and return a login token.
- Returns:
A Flask Response object containing the login token or an error message.
- Return type:
Response
- application.routes.auth.authorized()#
Check if the user is authorized to access the application.
- Returns:
True if the user is authorized, False otherwise.
- Return type:
bool
- application.routes.auth.request_reset_code()#
Request a notification containing a password reset code be sent to the user.
- Returns:
A Flask Response object indicating success or failure of the request.
- Return type:
Response
- application.routes.auth.reset_password()#
Reset a user’s password using a reset code.
- Returns:
A Flask Response object indicating success or failure of the password reset.
- Return type:
Response
- application.routes.auth.verify_token()#
Verify the validity of a user token.
- Returns:
A Flask Response object indicating whether the token is valid or not.
- Return type:
Response
application.routes.blob module#
application.routes.blob
- application.routes.blob.download(path)#
Download a file from blob storage.
- Parameters:
path (str) – The path to the file in blob storage.
- Returns:
A Flask Response object containing the file data or an error message.
- Return type:
Response
- application.routes.blob.file_stream(full_path, range_header)#
Generator to stream file data in chunks.
- Parameters:
full_path (str) – The full path to the file to be streamed.
- Yields:
bytes – Chunks of file data.
- Return type:
Generator[bytes,None,None]
- application.routes.blob.preview(path)#
Fetch a preview of a file from blob storage.
- Parameters:
path (str) – The path to the file in blob storage.
- Returns:
A Flask Response object containing the preview data or an error message.
- Return type:
Response
- application.routes.blob.stream(path)#
Stream a file from blob storage.
- Parameters:
path (str) – The path to the file in blob storage.
- Returns:
A Flask Response object containing the file data or an error message.
- Return type:
Response
- application.routes.blob.thumbnail(path)#
Fetch a thumbnail of a file from blob storage.
- Parameters:
path (str) – The path to the file in blob storage.
- Returns:
A Flask Response object containing the thumbnail data or an error message.
- Return type:
Response
- application.routes.blob.upload()#
Upload a file to blob storage.
- Returns:
- A Flask Response object containing the result
of the upload operation or an error message.
- Return type:
Response
application.routes.files module#
application.routes.files
- application.routes.files.read_file_data(path)#
Read the contents of a file and return it as a Flask Response object.
- Parameters:
path (str) – The path to the file to read.
- Returns:
A Flask Response object containing the file data, or an error message if the file is not found.
- Return type:
Response
- application.routes.files.sanitize_path(path)#
Sanitize the given path to prevent directory traversal attacks.
- Parameters:
path (str) – The path to sanitize.
- Returns:
The sanitized path, relative to the root directory.
- Return type:
str
application.routes.misc module#
application.routes.misc
- application.routes.misc.random_xkcd()#
Fetch a random XKCD comic.
- Returns:
A Flask Response object containing the JSON data of a random XKCD comic.
- Return type:
Response
application.routes.site module#
application.routes.site
- application.routes.site.get(path)#
Get a file from the site directory.
- Parameters:
path (str) – The path to the file to retrieve.
- Returns:
A Flask Response object containing the file data or an error message.
- Return type:
Response
- application.routes.site.get_favicon()#
Get the default favicon.ico from the site directory.
- Returns:
A Flask Response object containing the icon file data or an error message.
- Return type:
Response
- application.routes.site.get_icon(path)#
Get an icon file from the site directory.
- Parameters:
path (str) – The path to the icon file to retrieve.
- Returns:
A Flask Response object containing the icon file data or an error message.
- Return type:
Response
- application.routes.site.get_pdf_js(path)#
Get a file from the pdf.js 3rd party library.
- Parameters:
path (str) – The path to the file to retrieve.
- Returns:
A Flask Response object containing the file data or an error message.
- Return type:
Response
- application.routes.site.get_svg(path)#
Get an SVG file from the site directory.
- Parameters:
path (str) – The path to the SVG file to retrieve.
- Returns:
A Flask Response object containing the SVG file data or an error message.
- Return type:
Response
- application.routes.site.main_page()#
Return the main page of the application.
- Returns:
A Flask Response object containing the main page HTML.
- Return type:
Response
application.routes.wopi module#
application.routes.wopi
- application.routes.wopi.get_document_contents(jwt, id)#
Get the contents of a document via WOPI endpoint.
- Parameters:
jwt (str) – A valid JSON web token string.
id (str) – The ID of the document.
- Returns:
A response containing either the body of the document or an error, as appropriate.
- Return type:
Response
- application.routes.wopi.get_document_info(jwt, id)#
Get info about a document via WOPI endpoint.
“BaseFileName”: (str) the title of the document, “Size”: (int) the document size in bytes, “UserCanWrite”: (bool) true if the user owns this document, false otherwise
}#
- type jwt:
str- param jwt:
A valid JSON web token string.
- type jwt:
str
- type id:
str- param id:
The ID of the document.
- type id:
str
- returns:
A response containing either JSON info about the document, or an error as appropriate.
- rtype:
Response
- application.routes.wopi.put_document_contents(jwt, id)#
Update the contents of a document via WOPI endpoint.
- Parameters:
jwt (str) – A valid JSON web token string.
id (str) – The ID of the document.
- Returns:
A response containing ‘OK’ on success, or an error as appropriate.
- Return type:
Response
Module contents#
application.routes
- application.routes.init(application)#
Initialize the application routes.
- Parameters:
application – The Flask application instance to which the routes will be added.
- Return type:
None
- application.routes.tq(func)#
A decorator to track the last time a route was called, and how many responses are in-progress.
This decorator exists purely to know when it’s safe to shut down/restart the server. It doesn’t track ANYTHING other than the quiescence of the back end.