navidrome/ui/src/consts.js
Deluan 8d77a49b31 fix(ui): allow setting a transcoding Default Bit Rate of 0
The Default Bit Rate dropdown on the Transcoding create/edit forms was fed
BITRATE_CHOICES, which starts at 32. There was no way to pick 0, and the
SelectInput was not resettable, so an admin could neither create nor restore a
transcoding with no default bit rate, such as the default FLAC one (seeded with
0 in consts.DefaultTranscodings). Editing that row also rendered a blank
dropdown, since its stored value matched no choice.

Adds TRANSCODING_BITRATE_CHOICES, which prepends a 0 entry labelled 'None' to
the shared list. The forms use it as SelectInput choices, and the list and
read-only show view render it through SelectField, so all four screens resolve
the label from the same array and cannot drift. The shared BITRATE_CHOICES is
left untouched, because 0 is not a meaningful option for the player Max. Bit
Rate or the share dialog.

Reported in discussion #6107, where a user had deleted the default
transcodings and could not recreate the FLAC one.
2026-09-09 17:35:03 -04:00

39 lines
969 B
JavaScript

export const REST_URL = '/api'
export const INSIGHTS_DOC_URL =
'https://navidrome.org/docs/getting-started/insights'
export const M3U_MIME_TYPE = 'audio/x-mpegurl'
export const AUTO_THEME_ID = 'AUTO_THEME_ID'
export const AUTO_THEME_CONFIG_VALUE = 'Auto'
export const DraggableTypes = {
SONG: 'song',
ALBUM: 'album',
DISC: 'disc',
ARTIST: 'artist',
ALL: [],
}
DraggableTypes.ALL.push(
DraggableTypes.SONG,
DraggableTypes.ALBUM,
DraggableTypes.DISC,
DraggableTypes.ARTIST,
)
export const RADIO_PLACEHOLDER_IMAGE = 'internet-radio-icon.svg'
export const DEFAULT_SHARE_BITRATE = 128
export const BITRATE_CHOICES = [
32, 48, 64, 80, 96, 112, 128, 160, 192, 256, 320,
].map((b) => ({ id: b, name: b.toString() }))
// 0 is a valid stored value ("no default bit rate") that BITRATE_CHOICES cannot express.
export const TRANSCODING_BITRATE_CHOICES = [
{ id: 0, name: 'resources.transcoding.choices.noDefaultBitRate' },
...BITRATE_CHOICES,
]