Commit Graph
180 Commits
Author SHA1 Message Date
zarzet 4d53d7f75c perf(network): revalidate stale Subsonic covers with their ETag
The daily cover check downloaded every stale Subsonic cover in full
and compared it with the cached file byte by byte, although the Link
desktop (and many servers) send an ETag and answer If-None-Match with
304. The first rescan of a day fetched all 500 album covers of a Link
library at original size.

The ETag of a downloaded cover is now kept beside it in
<cover>.etag together with the image length. A stale check sends
If-None-Match; a 304 keeps the path and touches the modification
time, like an unchanged download did, without reading a body. A 200
follows the existing rules (same bytes keep the path, changed bytes
get a new path behind .current) and stores the new ETag. A forced
refresh, a validator for other bytes, older caches and servers
without ETags behave as before.

The validator survives restarts. The Library cover prune (Dart and
Rust) keeps it with a referenced Subsonic cover, as it keeps the
.current pointer, and the song metadata cover cache still keeps 32
covers, each with its ETag, instead of counting ETags as covers.
Older builds ignore the files and their prune removes them.
2026-10-31 22:07:30 +07:00
zarzet caa4c4ef3b fix(link): rank web cover copies after every other cover
A web cover copy in a catalog's coverPath outranked real pictures: an
album's cover is its first song with a cover file, and every id tries
cover files before embedded pictures, so an album mixing a song that
embeds its picture (or a later song with a cover file) with a web-only
song served the copy for every song.

Catalog lines now carry copies in their own webCoverPath field. The
server tries them only after the cover files and embedded pictures it
tried before, the song's own copy first and then its album's; an album
falls back to its first song with a copy only when no song has a cover
file or an embeddable format, and an artist to such an album only when
no other has a cover. Ids that had any cover serve exactly what they
served before, and a catalog without the field reads as before.

A failed read of an audio file is no longer remembered as a file
without a picture, for getCoverArt and linkEmbeddedPictures alike; only
a file that was read through counts.
2026-10-30 19:41:42 +07:00
zarzet 6c35c81a6f feat(link): tell the desktop which audio files embed a picture
The desktop should fetch a web cover only for a song whose file has no
picture of its own. linkEmbeddedPictures answers, for a list of paths,
whether each file embeds a picture getCoverArt would serve (null when it
is not a readable file). It reuses mornye_core's cover extraction and the
server's format table and remembered files without a picture, so a later
getCoverArt does not read them again. Works while the server is stopped.
2026-10-30 19:41:42 +07:00
zarzet 515cfaf231 fix(replaygain): recognize Opus gain tags consistently 2026-10-30 19:39:35 +07:00
zarzet fcf5c60ec6 test(covers): cross-check the document slot and steady the marker test
The document scan slot test only compared the stem with the function that
computes it. A new test writes a thumbnail through the Rust scan's
cache_cover and expects library_cover_slot to find that file for the same
key, then checks that the newer of two current siblings wins.

The forced-scan test compared marker mtimes 20 ms apart, which can flake
on filesystems that store whole seconds; it now checks that each forced
scan rewrites the marker's contents. The padded ID3 cover test reuses the
shared backend and ID3 helpers.
2026-10-30 14:21:07 +07:00
zarzet 4bb348f843 fix(library): keep cover files that other stores still name
The cover prune after a full scan treated a library_covers file as in use
only when library.cover_path named it. Playlists, favorites, the saved and
dismissed playback sessions, recent items, the download queue, listening
statistics and download history (including Link save offline copies) copy
those paths, so their covers broke after the next full scan.

The prune now also reads every such text column (read-only, in pages,
filtered with instr) and keeps the files they name, rebased onto today's
cover directory so file:// URIs and paths from an older iOS container
match. The names join the private native projection, so Rust still never
reads a live database and a failed read cancels the sweep.

A Subsonic cover kept by a reference also keeps its
subsonic_<hash>.image.current pointer, in Rust and in the Dart fallback;
before, the pointer was always deleted and the next scan fetched and
renamed the cover again.
2026-10-30 14:15:10 +07:00
zarzet 338e9ba83c fix(covers): key library thumbnails by 128-bit SHA-256
Scan thumbnails were named by a 32-bit djb2 hash of "path|size|mtime" (or
the document key) and an existing file was reused without checking its
source, so two songs whose keys collided showed one cover. The Android
document scan had its own copy of the same hash.

Thumbnails are now named cover_<first 128 bits of SHA-256 of the key>, in
Rust for every scan and through library_cover_slot for the Kotlin document
scan, so reuse by name is safe. Rows that name older files keep working;
those files are not looked up again and are pruned once unreferenced.

A forced rescan can touch a .regenerate marker in the cover folder:
thumbnails older than it are extracted again under the same name instead
of being reused, and the newer of a .jpg and .png sibling wins.
2026-10-30 14:15:10 +07:00
zarzet 1e620c750a fix(link): key extracted cover pictures by their audio file
The ETag and the resized copy of an embedded picture came from its
extracted copy in the temp cache: path, mtime and length. Once the cache
trimmed that copy (4000 files) or the OS purged the temp folder, the
picture was extracted again with a new mtime, so the same image got a new
ETag (clients downloaded it again) and a second resized copy that
stayed in the cache beside the first.

The stamp of an embedded picture is now the audio file's path, mtime and
length, which already named the extracted copy. Every id that resolves
to one image (album, artist or song id) still shares one ETag and one
resized copy. Cover files keep their stamp and their ETags.
2026-10-30 07:42:07 +07:00
zarzet 46b4f4fbc5 fix(link): fall back when a listed cover file is gone
getCoverArt resolved an id to a single source: a song's own cover file,
else its album's, else embedded pictures. When the listed file was gone
(a pruned or moved Library thumbnail, a stale export) it answered 404,
although the album's cover file or the picture embedded in the song
could still serve it. The phone then showed a placeholder.

The catalog now returns every fallback in order (the song's own file,
its album's file, then the songs that can embed a picture) and the
server serves the first one on disk. 404 remains for ids with none.
Responses, content types and ETags for covers that resolve today are
unchanged.
2026-10-30 07:42:07 +07:00
zarzet a73f63772d chore(deps): update Flutter, native and Rust dependencies 2026-10-30 01:29:33 +07:00
zarzet 274cfb765c fix(library): read Opus tags with large artwork 2026-10-30 00:32:53 +07:00
zarzet c833a24212 fix(downloads): handle unsupported exclusive renames 2026-10-30 00:32:07 +07:00
zarzet d58565d287 feat(library): suggest songs under albums, singles and playlists
Albums, singles and playlists, online and in the Library, end with
"Suggested songs": up to ten songs like the ones above that the collection
does not hold yet, each with a preview, an add button and a click or tap
that downloads it. On a user playlist the add button adds the song there
and it leaves the suggestions; elsewhere it opens the playlist picker.
Phones list the songs as rows, desktop in the page's song table.

Suggestions come from a new optional extension method, getRelatedTracks,
which extensions declare with the relatedTracks capability: it takes up to
three of the collection's songs and returns songs in the shape of search
results. The extension most seeds came from is preferred so it can use
their IDs. Without such an extension, the first metadata provider is
searched by the collection's artists. A refresh button starts from other
songs, and loaded suggestions stay for ten minutes.
2026-10-29 02:23:07 +07:00
zarzet 4b18a270dd fix(metadata): save animated artwork during re-enrichment 2026-10-29 01:48:14 +07:00
zarzet 0cc70070c5 fix(deezer): prefer playable releases for ISRC matches 2026-10-29 01:43:06 +07:00
zarzet aa788591a3 fix(library): hide CUE sources after a complete split
Publish all split tracks and their visibility rule atomically while preserving the original files and playlist rows. Keep the rule across rescans, restore originals when outputs leave the visible Library, and stabilize Android SAF identities and artwork caching.

Validation: 84 Flutter tests, 19 native Library tests, scoped analyzer, formatting checks, and Android Kotlin compilation passed.
2026-10-28 20:43:10 +07:00
zarzet 2ad05be4bd fix(metadata): keep WAV INFO and ID3 tags in sync 2026-10-28 00:26:47 +07:00
zarzet b41f0d3eb4 fix(desktop): handle LRC sidecars and percent paths safely 2026-10-27 17:20:11 +07:00
zarzet 1f12076765 feat(search): recognize songs playing nearby
A microphone button in the empty search field listens to the room and
names the song, on phones and desktop.

- The audio fingerprint and the Shazam request run in Rust behind a new
  recognize_song data job, so every platform shares one path.
- Listening sends the audio so far at 4, 8 and 12 seconds and stops at
  the first match; quiet or short clips are reported instead of sent.
- A match can be played from the library (by ISRC, then title and
  artist), searched in Mornye, or opened in Shazam. Recent matches are
  kept in a local history.
- Android asks for the microphone only when listening starts; iOS and
  macOS gain the microphone usage description and entitlement. The Linux
  package recommends pulseaudio-utils for capture.
2026-10-26 01:33:56 +07:00
zarzet 1780693f6d feat(rust): describe how songs sound from decoded windows
Add an audio_features native data job that reads one or two decoded
mono windows and returns a compact, versioned vector of 42 numbers:
tempo and its confidence, loudness and its spread, brightness,
rolloff, flatness, onset rate and flux, low/mid/high band shares,
key, mode and key strength, and 13 MFCC means and spreads. Silent or
too short audio yields no features. The job reuses the hi-res FFT and
the AutoMix tempo detector and checks for cancellation as it goes.
2026-10-25 23:36:14 +07:00
zarzet e0ab3c10ca merge: integrate reviewed Windows and extension fixes 2026-10-25 23:19:03 +07:00
zarzet d8660ba95f fix(extensions): preserve verification after challenge failures (#610) 2026-10-25 22:30:42 +07:00
zarzet bf8d50eb8d fix: improve playback responsiveness and resource lifecycles
Prevent stale transport and lyric updates, cancel abandoned requests, bound Link and Subsonic buffering, and preserve native audio lifecycle ownership. Add regression coverage for startup, search and transfer cleanup.
2026-10-25 15:15:52 +07:00
zarzet 099f6b65ae feat(link): serve song lyrics over the songLyrics extension
The desktop now answers OpenSubsonic getLyricsBySongId with the lyrics
a song's file embeds, else its .lrc sidecar, as line-level structured
lyrics, and advertises songLyrics. The entry also carries the stored
text as mornyeRaw, so the phone can keep word timing, voices and
backing vocals that the line-level shape drops.
2026-10-25 14:05:49 +07:00
zarzet 925ffb1f3a fix(link): advertise the desktop over IPv4 only
mDNS answers on Wi-Fi carried every link-local IPv6 address of the
machine, including the loopback's fe80::1, which on most networks is
the router. Android before 14 keeps a single resolved address and could
pick it, leaving the phone with an unresolvable .local name, so finding
the computer failed and pairing needed a typed address. Loopback is not
advertised either; nobody on the network can use it.
2026-10-25 13:02:11 +07:00
zarzet b4b66fcca3 feat(link): start a phone-only song on the desktop while it uploads
Play on desktop no longer waits for the whole file. The phone posts
handoff/play once the bytes up to the resume point and a 512 KiB margin
are sent (all of them for an MP4 whose index follows the audio), naming
the upload in `arriving`; the rest uploads in the background, and later
songs wait for it.

The desktop serves an arriving file over loopback HTTP with Range
support, reading the part file as it grows, and the player opens that
URL through MusicPlayerRuntime.streamWhileArriving until the file is
whole. The queue entry keeps the final path, and the embedded cover is
read once the file lands. On Windows the Rust rename into place is
retried briefly, since an open reader blocks it.
2026-10-25 06:20:59 +07:00
zarzet 68bfd7624d feat(link): play the phone's own songs on the desktop
Play on desktop used to skip songs only the phone has. The phone now
asks the desktop which songs it lacks, uploads the current one first
(PUT /mornye/v1/files/<id>.<ext>, streamed to <app support>/link/received
and pruned to 4 GiB) and starts the desktop there. Later songs follow in
the background and handoff/append adds them in order.

getCoverArt also serves covers embedded in the audio file, so downloads
whose cover is only in the file no longer show up on the phone without
one.
2026-10-25 05:14:35 +07:00
zarzet 95a8a0f358 test(link): accept a reset when an idle WebSocket client is dropped
The silent test client answers queued pings on the closed connection,
and under load the reset can beat the close frame. The test still checks
the 1001 code when the frame is read and that the client is removed.
2026-10-25 04:01:54 +07:00
zarzet 758ea77327 fix(link): report the app version in Subsonic auth errors
Errors before authentication used the crate version (0.1.0) while every
other response carried the app version.
2026-10-25 04:01:54 +07:00
zarzet 796b26ba56 fix(link): let the server derive starred artist ids from names
The app reported favorite artists as ids it computed with a looser
normalization than the catalog, so some never matched. getStarred now
sends artist names and the server maps them with its own rule; unstar
matches favorites by name as well.
2026-10-25 02:38:02 +07:00
zarzet b0a02c6bd2 fix(link): list OpenSubsonic extensions without credentials 2026-10-25 02:30:05 +07:00
zarzet e78b53b2c4 Merge branch 'link/l1b-subsonic' into link/integration
# Conflicts:
#	rust_backend/crates/link/Cargo.toml
2026-10-25 02:29:31 +07:00
zarzet 7b72b384ba feat(link): serve the desktop library over OpenSubsonic
Index the NDJSON catalog export into albums, artists, genres and a
case- and diacritic-insensitive search, with contract ids (al-/ar- +
16 hex of SHA-256). Answer the catalog endpoints in OpenSubsonic JSON
or Subsonic XML, stream and download files with single-range support,
transcode through ffmpeg when asked (killed when the client goes
away), resize and cache cover art, and forward playlists, stars,
scrobbles and the play queue to the app with song ids expanded both
ways.
2026-10-25 02:28:06 +07:00
zarzet b53d12db58 feat(link): add the HTTPS server core and desktop link methods
Implements the Mornye Link server core (unit L1a) in mornye-link:
- tls: self-signed ECDSA P-256 certificate for mornye.local, generated
  once into cert.pem/key.pem, pinned by its SHA-256 fingerprint
- store: server.json and devices.json, atomic private writes
- auth: Subsonic apiKey, salted token and password schemes, Bearer keys
- pairing: 6-digit PIN window with HMAC proof, attempt limit, expiry
  and a per-address rate limit
- server/api: own Tokio runtime, port policy with persistence, dual-stack
  TLS listener, /rest routing to the Subsonic layer, /mornye/v1 info,
  pair, ws and forwarding with a request timeout
- ws: hello/welcome sessions, client list events, pushes, pings and
  idle drop, newest connection per device wins
- mdns: _mornye._tcp advertisement, best effort

mornye-desktop gains the link* methods and bridges forwarded requests
to Dart as linkRequest inbound calls answered by linkReply.
2026-10-25 02:24:55 +07:00
zarzet d430bd73d7 feat(link): add the Mornye Link crate skeleton and shared protocol types
Mornye Link lets the phone app use the desktop app over the local
network. This adds the mornye-link crate with the types its server and
Subsonic layers share, and the Dart protocol models, desktop request
router and phone client interface the feature units build on.
2026-10-25 01:57:47 +07:00
Illyasvelovna e8d0a56810 fix(desktop): hide the console window when running FFmpeg on Windows
mornye.exe is a GUI-subsystem app, so spawning the ffmpeg.exe console
program without creation flags makes Windows open a visible console
window for every conversion. Pass CREATE_NO_WINDOW, matching what
dart:io's Process.start already does for the Dart-side FFmpeg calls.
2026-10-24 04:54:34 -06:00
zarzet c55f513a77 chore(rust): update toolchain, Tokio, scraper and lockfile dependencies
Rust 1.99.1, Tokio 1.54.1, zip 9.0.5, libc 0.2.191 and
rustls-native-certs 0.8.5. scraper 0.29 moves to html5ever 0.40, so
the parser pin follows it. The Unicode 15 table pins and the vendored
rustix, cap-std and libusb1-sys sources stay as they are.
2026-10-24 12:12:27 +07:00
zarzet 29ded7e46e perf(preview): resolve extension previews when they play
Extensions that require the new deferredPreview runtime feature return
mornye-preview:<extension>/<track> links instead of a sample URL. The
preview player resolves such a link through the extension's
resolvePreview function when the preview starts, so a search no longer
waits for one sample lookup per track.
2026-10-24 11:35:08 +07:00
zarzet 22a0bee300 fix(downloads): trust the audio bytes over a provider's FLAC label
A provider could label a download as FLAC while returning other bytes,
and the backend then wrote FLAC tags into them and failed with "fLaC
head incorrect" (Mornye-Desktop issue #6), ending the whole download.
The download probe now reads the container from the file itself: FLAC,
including behind an ID3v2 tag, MP4 or MP3. A FLAC label on MP4 or MP3
bytes yields to the bytes, so the file is published with its real
suffix and FLAC in MP4 is still remuxed by the app. Unrecognized bytes
behind a FLAC label, such as an error page, fail that provider with a
clear message so the next provider can try.
2026-10-24 10:47:45 +07:00
zarzet 69407ccb31 feat(extensions): allow a network permission for any domain
Extensions that talk to self-hosted servers cannot know the host when the
manifest is written. A "*" entry in permissions.network now admits every
host, while HTTP still requires allowHttp and private or local addresses
still require the app's local network setting.

The extension detail page names the "*" grant and the HTTP grant instead
of showing them as ordinary domains.
2026-10-23 18:51:49 +07:00
zarzet 30c3e42d7d fix(lyrics): recover download lyrics after provider failures 2026-10-23 17:37:43 +07:00
zarzet 44c9ba9213 fix(automix): verify beat alignment and hold phase through the mix
Beat detection normalizes onsets against nearby energy, so a fade, a
loud fill or a quieter verse no longer dominates the pulse, and refines
the tempo in 0.01 BPM steps. The Dart and native analyzers stay in step.
An uncertain grid is retried on nearby windows and only accepted when
tempo and phase agree at both edges of the transition.

A beat-matched start now checks that the incoming deck actually landed
on the outgoing beat. When it cannot be verified, the mix falls back to
an unstretched crossfade instead of a misaligned stretch. During the
overlap, a phase lock makes small, bounded rate corrections from spaced
position samples and stops correcting when those samples are unreliable.

A measured but uncertain pulse gets a bass handoff without any tempo
change, and speed effects skip beat matching.
2026-10-23 15:39:44 +07:00
zarzet f37f7b1652 fix(tags): support ID3-prefixed FLAC metadata writes 2026-10-23 05:08:33 +07:00
zarzet 30a5c82f0f feat(library): list the files a scan could not read
A finished scan only reported how many files it skipped. The Rust
scanner and the Android SAF scan now record the first 100 failed files
with the reader's reason and include them in the finished progress
report.

Library settings show the count under each folder, and its actions
open a sheet listing each file, its folder and the reason. The list is
kept per folder across restarts, cleared by a clean scan and removed
with the folder. Network folders keep only the count.

Validation: provider, model and Rust scan tests, and the full Flutter
suite on a clean tree with only this series applied.
2026-10-23 03:50:05 +07:00
zarzet 1c2cca6659 fix(library): index songs whose tags fail to parse
Android Library scans counted a file as an error whenever its tag reader
failed, even when the audio was fine, so mixed folders that other
players list cleanly reported dozens of errors.

- Opus and Vorbis files with a comment header but no title or artist
  read as untagged songs instead of failing.
- The comment header is read up to 16 MiB instead of 80 pages, so a
  large cover written on small pages no longer hides the tags.
- Raw ADTS .aac files read ID3 or APEv2 tags, a cover, and quality from
  their frame headers. MP4 .aac files keep the MP4 reader.
- An ID3v2 tag in front of a FLAC stream is skipped.
- Interrupted and short reads from provider descriptors are retried
  instead of failing the read, and the last direct SAF read waits
  400 ms before its retry.

Damaged FLAC, MP3 and AAC streams are still rejected.

Validation: 7 new mornye-core format tests (6 fail without this
change), mornye-core, mornye-extensions and mornye-mobile tests, clippy,
and 17 SafMetadataReadPolicyTest cases.
2026-10-23 03:50:00 +07:00
zarzet 2b257c36d8 fix(windows): support UNC library paths and network downloads 2026-10-22 23:51:19 +07:00
zarzet 07bc4c35da fix(desktop): restore private file access after cache removal 2026-10-22 23:44:48 +07:00
zarzet 104b8a8491 chore(license): adopt LGPL-3.0-only for Mornye 2026-10-22 23:11:09 +07:00
zarzet 10b561486e fix(library): read tagless audio without losing document names
Distinguish readable MP3 and MP4 streams without tags from failed metadata reads. Preserve partial ID3 and MP4 tags, use the original display name for tagless documents, and expose parser failures to Android SAF scanning. Cover tagless files, partial tags, invalid data, cancellation, and revoked documents.
2026-10-22 21:23:03 +07:00
zarzet 11a9b9a4ec chore: remove redundant comments across the codebase 2026-10-22 01:41:09 +07:00