Commit Graph
89 Commits
Author SHA1 Message Date
Cameron Cordes ae8665f632 Fix clippy warnings 2023-03-22 15:17:48 -04:00
Cameron Cordes 4ded708911 Extract FileSystem to a trait for better testability
Added some tests around filtering and searching by Tags. Added the
ability to use an in-memory Sqlite DB for more integration tests.
2023-03-22 15:17:33 -04:00
Cameron Cordes 5a2dce85e8 Fix searching by tags and fixed All FilterMode
Manually parsing the tag_ids for the file filtering isn't amazing, but
this works in a more friendly format.

Also the All filter mode was set up in the wrong direction instead of
checking that the file had ALL the tag ids provided, it checked that all
the tag-ids were on a file, which is too restrictive and wouldn't show
many files. Perhaps an ONLY option could exist for being even more
specific.
2023-03-22 13:58:14 -04:00
Cameron Cordes 02444de7fa Fix tagging file with new tag
When tagging a file with a brand new tag, we were using the number of
rows affected as the ID instead of doing the query for the ID of the row
we just inserted, this should fix when we tag a photo with a new tag.
2023-03-22 13:51:32 -04:00
Cameron Cordes 7d05c9b8bf Add filtering by Tag to /images endpoint 2023-03-20 08:14:12 -04:00
Cameron Cordes de4041bd17 Refactor tags services and added tests
Implemented some functionality which will allow the service
configuration of the app to be split among the features for readability
and testability.
2023-03-19 15:05:20 -04:00
Cameron Cordes fbcfc68e01 Fix tests 2023-03-19 12:29:33 -04:00
Cameron Cordes 8bcd9440bf Add Endpoint for Batch add/removal of tags on a file 2023-03-19 12:13:04 -04:00
Cameron Cordes f98d3261a7 Fix tags all and tags for photo endpoints 2023-03-18 21:00:26 -04:00
Cameron Cordes 68bfcbf85f Update and Migrate Diesel to 2.0
Almost have tag support working, still figuring out how to get photo
tags.
2023-03-18 14:43:41 -04:00
Cameron Cordes 40c79d13db Move tags to their own module
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2022-03-17 22:07:33 -04:00
Cameron Cordes c8cae28c9f Merge branch 'master' into feature/tagging 2022-03-17 21:53:17 -04:00
Cameron Cordes 528db5da3a Move app state to its own module
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2022-03-17 19:40:07 -04:00
Cameron Cordes 4d9b7c91a1 Improve testability and remove boxing
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
Leverage generics to remove the extra heap allocation for the response
handlers using Dao's. Also moved some of the environment variables to
app state to allow for easier testing.
2022-03-16 20:51:37 -04:00
Cameron Cordes 50e973da1f Cleanup unused imports
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2022-03-01 21:16:04 -05:00
Cameron Cordes b219663e0a Update CI to Rust 1.59
Core Repos/ImageApi/pipeline/pr-master This commit looks good
This will support Rust 2021 edition for Actix 4.
2022-03-01 20:44:51 -05:00
Cameron Cordes 69fe307516 Update to Actix 4
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
2022-03-01 20:38:41 -05:00
Cameron Cordes 9cd19d03eb Create Delete Tag endpoint
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
2021-11-30 20:07:00 -05:00
Cameron Cordes f0e96071be Update Rust image to 1.55
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-10-13 12:12:25 -04:00
Cameron Cordes 14ab02a1ec Elevate insertion logs to info and fix error logs
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-10-11 21:52:06 -04:00
Cameron Cordes 2e5ac8861c Add created timestamps for tags 2021-10-11 21:52:06 -04:00
Cameron Cordes 9d925be84d Improve add tag endpoint and add get tag endpoint
Flattened out the add tag logic to make it more functional.
2021-10-11 21:52:06 -04:00
Cameron Cordes 8939ffbaf5 Create Tag tables and Add Tag endpoint 2021-10-11 21:52:06 -04:00
Cameron Cordes 2d6db6d059 Update dependencies 2021-10-11 21:52:06 -04:00
Cameron Cordes d6e4a01c88 Move list_photos to files module
Core Repos/ImageApi/pipeline/pr-master This commit looks good
Added some tests, refactored the error handling/logging, and refactored
the extension tests.
2021-10-07 20:32:36 -04:00
Cameron Cordes 2c50b4ae2f Add anyhow, Improve Auth token code
Moved test helper code to its own module.
2021-10-07 20:32:36 -04:00
Cameron Cordes 0e972509aa Update dependencies
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-07-08 16:53:50 -04:00
Cameron Cordes 8622500a2f Use file metadata to sort files and directories 2021-06-02 08:32:20 -04:00
Cameron Cordes 9d823fdc51 Create file metadata endpoint
This allows retrieving create/modify date as well as file size for any
file in the BASE_PATH.
2021-05-19 08:53:20 -04:00
Cameron Cordes c5a7675986 Use IntGauge for media counts
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-05-01 00:16:55 -04:00
Cameron Cordes a79179c5c3 Add Image and Video total gauges 2021-04-30 23:53:10 -04:00
Cameron Cordes 6abc99d9b6 Add PrometheusMetrics 2021-04-05 20:14:34 -04:00
Cameron Cordes 4249fd319c Make list photos endpoint a get resource
Core Repos/ImageApi/pipeline/pr-master This commit looks good
The request doesn't modify state and the path can be passed as a query
param so a GET makes more sense.
2021-03-29 15:42:59 -04:00
Cameron Cordes 1b2aad0f08 Revert back to actix 0.10
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
Until Actix Web 4, we need to use an older version of actix so that the
runtime's match up to version 1.
2021-03-29 14:59:42 -04:00
Cameron Cordes 7474c4d310 Update dependencies
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
Update dependencies and remove some features from the image crate that
are unused.
2021-03-27 17:25:52 -04:00
Cameron Cordes 2e97086751 FavoritesDao for querying, adding and removing favorites
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-03-27 16:33:45 -04:00
Cameron Cordes 53cdbabae1 Fix favorites logging parameter order
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-03-25 13:39:16 -04:00
Cameron Cordes 7f534a18bf Bump Jenkins build image to 1.51
Core Repos/ImageApi/pipeline/head There was a failure building this commit
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
2021-03-25 13:18:16 -04:00
Cameron Cordes 31e95dc158 Fix some lint warning and simplify some code 2021-03-25 13:17:58 -04:00
Cameron Cordes 1539255ae0 Remove and replace deleted or moved thumbnails
Core Repos/ImageApi/pipeline/head This commit looks good
2021-03-17 22:30:27 -04:00
Cameron Cordes a2a9c27f12 Use Actix worker thread for database operations 2021-03-17 22:30:02 -04:00
Cameron Cordes 3c02bcc8fb Check upload name to make sure its an image or video
Core Repos/ImageApi/pipeline/head This commit looks good
The upload code should be additionally refactored to probably do a more
comprehensive check of if the file is an image or video.
2021-03-07 22:00:12 -05:00
Cameron Cordes 3611f46004 Fix test name and simplify helper 2021-03-04 16:37:19 -05:00
Cameron Cordes e5eb2d9c1f Add info level request logging
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-27 11:54:04 -05:00
Cameron Cordes 1c7e54d355 Make playlist generation async
This should allow other requests to be answered while we wait for ffmpeg
to do its thing.
2021-02-27 11:53:29 -05:00
Cameron Cordes e5ad88abd6 Create UserDao and unit tests for login 2021-02-26 08:48:33 -05:00
Cameron Cordes 64bfb58734 Log when unknown user tries to log in 2021-02-25 17:42:16 -05:00
Cameron Cordes 72e41b99a1 Remove Actix CORS dependency 2021-02-25 14:42:23 -05:00
Cameron Cordes 45aa260d7b Merge branch 'master' into feature/update-dependencies
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-25 10:44:28 -05:00
Cameron Cordes e0d2a14d0f Report path when an image fails to open
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-24 22:28:46 -05:00
Cameron Cordes f9983240df Use log crate for logging instead of println
Core Repos/ImageApi/pipeline/head This commit looks good
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-24 21:26:11 -05:00
Cameron Cordes 8b5ba9d48c Move auth related methods to their own module 2021-02-18 20:31:29 -05:00
Cameron Cordes fae7b2a962 Add tests for JWT decoding 2021-02-18 20:31:03 -05:00
Cameron Cordes b0a9cd6327 Update Actix, tokio and hashing libraries
Core Repos/ImageApi/pipeline/head This commit looks good
2021-02-15 20:39:14 -05:00
Cameron Cordes 11d1e9600a Use an Actor for the Stream watching
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-11 20:39:07 -05:00
Cameron Cordes 45b4f0cd72 Track relevant .idea files
Core Repos/ImageApi/pipeline/head Something is wrong with the build of this commit
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2021-02-09 21:32:22 -05:00
Cameron Cordes b595bdd642 Add VideoStreamManager for keeping track of active streams
The stream manager should help prevent zombie processes and can later be
used for stopping video streams if the user exits the video before
finishing for example.
2021-02-09 21:30:27 -05:00
Cameron Cordes e4c23c0fe5 Improve video streaming speed
Core Repos/ImageApi/pipeline/head This commit looks good
Instead of waiting for an entire video to stream, we spawn a child
ffmpeg process to start generating the HLS playlist, and once it creates
the first part of the playlist we return the response so the client can
start streaming almost immediately. HTTP Live streaming can handle
playlist updates after the initial playlist is created, although I don't
think the user can skip to the end and skip streaming parts of the
video.
2021-02-08 19:46:38 -05:00
Cameron Cordes ecd43f776a Do more proper path validation for playlist generation
Core Repos/ImageApi/pipeline/head This commit looks good
2021-02-08 18:38:30 -05:00
Cameron Cordes 659bad02c9 Fix clippy warnings
Core Repos/ImageApi/pipeline/head This commit looks good
2021-02-03 17:21:23 -05:00
Cameron Cordes f20a8a5842 Update dependencies, disable registration and improve path handling 2021-02-02 13:57:51 -05:00
Cameron Cordes eccb45ced0 Use Absolutize for files that do not exist
Canonicalize relies on the file existing to resolve the potential
traversal, which won't work for file upload in case the file name has a
traversal inside it.
2020-10-17 19:22:55 -04:00
Cameron Cordes 6c9c80f61d Update dependencies 2020-10-16 14:43:20 -04:00
Cameron Cordes f52ad9e3b6 Include Nikon Raw image files 2020-09-17 13:29:47 -04:00
Cameron Cordes d2f7423c6c Fix LFI bug
Previously we blindly read whatever path the client provided and if the
user could read the file it would return from the call.
2020-09-15 16:35:05 -04:00
Cameron Cordes 2343351a4d Add file watcher to re-generate thumbnails
Previously files added while the server is running would not have
thumbnails until after the server was restarted. Now we watch the
BASE_PATH for added/renamed files in order to re-gen the thumbnail.
2020-09-13 21:36:34 -04:00
Cameron Cordes 426c695b47 File upload working 2020-09-13 21:34:08 -04:00
Cameron Cordes fe23586059 Update to Actix 3.0 2020-09-11 16:12:41 -04:00
Cameron Cordes c774edd7dd Add Favorite GET, and POST endpoints 2020-08-07 23:11:15 -04:00
Cameron Cordes 74043c5c6a Scan for new files every startup 2020-08-07 23:11:15 -04:00
Cameron Cordes 1805c19025 Add README with environment info 2020-07-30 11:01:08 -04:00
Cameron Cordes f99d574ba2 Read Token signing key from environment 2020-07-30 10:53:27 -04:00
Cameron Cordes 68bb9d9d5c Added tests and better path validation
Secure video endpoints.
2020-07-23 16:18:28 -04:00
Cameron Cordes f63dd9cb05 Keep thumbnails in their relative directories 2020-07-21 20:36:41 -04:00
Cameron Cordes 7dbd93cedc Generate mp4 thumbnails 2020-07-16 21:24:10 -04:00
Cameron Cordes a49619c98c Move url to env variable 2020-07-16 20:18:38 -04:00
Cameron Cordes c90987d709 Check extensions case-invariant
Ran clippy and linted some of the logic.
2020-07-16 20:16:17 -04:00
Cameron Cordes 7d369aab5c Generate thumbnails before API starts up
Clients can now request a thumbnail by specifying a size on the image
request.
2020-07-15 12:06:50 -04:00
Cameron Cordes ca761f605b Check and use correct paths for generating HLS playlist
This also should prevent generating the playlist if it already exists
and uses a better ffmpeg command for transcoding the video.
2020-07-14 15:45:10 -04:00
Cameron Cordes c39bf970be Generating a HLS playlist through ffmpeg
I might be able to streamline the requests to cut down on the endpoints.
This also will likely take some time if the file is large and could time
out, that may be a concern for another day.
2020-07-13 22:39:00 -04:00
Cameron Cordes 78c066b7be Update Photos API
Since there is a body to the photos api it should be a post for now.
Also updated the response to separate files and directories.
2020-07-09 18:22:03 -04:00
Cameron Cordes e0e12dcc7b Remove Environment file 2020-07-08 21:41:22 -04:00
Cameron Cordes 536300e0a1 Serving files is working
Right now we're not doing any streaming and this isn't ideal. I'll need
to figure it out at some point.
2020-07-08 21:38:21 -04:00
Cameron Cordes 82203d9a41 Create Account endpoint works 2020-07-08 09:19:27 -04:00
Cameron Cordes e3bb607d95 Fix token parsing and require Auth for list files 2020-07-07 22:37:20 -04:00
Cameron Cordes 2aa1b61429 Move database into the main app
I was having issues including the lib as a crate, its fine just being a
module for now.
2020-07-07 21:48:29 -04:00
Cameron Cordes 1c1c8531aa Ignore database files 2020-07-07 21:07:00 -04:00
Cameron Cordes f8df3678b1 Setup Auth DB 2020-07-07 21:06:43 -04:00
Cameron Cordes 36f7351627 Initial API setup
Right now we are just listing files in a given subdirectory with not
authentication.
2020-07-07 19:53:12 -04:00