Serves static files for the fontend. File paths are relative to frontend/output
Handles requests that deal with file lists. The action
parameter specifies
what action to perform
Returns a list of all current file lists
Parameters
- None
Returns
Jsonified file_list::FileListList
Returns a file_list_response::ListResponse
with information about the specified list
Parameters
list_id
: ID of the target list
Returns
Jsonified file_list_response::ListResponse
Returns the file ID of the last file that was saved to the database in the list. Returns 0 if no file has been saved before
Parameters
list_id
: ID of the target list
Returns Integer
Returns a file_request_handlers::FileData
struct containing the file path,
thumbnail_path and tags of the specified file
Parameters
list_id
: ID of the target listindex
: Index of the file in the database
Returns Raw bytes
Returns the raw file data of the specified file
Parameters
list_id
: ID of the target listindex
: Index of the file in the database
Returns String containing the path to the file
Returns the filename of the specified file. If it is stored in the database, only the filename is returned while the full path of an unsaved path is returned
Parameters
list_id
: ID of the target listindex
: Index of the file in the database
Returns List string containing the file path or filename
Notes
This should probably be rewritten to return a path relative to $FILE_READ_PATH
for unsaved files to avoid exposing internal folder structures
Returns the raw data for the thumbnail of the specified file
Parameters
list_id
: ID of the target listindex
: Index of the file in the database
Returns Raw bytes
Saves the specified file to the database. If the file was previously unsaved, the file is added to the database, otherwise the file entry is updated.
The tags are set to whatever is specified in the query, and the creation_time
of the file is set to the current time
Responds with "ok"
Params
list_id
: ID of the target listindex
: Index of the file in the databasetags
: JSON formated list of strings which should be the tags of the file
Returns
"Ok"
Performs a search for saved files. Replies with a file_list_response::ListResponse
with information about the list that is created from the search.
Parameters
query
: String containing the search query
Returns
Jsonified file_list_response::ListResponse
Notes The format of the search query should probably be specified if it is not already
Handles various requests relating to sync. Just /sync
is unused
Starts a sync procedure with the specified foreign flash instance. Replies with a job id which can be used to monitor the progress of the sync job.
Params
foreign_url
: Url of the foreign flash instance to sync with
Returns
job id: usize
Replies with a list of syncpoints present on this instance
Params
- None
Returns
Jsonified list of changelog::SyncPoint
Replies with details about the specified file
Params
file_id
: Integer ID of the file in the database
Returns
Jsonified foreign_server::FileDetails
Returns the raw data of the specified file
Params
file_id
: Integer ID of the file in the database
Returns Raw byte content of the file
Returns the raw data of the specified file's thumbnail
Params
file_id
: Integer ID of the file in the database
Returns Raw byte content of the file's thumbnail
Returns all changes after the specified timestamp.
Params
starting_timestamp
: The timestamp which all changes returned should be later than
Returns
Jsonified Vec<changelog::Change>
Apply a list of changes to this instance by fetching file details from the foreign server from which this request arrived. The foreign server can be reached on the specified port
Params
port
The port where the foreign server that initialized the request can be reached
Body The list of changes that should be applied
Returns
A job id: usize
which can be used to check the status of the sync
Get the current status of a sync job as a sync_progress::SyncStatus
struct
Params
job_id
The id of the sync job to report the status of
Returns
A sync_progress::SyncStatus
struct
Replies with a list of subdirectories of $FILE_READ_PATH
Params
- None
Returns Jsonified list of filenames
Replies with "pong"
. Used to check if flash has started, specifically by test
scripts
Params
- None
Returns
"pong"