Commit graph

126 commits

Author SHA1 Message Date
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Graham R. Cobb
4ffe9a2c45 Fixed bug where readonly value was not being read from config file.
Also simplified the setup of the `readonly` value in the tests which
fixes a test ordering issue found using --random-order.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-12 17:58:35 +00:00
Graham R. Cobb
51d22b765e Add tests for delete operations
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 18:02:38 +00:00
Graham R. Cobb
4a9652a9e4 Only allow DELETE or PATCH operations if "readonly" is set to true.
Note: default is false which is a **NOT BACKWARDS COMPATIBLE** change.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 18:02:38 +00:00
Graham R. Cobb
553e38fc11 Do not do backslash substitution on regex queries
As discussed in bug #3867, backslash replacement in query strings is a bit of a
hack but it is useful (see #3566 and #3567 for more discussion). However,
it breaks many regular expressions so this patch stops the replacement if the
query term contains '::', indicating it is a regex match.

This commit fixes #3867.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-08 16:58:05 +00:00
Graham R. Cobb
9986b9892c Fix bug where album artpath not returned when INCLUDE_PATHS is set
Track item paths and album artpaths should be removed from results unless
INCLUDE_PATHS is set. This works for items but for albums the artpath is always
removed.

This patch makes the artpath removal conditional on INCLUDE_PATHS not being set
and includes a regression test. Note: the default value for INCLUDE_PATHS is
False so no changes will be seen by users unless they already have
INCLUDE_PATHS set.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-06 15:25:48 +00:00
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
FichteFoll
aa31fea037
Update a lot of URLs to use HTTPS
*All* URLs were checked manually, but only once per domain!

I mostly concerned myself with URLs in documentation rather than source
code because the latter may or may not have impactful changes, while the
former should be straight forward.

Changes in addition to simply adding an s:

- changed pip and pypi references as their location has changed
- MPoD (iOS app) url redirects to Regelian, so I replaced those
- updated homebrew references

Notable observations:

- beets.io does have HTTPS set up properly (via gh-pages)
- beatport.py uses the old HTTP url for beatport
- as does lyrics.py for lyrics.wikia.com
- https://tomahawk-player.org/ expired long ago, but the http page
  redirects to https regardless
- none of the sourceforge subdomains have https (in 2019!)
2019-06-05 03:11:49 +02: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
Adrian Sampson
3b49da0c52 Merge pull request #2821 from Konubinix/master
Add a support for supports_credentials
2018-02-26 17:59:57 -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
waweic
df83516086
Fix jumping time in beets.js
Round was used instead of floor
2018-02-26 17:01:06 +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