Commit Graph

233 Commits

Author SHA1 Message Date
Rasmus Kaj
e73c363986 Unify far_expires handling.
Make the expire header on images actually far.
2017-05-08 20:44:31 +02:00
Rasmus Kaj
5ea5a9bd90 Update ructe.
It now supports adding static sass files, so remove direct dependency
on rsass.
2017-05-08 07:09:22 +02:00
Rasmus Kaj
483fe37487 Avoid empty "Tid:" 2017-02-12 17:56:26 +01:00
Rasmus Kaj
abf5dcf384 Large is full.
The "large" version of an image is the full original file.  Only
logged-in users may access the large version.
2017-02-12 15:24:39 +01:00
Rasmus Kaj
3a1a2d15d3 Add basic attribution. 2017-02-11 22:24:35 +01:00
Rasmus Kaj
708ff73997 Simplify error handling.
Internal server error is internal server error anyway, so why not put
a panic in the log for it.
2017-02-08 18:41:20 +01:00
Rasmus Kaj
eada496c5b Use slices in templates. 2017-02-05 12:08:38 +01:00
Rasmus Kaj
2ce41194e6 Some code-style improvements. 2017-02-04 18:17:32 +01:00
Rasmus Kaj
cb000948f2 A little more modular. 2017-02-04 17:48:42 +01:00
Rasmus Kaj
767a0c6bb0 Refuse to tag non-existing images.
But find images even if the file names are lowercased since tagging.
2017-02-04 11:35:17 +01:00
Rasmus Kaj
01b21bd36d Refuse to tag non-existing images. 2017-02-03 21:47:45 +01:00
Rasmus Kaj
b69ceb8166 Nicer urls for images and details. 2017-02-01 16:12:03 +01:00
Rasmus Kaj
1ae8cf91b5 More flexible route mapping. 2017-02-01 07:39:47 +01:00
Rasmus Kaj
8cd215cdc2 Improve handling of static files.
Use static files handling from updated ructe rather than local
handling, and use rsass rather than sass-rs and sass-sys.

Static files are now kept in the binary (no more need to access the
build directory at runtime).  Also, there is an admin command to save
the static files to a directory, for the benefit of fronting web
servers and backwards compatibility.
2017-01-29 19:03:35 +01:00
Rasmus Kaj
698fb2c23b Update dependencies.
No direct build dependency on syntex and dotenv makes things easier.
2017-01-20 07:10:40 +01:00
Rasmus Kaj
fa60b6e1f8 No need to defind CSSLINK in main. 2016-12-19 07:19:26 +01:00
Rasmus Kaj
18f15d53d6 Some fooling around with stats. 2016-11-27 18:00:34 +01:00
Rasmus Kaj
eccbf9a1cf Avoid unnessecary string copying.
Unleash the power of rust checked borrows!  :-)
2016-11-27 01:05:03 +01:00
Rasmus Kaj
d10343e0cb Include readkpa in rphotosadm. 2016-11-27 00:54:08 +01:00
Rasmus Kaj
7b2cb158ac Use match, not nested if. 2016-11-26 12:32:16 +01:00
Rasmus Kaj
7354707486 Include findphotos in rphotosadm. 2016-11-26 11:31:21 +01:00
Rasmus Kaj
5afd58086d Include makepublic in rphotosadm.
Another separate binary merged into the general adm binary.
2016-11-24 22:42:59 +01:00
Rasmus Kaj
e5b5c28d5e Move user administration into rphotosadm. 2016-11-21 08:45:54 +01:00
Rasmus Kaj
b38ac8c661 Start moving towards a single adm command. 2016-11-20 21:33:16 +01:00
Rasmus Kaj
e0ce981b8d Merge branch 'master' into feature/memcached-rs 2016-11-20 16:58:46 +01:00
Rasmus Kaj
a18daeac7c Change photo order. 2016-11-20 15:52:38 +01:00
Rasmus Kaj
ae5cb673ab Fix some code style issues.
Mainly the proper ordering of use statements.
2016-11-20 00:33:31 +01:00
Rasmus Kaj
754fa51efe Use a middleware to access cache.
The proper way to get easy access to a configured memcached client in
a request handler is to have a middleware method to get it.
2016-11-19 23:55:13 +01:00
Rasmus Kaj
171b29cd6c Better logging re caching. 2016-11-19 20:49:44 +01:00
Rasmus Kaj
3fc702d859 Merge branch 'master' into feature/memcached-rs 2016-11-12 20:51:16 +01:00
Rasmus Kaj
5b57b7de88 Put nulls last in some orderings. 2016-11-11 21:49:58 +01:00
Rasmus Kaj
4b6b927640 More natural year order.
Most recent years first, old pictures and pictures without a date last
on the frontpage.
2016-11-09 07:53:04 +01:00
Rasmus Kaj
08ade16c02 Avoid single-digit request times. 2016-11-08 23:51:00 +01:00
Rasmus Kaj
a7960f5569 Refactor caching.
Separate the caching logic from how to the actual image scaling.
2016-11-08 23:48:08 +01:00
Rasmus Kaj
0d1285da37 Try memcached-rs. 2016-11-03 17:18:07 +01:00
Rasmus Kaj
704c930010 Fix ordering. 2016-11-03 16:01:20 +01:00
Rasmus Kaj
e2784cc75c Update dependencies. 2016-10-28 00:44:30 +02:00
Rasmus Kaj
8291b91bcf Show slightly larger pics. 2016-09-28 14:36:03 +02:00
Rasmus Kaj
6d8eff3015 Remove unused code. 2016-09-27 20:42:22 +02:00
Rasmus Kaj
0597b636dc Don't drop camera info. 2016-09-26 22:38:22 +02:00
Rasmus Kaj
0b0877e54d Better handling of dates with no images. 2016-09-23 23:12:22 +02:00
Rasmus Kaj
c6672181d6 Covert all templates to ructe. 2016-09-23 22:03:04 +02:00
Rasmus Kaj
b79cbc7714 More ructe templates. 2016-09-23 16:40:54 +02:00
Rasmus Kaj
9a038765b9 Initial ructe experiment. 2016-09-20 07:35:28 +02:00
Rasmus Kaj
583f492cae Update nickle-jwt-session use. 2016-09-20 07:35:01 +02:00
Rasmus Kaj
8b60679c44 Add public photos if the file exists. 2016-08-28 22:07:42 +02:00
Rasmus Kaj
ab35c4bc49 Add a year-listing playground. 2016-08-28 22:06:45 +02:00
Rasmus Kaj
ef968f4b81 Cast before transfer. 2016-08-21 13:31:25 +02:00
Rasmus Kaj
6a254db792 Add a view for photos without a date. 2016-08-20 13:27:27 +02:00
Rasmus Kaj
6ed42c0be7 Add camera support.
Store and show which camera each picture was taken with (if present in
exif data).
2016-08-09 01:41:46 +02:00
Rasmus Kaj
97f299b54f Public/private tags, people and places. 2016-08-08 00:24:15 +02:00
Rasmus Kaj
fd5fb423ec Add flag to make photos public. 2016-08-07 22:41:00 +02:00
Rasmus Kaj
961e04d257 Better avoiding of raw images.
And get rid of some 'use ...::*'.
2016-08-07 20:38:42 +02:00
Rasmus Kaj
b8f671c7bf rustfmt + type consistency. 2016-08-05 23:21:24 +02:00
Rasmus Kaj
4f4a1e2345 Conditional query is BoxedQuery.
Yep, Diesel supports conditional queries.
2016-08-05 18:58:50 +02:00
Rasmus Kaj
10392df72c One line, not two, to get a connection. 2016-08-05 18:11:25 +02:00
Rasmus Kaj
64ec5f9c18 Fix simple ordering. 2016-08-05 03:19:14 +02:00
Rasmus Kaj
7f8d5350cc Inline an ugly utility method. 2016-08-04 18:16:17 +02:00
Rasmus Kaj
7e3c892e9c Merge sassify.rs into build.rs.
Simpler with only a one-file build program, and it is still less than
100 lines.
2016-08-04 01:06:15 +02:00
Rasmus Kaj
f7da73ad17 Update to Diesel 0.7.
Also, make things simpler by dropping nightly rust support.
2016-08-03 23:54:54 +02:00
Rasmus Kaj
bf91497d43 One more date to find, and nicer way to do it. 2016-07-29 11:19:23 +02:00
Rasmus Kaj
bbdd506b99 Look at DateTime when DateTimeOriginal is missing.
And some cleanup ...
2016-07-24 22:37:09 +02:00
Rasmus Kaj
4b5940fa48 Attempt nicer url segment parsing. 2016-07-22 00:20:38 +02:00
Rasmus Kaj
3767319ff6 Cleanup. 2016-07-17 14:30:58 +02:00
Rasmus Kaj
a89caf2799 Requestlogger cleanup. 2016-07-09 21:06:14 +02:00
Rasmus Kaj
b474373479 Use GPS position of photos. 2016-07-09 16:04:19 +02:00
Rasmus Kaj
7da9bab282 Remove unused imports. 2016-07-08 21:28:53 +02:00
Rasmus Kaj
967552f110 Implment proper user handling. 2016-07-02 12:50:25 +02:00
Rasmus Kaj
d2fd9b4430 Add an "on this day" feature. 2016-06-30 16:39:01 +02:00
Rasmus Kaj
b31a758a0d Implement places on photos. 2016-06-30 13:16:12 +02:00
Rasmus Kaj
c1d0862313 Implement people on photos. 2016-06-30 12:15:07 +02:00
Rasmus Kaj
855ea6c755 Implement tags on photos. 2016-06-30 01:29:02 +02:00
Rasmus Kaj
7778c079ed Consistency in whats public.
Attempt to only link public images from public overviews.

Some calls to desc() needs to be changed to desc().nulls_last() when
availiable in diesel.
2016-06-10 15:36:24 +02:00
Rasmus Kaj
2f3b222148 Get rid of some junk. 2016-06-06 22:28:07 +02:00
Rasmus Kaj
6d49a2e59d Findfotos: Path from command line. 2016-06-05 21:58:01 +02:00
Rasmus Kaj
03b33463c1 Actually get grades from kpa. 2016-06-05 17:38:30 +02:00
Rasmus Kaj
d040d7fe77 Start doing stuff in readkpa again. 2016-06-05 17:24:11 +02:00
Rasmus Kaj
daf64dae30 Some photos lacks datetime.
In the database, it is nullable.  In reality, it is unknown for
some of my older photos.
2016-06-05 15:55:23 +02:00
Rasmus Kaj
551e24cc69 Use DATABASE_URL consistently. 2016-06-05 00:57:38 +02:00
Rasmus Kaj
ffb5bbaf39 Reimplement all time-based views.
Also, proper database migrations and an attempt to make things
work on travis.
2016-06-04 21:08:14 +02:00
Rasmus Kaj
366b125862 Start conversion to diesel.
Use diesel instead of rustorm.  This compiles, but much of the
interestign stuff is commented out.
2016-05-29 21:51:27 +02:00
Rasmus Kaj
70f44cc153 Nicer error handling writing files. 2016-05-25 07:51:10 +02:00
Rasmus Kaj
f3f3602347 Add compressed css.
When storing the sassified css, also store copies compressed with gzip
and brotli.  That way, a good web server and client can save some
bytes of file transfer (the css in this project is very small, but as
it grows, this will become more relevant).
2016-05-23 20:50:13 +02:00
Rasmus Kaj
93c7d4fbbb Some clean-up of sassify. 2016-05-21 17:56:48 +02:00
Rasmus Kaj
94697fc35e Better linkpath in header.
Also known as breadcrumb links.
2016-05-18 18:44:50 +02:00
Rasmus Kaj
76a43e0efa Avoid trying to serve the raw images. 2016-05-15 22:05:42 +02:00
Rasmus Kaj
5490144f94 Order imports. 2016-05-11 18:15:00 +02:00
Rasmus Kaj
a3f414bd97 Use nickel form-body parsing for login. 2016-05-11 18:14:23 +02:00
Rasmus Kaj
5a57dc5e90 Add shorthand for date queries. 2016-05-04 22:11:31 +02:00
Rasmus Kaj
d1f5044466 Date links in page header. 2016-05-04 18:45:50 +02:00
Rasmus Kaj
8131e3fd01 Use &str rather than String. 2016-05-04 14:34:55 +02:00
Rasmus Kaj
3d956a106b Rustfmt. 2016-05-04 13:16:20 +02:00
Rasmus Kaj
53ca1530b9 Resassify only when needed. 2016-05-03 18:46:44 +02:00
Rasmus Kaj
88b0d8b57b Dont panic.
Handle errors in image scaling properly.
2016-05-03 18:37:35 +02:00
Rasmus Kaj
1a421537fb Get rid of some unused warnings. 2016-05-03 07:26:55 +02:00
Rasmus Kaj
a21d60a7be Show good pics only to guests.
If there is not a logged in user, show only pictures that
are graded above a certain limit.
2016-05-02 23:52:06 +02:00
Rasmus Kaj
e523d43d34 Add jwt authorization.
The username/password handling is just mocked currently.
2016-05-01 15:50:49 +02:00
Rasmus Kaj
10b5b4453c Use the "compressed" sass output.
This currently uses the sass-sys low-level interface, because the
operation is not supported in sass-rs.

The PR https://github.com/compass-rs/sass-rs/pull/3 adds high-level
support.  If / when that is fixed, the direct requirement for sass-sys
should be removed from rphotos.
2016-04-23 22:15:24 +02:00
Rasmus Kaj
c6a0aa25f5 Get rid of dead-code warnings. 2016-04-23 16:43:43 +02:00
Rasmus Kaj
d4bfe0756f Use scss to prepare css.
The css file is built to a file with (short) checksum in the
file name, to be nicely cacheable.  The actual file name is
compiled into the binary and sent to the templates as a variable.
2016-04-22 23:56:13 +02:00
Rasmus Kaj
e6a8c3189c Better code organisation.
Put handlers in separate functions, not just one extremely large main.
2016-04-19 18:10:26 +02:00
Rasmus Kaj
b340bb5f9d Summarize images per year and month. 2016-01-31 21:15:44 +01:00
Rasmus Kaj
84987eca40 Add a program to find image files. 2016-01-31 14:34:48 +01:00
Rasmus Kaj
f364d70b0f Changes for updated rustorm.
Disable default dependencies to handle a depency collision where
mysql required a different version of openssl than something else.
2016-01-30 19:57:53 +01:00
Rasmus Kaj
2335c5e97f Move PhotosDir to separate file. 2015-12-26 20:18:44 +01:00
Rasmus Kaj
caae44bf88 Update rustorm to version 0.4.0. 2015-12-26 17:29:28 +01:00
Rasmus Kaj
ba094853a2 Views per year/month/day. 2015-12-25 18:32:11 +01:00
Rasmus Kaj
d2adab3ecb Add original time to photos. 2015-12-22 18:22:21 +01:00
Rasmus Kaj
2c09e8d169 Dry and consistend photos_dir. 2015-12-06 23:00:16 +01:00
Rasmus Kaj
69003c561b Use environment for config.
Take base directory for photos and host:port to listen to from
environment instead of just useing hard-coded values.
2015-12-06 22:29:05 +01:00
Rasmus Kaj
9345860657 Minor cleanup. 2015-12-06 17:12:09 +01:00
Rasmus Kaj
1d57275fe8 Dryer code with a macro.
Declare and initialize the data struct for rendering
at the same time in view (controller) code.
2015-12-06 16:33:25 +01:00
Rasmus Kaj
e832e4d00f Better urls for image sizes. 2015-12-06 14:42:03 +01:00
Rasmus Kaj
eba6c2228c Remove semi-duplicate code. 2015-12-01 07:24:19 +01:00
Rasmus Kaj
66546966cc Nicer formatting of elapsed times. 2015-12-01 07:04:51 +01:00
Rasmus Kaj
5adeec2f91 RequestLoggerMiddleware.
Add a middleware that logs each request with result code
and elapsed time.
2015-11-30 20:31:23 +01:00
Rasmus Kaj
19db2ca293 Add support for places.
Only the simple tag-like places I used in kphotoalbum.
Proper geotagging is still left to do.
2015-11-29 22:38:47 +01:00
Rasmus Kaj
c768c071fc Import my kpa grades. 2015-11-29 20:09:49 +01:00
Rasmus Kaj
b2569dfa82 Scale images only down, not up. 2015-11-29 18:53:09 +01:00
Rasmus Kaj
177de0e6b7 Support rotation of images. 2015-11-29 18:38:58 +01:00
Rasmus Kaj
472c3a476c Provide orm_get_related.
It works the same each time, so provide it in my middleware.
2015-11-29 17:18:47 +01:00
Rasmus Kaj
c0ebb5a729 Add people data. 2015-11-28 09:53:12 +01:00
Rasmus Kaj
0ffa72a1db Expires header works again.
Match the direct hyper dependency with the one in nickel.rs
and things work fine agin.
2015-11-27 18:38:46 +01:00
Rasmus Kaj
ce4c362e60 A get_or_create with generic defaults. 2015-11-27 18:21:08 +01:00
Rasmus Kaj
8227b153b0 Put RustormMiddleware in separate file. 2015-11-27 13:05:43 +01:00
Rasmus Kaj
275185a8bc Setting expires broken in nickel 0.7.3.
Maybe there is a way, but the way I used have ceased to
work. https://github.com/nickel-org/nickel.rs/issues/303
2015-11-27 12:46:47 +01:00
Rasmus Kaj
735767065e List all tags. 2015-11-27 00:02:18 +01:00
Rasmus Kaj
939cbac290 Basic styling. 2015-11-26 23:20:36 +01:00
Rasmus Kaj
5c5ac376c8 List photos for a tag.
And of course some rewriting of everything ...
2015-11-26 22:47:39 +01:00
Rasmus Kaj
b1d53c0762 Photos can have tags.
Read old data from kphotoalbum.
2015-11-23 06:48:09 +01:00
Rasmus Kaj
704877abd9 Actually show some photos. 2015-11-22 13:01:39 +01:00
Rasmus Kaj
87ddb0db1f Read "photos" from db. 2015-11-21 16:21:44 +01:00
Rasmus Kaj
4cee26adea Initial commit.
Very simple web service using the nickel framworkd.
2015-11-19 23:43:04 +01:00