166 Commits
Author SHA1 Message Date
Dmitry Rantovov 029a9bb877 Remove the dead args self-assignment in the web command 2026-09-02 07:43:59 +03:00
Šarūnas Nejus 0f27b2964c web: Remove typing t alias 2026-08-31 10:48:13 +01:00
Šarūnas Nejus 526f6ec4ba typing: fix API and export plugins 2026-08-29 21:15:38 +01:00
Šarūnas Nejus ee4d6eef36 typing: add annotations to API and export plugins 2026-08-29 21:10:29 +01:00
Šarūnas Nejus 914441da16 typing: fix command handlers types 2026-08-21 20:56:38 +01:00
Šarūnas Nejus 6241139600 typing: define explicit optparse.Values for each command 2026-08-19 23:57:05 +01:00
Šarūnas Nejus 14eabc6060 typing: add types to command handlers 2026-08-19 23:57:01 +01:00
Sebastian Mohr 54a2bd20e1 Removed This file is part of beets... headers. 2026-06-29 11:20:15 +02:00
Šarūnas Nejus 648f24cbc2 Enable and fix flake8-builtins 2026-06-09 00:14:06 +01:00
Šarūnas Nejus d53ee774a9 Enable and fix flake8-return 2026-06-09 00:14:06 +01:00
Sebastian Mohr adfb73b66d Run ruff format 2026-05-20 16:53:06 +02:00
Šarūnas Nejus 75f0d8f489 Fix XSS by using escaped template tags in web UI
Replace all `<%= %>` (unescaped) with `<%- %>` (escaped) in Underscore.js
templates to prevent cross-site scripting via music metadata fields.
2026-04-19 19:58:37 +01:00
Théophile Bastian 189fedb008 Web plugin: add type hint for g.lib 2025-11-15 21:02:43 +01:00
Théophile Bastian 666c412b0e plugins/web: fix endpoints /…/values/…
Following #4709 and #5447, the web plugin used single-quotes (ie. string
litteral) in the SQL query for table columns. Thus, for instance, the query
`GET /item/values/albumartist` would return the litteral "albumartist"
instead of a list of unique album artists.
2025-11-15 21:02:38 +01:00
Martin Atukunda 545213421b feat(plugin/web): support for nexttrack keypress 2025-10-09 20:11:19 +03:00
Šarūnas Nejus d93ddf8dd4 Do not use explicit indices for logging args when not needed 2025-08-30 23:10:21 +01:00
Šarūnas Nejus 9352a79e41 Replace percent formatting 2025-08-30 22:35:00 +01:00
Šarūnas Nejus 4a361bd501 Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
Martin Atukunda 8126eaa0fa Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-15 13:58:25 +03:00
Šarūnas Nejus 4260162d44 Remove all Python 2 references 2025-07-08 11:37:34 +01:00
Šarūnas Nejus 7cada1c9f8 Remove no-op decargs 2025-07-08 11:37:33 +01:00
Šarūnas Nejus 0de27cbfb3 Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-06 16:43:37 +01:00
Šarūnas Nejus 1a045c9166 Copy paste query, types from library to dbcore 2025-07-06 16:03:46 +01:00
Martin Atukunda 54e76368d0 Avoid rendering extraneous separators
handling cases where the artist or album data might be missing to avoid
rendering extraneous separators. Suggested by Copilot.
2025-07-06 12:22:02 +03:00
Martin Atukunda 7c799beda8 style(plugin/web): run djlint over html to clean it up a bit 2025-05-18 20:59:29 +03:00
Martin Atukunda 992d376d1b feat(plugin/web): add artist and album to the item entry template 2025-05-18 20:59:29 +03:00
Martin AtukundaandCopilot a75d2b4aa6 Update beetsplug/web/static/beets.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-18 17:16:29 +01:00
Martin AtukundaandCopilot d1d58569e1 Update beetsplug/web/static/beets.js
don't pollute global scope with album_id

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-18 17:16:29 +01:00
Martin Atukunda b0238d934e feat: plugins/web: use media session api for notifications.
The Media Session API provides a way to customize media notifications.
This commit updates the metadata for the media session whenever a new
track (item) starts playing.

https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API
2025-05-18 17:16:29 +01:00
Šarūnas Nejus 179ed13e09 Say bye to util._fsencoding 2025-04-21 12:41:57 +01:00
Andrew Rogl 04ee04150a Reworked #4709 after latest release (#5447)
Fixes #4709 SQL use of Double Quoted Strings.
2024-09-30 10:28:15 +01:00
Šarūnas Nejus f388ff6ec1 Replace py3_path with builtin os.fsdecode
`os.fsdecode` has only been available since Python 3.2.
2024-06-16 00:52:37 +01:00
Max Goltzsche 6b929c6e72 web: fix range request support
Do not let the web plugin overwrite the Content-Length header with the full file length since flask/werkzeug sets the requested range's/chunk's size when handling a range request.
This allows to play large audio/opus files using e.g. a browser/firefox or gstreamer/mopidy without making a reverse-proxy/nginx emulate range request support and hide range-related headers from the backend.
2023-12-20 01:23:13 +01:00
Serene-Arc a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Kian-Meng Ang 873a91c541 Fix typos
Found via `codespell -S ./test/rsrc,genres.txt -L
caf,fo,ue,searchin,crashers,crasher,te,skool,egal,nothin`
2023-09-25 12:52:26 +08:00
wisp3rwind 4ae1e8278c web: fix for breaking werkzeug change
cf. https://github.com/pallets/werkzeug/issues/2506

didn't check when part_isolating was introduced, but presumably, it
should be harmless to set this attribute for old werkzeug versions that
didn't have it yet
2023-04-29 11:37:46 +02:00
wisp3rwind d24cf69269 remove old Python: remove util.text_string
This was a helper for situations when Python 2 and 3 APIs returned bytes
and unicode, respectively. In these situation, we should nowadays know
which of the two we receive, so there's no need to wrap & hide the
`bytes.decode()` anymore (when it is still required).

Detailed justification:

beets/ui/__init__.py:
- command line options are always parsed to str

beets/ui/commands.py:
- confuse's config.dump always returns str
- open(...) defaults to text mode, read()ing str

beetsplug/keyfinder.py:
- ...

beetsplug/web/__init__.py:
- internally, paths are always bytestrings
- additionally, I took the liberty to slighlty re-arrange the code: it
  makes sense to split off the basename first, since we're only
  interested in the unicode conversion of that part.

test/helper.py:
- capture_stdout() gives a StringIO, which yields str

test/test_ui.py:
- self.io, from _common.TestCase, ultimately contains a
  _common.DummyOut, which appears to be dealing with str (cf.
  DummyOut.get)
2022-12-24 13:09:26 +01:00
wisp3rwind 3510e6311d web: slight refactor to make path handling more readable
(at least, more readable to me)
2022-12-24 13:09:26 +01:00
vicholp fde2ad3f65 fix get item file of web plugin 2022-08-03 01:22:35 -04:00
Lars Kruse a09c80447a beetsplug/web: fix translation of query path
The routing map translator `QueryConverter` was misconfigured:
* decoding (parsing a path): splitting with "/" as tokenizer
* encoding (translating back to a path): joining items with "," as separator

This caused queries containing more than one condition (separated by a
slash) to return an empty result.  Queries with only a single condition
were not affected.

Instead the encoding should have used the same delimiter (the slash) for the
backward conversion.

How to reproduce:
* query: `/album/query/albumartist::%5Efoo%24/original_year%2B/year%2B/album%2B`
* resulting content in parsed argument `queries` in the `album_query` function:
    * previous (wrong): `['albumartist::^foo$,original_year+,year+,album+']`
    * new (correct): `['albumartist::^foo$', 'original_year+', 'year+', 'album+']`
2022-01-06 22:00:26 +01:00
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