Commit graph

100 commits

Author SHA1 Message Date
Cadel Watson
d1f93a26a6 Fix lint errors 2020-09-20 11:30:12 +10:00
Cadel Watson
a18b317240 Add PATCH method to item queries 2020-09-20 10:46:48 +10:00
Cadel Watson
afcde697e0 Add PATCH method to Items 2020-09-20 10:45:12 +10:00
Cadel Watson
29672a434f Add DELETE method to resource queries 2020-09-20 10:23:25 +10:00
Cadel Watson
76220fb148 Add DELETE method for items and albums 2020-09-20 10:18:07 +10:00
Sören Tempel
6a03afc65d web plugin: support path queries by separating them with a backslash
Without this change the web plugin does not support path queries as
slashes are currently used for joining keywords in the QueryConverter.
Moreover, flask cannot distinguish between an URL encoded and a plain
'/' character during routing [0]. To work around this issue without
introducing a breaking change (i.e. removing the QueryConverter) use the
backslash character for path queries and convert it later on.

Fixes #3566

[0]: https://github.com/pallets/flask/issues/900
2020-04-27 13:36:36 +02:00
Adrian Sampson
d43d54e21c Try to work around a Werkzeug change? 2020-02-06 22:22:54 -05:00
Ryan Veach
1505ff071d changed flask cors import 2018-07-10 10:32:21 -05:00
Waweic
06d4fe254d Implement recommendations by sampsyo
Implemented all recommendations.
2018-03-06 17:49:20 +01:00
Waweic
3c3e579dcc Make programming style pep8 compliant 2018-03-01 20:20:38 +01:00
Waweic
d0fd41b474 Add unicode support for Python 2 and 3
Converts bytes to unicode using util.text_string, assuming that the
string is a UTF-8 string.
If that fails, it falls back to a hardcoded fallback filename.
2018-03-01 19:45:44 +01:00
Waweic
4df313e3ce Fix unicode problems in web plugin
Added Exception to the web plugin to catch non latin-1 characters and change them to ascii chars.
Added Description to the changelog file
2018-03-01 11:56:38 +01:00
Waweic
b94227a53d Merge https://github.com/waweic/beets into patch-2
Catch up
2018-02-27 22:03:50 +01:00
Adrian Sampson
453fd372a3 Flatten a config view (#2821) 2018-02-26 18:00:59 -05:00
Samuel Loury
e3599742b4 Add a support for supports_credentials
If the web plugin is behind a credential based http server and is
accessed by another in-browser client in another domain, the
specification of CORS requires the server to indicate it supports
such credentials.
2018-02-26 21:08:02 +01:00
waweic
be96c1022a
Fix album_art() in __init__.py
flask.send_file() expects a string, g.lib.get_album() returns bytes. Added decode() to album_art(). 

If g.lib.get_album() gets a non-existing id, it returns None. Python would throw an error in this case. Added check to prevent this.
2018-02-26 18:33:30 +01:00
Adrian Sampson
009c6a4f6d Slightly clearer layout for #2593, and comments 2017-06-15 17:51:14 -04:00
robot3498712
cafbb2438e fixed failing test - line too long 2017-06-15 13:27:28 +02:00
robot3498712
bc8a8ecf5f fix /issues/2592: web: Use Unicode paths to send files on Windows under Python 2 2017-06-15 12:49:00 +02:00
Adrian Sampson
b57c49d738 Add a period to a comment, simplify one expression
w.r.t. #2542
2017-05-04 09:29:27 -04:00
Mark Stenglein
22f07b91e9 web: __init__: _rep: Make the looping more pythonic
As suggested, changes around the for loop to make it a bit more
pythonic by using an if loop inside a normal for loop.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 16:36:40 -04:00
Mark Stenglein
9394e0ac63 web: __init__: _rep: change to base64 encoding
As suggested, this commit adds base64 encoding for the bytes
encoding.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 16:34:30 -04:00
Mark Stenglein
471d46d67e web: __init__: _rep: Filter all bytes for serializer
This commit fixes issue #2532 by filtering out any byte values
added by any other extensions and decoding them to strings for the
JSON serializer.

It does not remove any of the keys, instead opting to just convert
them.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 00:03:05 -04:00
Olivier Biesmans
cf384109f0 Make falke8 happy and reference flask doc for the ReverseProxied class 2017-03-19 21:16:26 +00:00
Olivier Biesmans
aa847e52ac Add reverse proxy support 2017-03-19 20:08:39 +00:00
Steve Johnson
926dce241c Use util.displayable_path instead of naive .decode() 2017-01-15 11:25:03 -08:00
Steve Johnson
e3707e45f3 Maybe fix code and tests for Windows 2017-01-15 11:21:59 -08:00
Steve Johnson
e2be6ba781 Query path with bytestring. Might fix tests. 2017-01-15 11:21:59 -08:00
Steve Johnson
4434569ddc beets.library.Library adds custom bytelower function to all connections, not just one 2017-01-15 11:21:59 -08:00
Steve Johnson
866a650bc0 Rename /item/by_path to /item/path and use PathQuery instead of direct file access 2017-01-15 11:21:33 -08:00
Steve Johnson
05bc4996a8 Rename and invert new config option 2017-01-15 11:21:33 -08:00
Steve Johnson
50ea74635b Fix tests I broke 2017-01-15 11:21:33 -08:00
Steve Johnson
f6cb46d490 Fix broken tests (no new ones yet) 2017-01-15 11:21:33 -08:00
Steve Johnson
43936cd84c /item/at_path/ endpoint
More at_path

/item/by_path docs
2017-01-15 11:21:33 -08:00
Steve Johnson
29d61ca634 web.exclude_paths_from_items option
More exclude_paths_from_items
2017-01-15 11:21:33 -08:00
dopefishh
8bb703619f use util.py3_path for web attachment filenames (#2353)
Web attachment filenames must be passed as a string for Python 3
2016-12-29 05:38:27 -05:00
Max Ammann
7242c5ed03 Revert "Expose the relative path to the library instead of omitting the 'path' variable"
This reverts commit 5e8ac9e4a5, because of
a slowdown. Resolves #2182.
2016-10-26 23:08:44 +02:00
Adrian Sampson
0833c82075 web: Fix a crash related to byte paths on Python 3 2016-08-12 19:59:07 +00:00
Max Ammann
5e8ac9e4a5 Expose the relative path to the library instead of omitting the 'path' variable 2016-06-26 19:53:57 +02:00
Max Ammann
2ae26548fc Modified and simplified is_expand(...) method 2016-06-26 19:53:57 +02:00
Max Ammann
619344c813 Added documentation for the expand parameter 2016-06-26 19:53:57 +02:00
Max Ammann
041adf47ac Fixed lines which are mor than 79 characters 2016-06-26 19:53:57 +02:00
Max Ammann
5831b99b9f Adding 'expand' flag for json requests
This allows you to query the individual items of an album
2016-06-26 19:53:57 +02:00
Adrian Sampson
5efd5b21c5 Use new as_str method
Instead of `get(six.text_type)`, which was a surprisingly large portion of our
uses of six.
2016-06-25 19:16:14 -07:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
94bab42f97 use strings (not bytes) for flask responder names 2016-05-30 21:19:15 -04:00
Adrian Sampson
59435792e9 Merge pull request #2010 from sumpfralle/web-api-unique-results
web: add API functions for retrieving unique values of specific keys
2016-05-27 00:15:34 -07:00
Lars Kruse
d50923553d web: add API functions for retrieving unique values of specific keys
the following API paths are added:
* /item/values/FIELD
* /album/values/FIELD

Both paths will deliver a json dictionary with the key 'values' containing a
list of unique values belonging to the requested table and field.
Sorting is possible by supplying the query argument "sort_key".

This feature is useful for remote clients, e.g. Mopidy-Beets:
* track genres: /item/unique/genre
* track languages: /album/unique/language
* album artists: /album/unique/albumartist?sort_key=albumartist_sort
* album years: /album/unique/year
2016-05-27 04:12:09 +02:00
Lars Kruse
be4dc227fc web: handle missing art gracefully 2016-05-24 03:05:51 +02:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00