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.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.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_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_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

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