Commit Graph

139 Commits (219b1ca5bb549750cdcbab27b3babac5bf3e414b)

Author SHA1 Message Date
voussoir 84bf9b90de Add panels for user's created photos, albums, tags, bookmarks. 2021-01-09 11:27:29 -08:00
voussoir ca74e2e1d4 Use request.path instead of url for endswith conditions.
Because of the query string
2021-01-07 23:04:10 -08:00
voussoir db63ccc641 Split /tags.json, /tag/tagname.json into separate routes. 2021-01-07 23:02:05 -08:00
voussoir 84b4595454 Let /tag/tagname.json only return the one main tag, not list.
Previously, the whole walk tree was returned. This can be convenient
because you get the whole descendant tree all at once, but it's
unusual since all the other individual .json endpoints only return a
single object, not a list.
2021-01-07 22:52:42 -08:00
voussoir 4087827e86 Delete some old vars and slightly improve some clarity. 2021-01-07 19:25:47 -08:00
voussoir dd54eabd93 Add api endpoint /tag/tagname/add_synonym. 2021-01-05 14:02:08 -08:00
voussoir 06f26cd7b7 Use dotdict to remove all these ugly brackets. 2021-01-05 13:09:31 -08:00
voussoir af73bc580f Improve readability of cached_endpoint.
Switched the conditional and pulled it out into a separate function
so I can return early and dedent the rest.
2021-01-05 13:07:03 -08:00
voussoir b9ad785f4d Remove 'updated' key from /all_albums, /all_tags. Was killing caching.
The cached_endpoint decorator was detecting that the response content
kept changing, so it never returned 304. Oops. At the moment the client
doesn't even use this key, so if we need it back we can use the etag or
another http header.
2021-01-05 13:05:18 -08:00
voussoir 1d33923601 Rename caching.py -> client_caching.py.
The word caching can be ambiguous, and what's worse is this file
previously contained a decorator for server-side caching of a
response and a class for client-side caching of files. It was
confusing. This new separation and naming should make it easier
to find what you're looking for.
2021-01-05 13:03:41 -08:00
voussoir 8ab248a34e Improve naming and comments in FileEtagManager 2021-01-05 12:59:18 -08:00
voussoir bb82c1e4e7 Move cached_endpoint to decorators. 2021-01-05 12:43:39 -08:00
voussoir 11b846a3e0 Move random_hex function to voussoirkit/passwordy. 2021-01-05 12:38:04 -08:00
voussoir 9b8159c453 Improve gzip decision logic.
Previous called get_data which is dangerous for large but
indeterminate response sizes, and the bail chain was more
difficult to reason about than a simple should_gzip true/false.
2021-01-05 01:27:14 -08:00
voussoir bef91b959b Improve specific tag redirect.
Previous version had a bug when the URL contained percent-encoded
spaces because url.replace() was looking for spaces and not replacing
the %20. Constructing the url from parts is more reliable.
2021-01-05 01:25:29 -08:00
voussoir 1a2bd59f23 Fix accuracy of Descendants count on tags page. 2021-01-04 13:45:43 -08:00
voussoir 0c3ee6f2d2 Add search_embed for bringing search iframes to other pages. 2021-01-02 13:49:43 -08:00
voussoir e303b934f7 Add UI for editing user's display name. 2021-01-01 19:46:31 -08:00
voussoir 8ecf594945 Move jsonify methods into the objects instead of separate file. 2021-01-01 17:02:01 -08:00
voussoir d3f6d6b26a Add exceptions to warning_bag instead of strings for some.
I was adding messages as strings because that's how they get shown on
the web interface. But it's better to return the real exception objects
and have the interface deal with it.
2021-01-01 17:02:01 -08:00
voussoir 469103e0ac Use voussoirkit.stringtools for comma_space_split. 2020-11-15 22:20:36 -08:00
voussoir 881ce5e3ae With specific tag, start the export with the children.
This prevents the specific tag from being included in the results in
the first place, and has the knock-on effect that the descendants'
lines won't all start with the parent tag's name.
2020-10-17 18:23:38 -07:00
voussoir 6b71af307c Let Slate be the default theme.
Hooray for dark mode. Sorry classic turquoise.
2020-10-17 18:12:42 -07:00
voussoir 90e7f6b6e1 Rewrite tag_export.easybake as a generator. 2020-10-17 17:56:21 -07:00
voussoir 86c09aedc1 Add album_autocomplete.js, so "Add child" box can autocomplete.
This makes putting albums together a little easier, though datalist
performance still leaves a lot to be desired.
2020-10-03 18:37:08 -07:00
voussoir e09c3300d1 Let cached_endpoint pass the content-type header through. 2020-10-03 18:30:16 -07:00
voussoir d8276b763d Fix default theme evaluation. 2020-10-01 19:58:23 -07:00
voussoir 5e6a666ca2 Add option --localhost_only. 2020-09-30 15:15:49 -07:00
voussoir 7e58c95f15 Mostly failed experiment: tag_autocomplete indexeddb.
The current system has bad performance when you've got 100,000+ tags.
I discovered that when the server returns 304, the browser gives the
ajax a 200 with the full response, and it's not clear to me if js can
know it got a 304. So, the tag set is being fully re-parsed from the
response on every page load. I was thinking that I should store that in
IndexedDB to avoid the parsing step, but... since the JSON.parse is
done by my common.get before it hits this function, it's meaningless.
Not to mention I still have to rebuild the datalist on every page since
of course that state isn't shared between tabs. Not worth the DB stuff.
We'll see what happens next.
2020-09-29 16:52:20 -07:00
voussoir 63bc2dfed5 Add yield_photos, count albums in search result limit.
This experiment of bringing Photos and Albums closer to parity in
search is going well so far. I have found some situations where it
is nice to only get albums back from search results.
2020-09-27 23:38:49 -07:00
voussoir 72229a9c3b When adding/removing photos, respond with updated album json. 2020-09-27 23:35:12 -07:00
voussoir d152987b97 Let /album/add_child, /remove_child take multiple IDs. 2020-09-27 23:35:01 -07:00
voussoir 78a3aa36a8 Let make_attributes replace underscores with hyphens in attr names. 2020-09-27 12:14:20 -07:00
voussoir 667c14f072 Add search argument within_directory. 2020-09-27 10:48:01 -07:00
voussoir 41353b2eb4 Move current default css into theme_turquoise. Always pick a theme. 2020-09-25 16:27:47 -07:00
voussoir f5d8898e14 Increase search limit to 1,000. 2020-09-24 14:28:38 -07:00
voussoir 343ce508bf Add search UI for yield_albums. 2020-09-24 14:26:51 -07:00
voussoir 28181428be Synchronize Etiquette and YCDL. 2020-09-22 02:54:26 -07:00
voussoir f8e03bed21 Replace usage of row[0] with (column,) tuple unpack. 2020-09-20 13:41:22 -07:00
voussoir f56da72881 Return more sets from backend, do sorting on frontend.
It's better semantically for these items coming out of the backend
to be sets. Sorted lists are only relevant to human consumption at the
frontend.
2020-09-20 13:16:52 -07:00
voussoir f70349470f Don't gzip large responses. 2020-09-20 01:06:23 -07:00
voussoir adb1d0ef39 Replace all double blank lines with single, improve hash headers.
There was always some semblance that two blank lines has some kind of
meaning or structure that's different from single blank lines, but
in reality it was mostly arbitrary and I can't stand to look at it
any more.
2020-09-19 03:13:23 -07:00
voussoir a7cc6d2383 Rename all caught exception variables to "exc", not "e". 2020-09-19 03:08:45 -07:00
voussoir 7f410f1da5 Remove leftover /apitest endpoint. 2020-09-19 03:02:14 -07:00
voussoir 2ac6633f55 Remove leftover print statement. 2020-09-18 21:36:09 -07:00
voussoir 838982b6c3 Let login take username.
This cuts back on unnecessary sql selects.
2020-09-17 21:02:55 -07:00
voussoir c91888a738 Some linting. 2020-09-15 19:47:07 -07:00
voussoir 50ecc4c1c1 Let digest_directory act as a generator, yielding photos & albums. 2020-09-15 13:48:06 -07:00
voussoir b98ed27291 Change url parameter /tags?synonyms -> include_synonyms.
I keep forgetting that the url parameter name isn't the same as the
python variable name.
2020-09-14 05:52:00 -07:00
voussoir ff312d1e16 Let /tags pull from cached easybake export. 2020-09-14 05:49:49 -07:00
voussoir a51d22bf71 Rename argument specific_tag -> tagname like the other endpoints. 2020-09-12 11:43:53 -07:00
voussoir 42d4b7fafb Add give_token, catch_etiquette_exception to all endpoints at once. 2020-09-12 11:43:25 -07:00
voussoir f7e5b639e3 Remove *args from common.render_template. Just template_name. 2020-09-12 10:13:24 -07:00
voussoir ee28779138 Pass separate tag_count into tags.html to prevent double-counting.
Foolishly, I was checking the length of the outputted easybake format,
which included lines for synonyms and multi-parent tags that shouldn't
be part of the tag count.
2020-09-11 23:52:23 -07:00
voussoir f640268793 Gzip responses. 2020-09-11 23:12:37 -07:00
voussoir b0dcc6d3c6 Separately count photo results to fix included albums counting.
I'm currently running an experiment where albums are also included in
search results, but they don't cost you any of your limit parameter.
So the len(results) was often bigger than limit and tricking this
paginator into thinking we needed a next page when really we didn't.
This workaround can be undone when I decide how to make the album
results more official.
2020-09-11 23:12:23 -07:00
voussoir 8d2af3255b Add endpoints set_searchhidden, unset_searchhidden and checkbox. 2020-09-09 20:51:15 -07:00
voussoir 7762a8ff07 Rename post_photo_searchhidden -> post_batch_photos_searchidden. 2020-09-09 19:27:22 -07:00
voussoir 193c8645ed Save the user's CSS theme in a cookie so it stays across pages. 2020-09-09 19:26:11 -07:00
voussoir cb881ed640 Add httponly to session cookie. 2020-09-09 19:19:35 -07:00
voussoir 2ba4a3bb91 Add constant RESPONSE_TYPES for use in isinstance checks. 2020-09-09 18:53:51 -07:00
voussoir 049d620789 Convert cookies to werkzeug MultiDict instead of plain dict.
I discovered that werkzeug stores cookies in lists, with its .get
returning only the first item of the list. By converting the cookies
to a plain dict, I was breaking that functionality of cookies.get.
So, using werkzeug's MultiDict is the correct choice.
2020-09-09 18:53:26 -07:00
voussoir c425d55331 Use decorators in jinja_filters to automatically register them. 2020-09-09 13:23:16 -07:00
voussoir 199a4af658 Remove unnecessary intermediate variable view. 2020-09-09 13:15:21 -07:00
voussoir 6d5cd11612 Let search_core return tags as real lists.
This lets search.html deal with real objects instead of playing with
dumed-down strings.
2020-09-09 13:09:48 -07:00
voussoir d585fe92a9 Let search_core return author as real list.
This lets search.html deal with real objects instead of playing with
dumed-down strings.
2020-09-09 13:08:41 -07:00
voussoir 94b811b3b1 Let search_core return extension as real list.
This lets search.html deal with real objects instead of playing with
dumed-down strings.
2020-09-09 13:07:22 -07:00
voussoir c0f24732e1 Remove useless intermediate variable search_kwargs. 2020-09-09 12:13:18 -07:00
voussoir 18c2f0dc78 Rename vars photos -> results since results may contain albums. 2020-04-02 23:27:47 -07:00
voussoir dd3d40de53 Experimental: Allow search results to include albums.
I've been thinking about this for a while but couldn't think of
the perfect way to implement it. I still haven't, so instead I'm
just starting with something and we'll see how to improve later.
At any rate, I can update the rest of the system to expect Albums
coming out of search so that if I ever have a better algorithm
everything else will already be ready for it.
For this first experiment, just any photos that are part of an album
will send that album out as a result. It doesn't even respect the
limit parameter, it's really just to see how it feels to use.
2020-04-02 22:36:40 -07:00
voussoir 5a394c4376 Use len(photos) >= limit instead of ==. 2020-04-02 22:21:54 -07:00
voussoir 32a161baa8 Fix prev_page_url offset when on page 2 going back to page 1. 2020-04-02 21:37:50 -07:00
voussoir faf0c62426 Check if limit is falsey to avoid useless prevnext buttons.
If limit is 0 then you get prev and next links which also have
limit 0 and are pointless to click.
2020-03-28 17:38:10 -07:00
voussoir a00fb65758 Don't leave falsey values out of dict_to_params, let caller do it.
Explicit is better than implicit and all that.
2020-03-28 17:37:28 -07:00
voussoir a30649b0a8 Replace looping set.add with set.update. 2020-03-19 17:38:51 -07:00
voussoir 45cb96cc5c Add endpoint /photo/photo_id/delete. 2020-02-26 18:57:29 -08:00
voussoir 02db1f3971 Make response_type required, explicit in all calls. 2020-02-26 17:50:36 -08:00
voussoir 9d620b4b97 Remove unused imports & other small things. 2020-02-20 22:44:56 -08:00
voussoir 4a193d228c Add commit=True to frontend where necessary. 2020-02-20 00:34:28 -08:00
voussoir 854fa4db51 Rename PDB.register_user -> new_user.
I was treating User a little bit special here, but I prefer to
have the more consistent terminology.
2020-02-20 00:18:40 -08:00
voussoir 04f3f6f297 Remove commit=False from all method calls, it's default now. 2020-02-19 22:20:21 -08:00
voussoir ae6ab72536 Add jinja_filters.make_attributes.
Actually it's a function but not a filter. For creating html
attributes out of a dict.
2020-01-14 15:10:47 -08:00
voussoir 89bfca8f9f Add endpoint for photo generate thumbnail. 2020-01-12 14:52:03 -08:00
voussoir 7ecfeca96c Allow setting display name during registration. 2019-08-26 14:32:51 -07:00
voussoir d7307a6c44 Centralize flask.render_template calls to simplify common args. 2019-08-14 13:40:52 -07:00
voussoir 9ab0a61cb3 Add endpoint for refreshing Album directories. 2019-06-15 02:44:46 -07:00
voussoir 0eb9addb1c Use a single constant for both areas of caching duration. 2019-01-13 14:47:13 -08:00
voussoir 707fdcc637 Add album cards and improve album pages.
- album card has placeholder for future thumbnail.
- replaced nested tree hierarchy lists with separate boxes.
- list/grid view also applies to the root listing.
- added a sticky right panel for all the tools. not pretty yet.
- mechanism for adding sticky panel changed. instead of applying
  it to the #right, you apply it to #content_body so that its
  grid layout can be updated properly.
2018-11-12 22:15:59 -08:00
voussoir 6e312bd287 Rename the etiquette_flask backend package to backend.
Alright, I got tired of confusing myself with the same-named
outer and inner package.
Keep in mind that every frontend implementation is supposed to be
its own independent project where etiquette is nothing but a
dependency. So the name backend is not ambiguous with the etiquette
backend.
2018-11-04 19:45:23 -08:00