Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ jobs:
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
imagemagick \
zsync \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
Expand Down Expand Up @@ -215,11 +216,21 @@ jobs:
- name: Package AppImage
run: bash packaging/appimage/build-appimage.sh

- name: Generate zsync
# -u is the final asset URL (name after create-release renames it), -f the
# name stored in the .zsync. The bytes do not change on rename, so it stays valid.
run: |
zsyncmake -u "https://github.com/kushiemoon-dev/FLACidal/releases/download/${GITHUB_REF_NAME}/flacidal_linux_amd64.AppImage" \
-f flacidal_linux_amd64.AppImage \
-o build/bin/flacidal-x86_64.AppImage.zsync build/bin/flacidal.AppImage

- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: flacidal-linux
path: build/bin/flacidal.AppImage
path: |
build/bin/flacidal.AppImage
build/bin/flacidal-x86_64.AppImage.zsync

create-release:
name: Create Release
Expand Down Expand Up @@ -277,4 +288,5 @@ jobs:
artifacts/flacidal-macos/flacidal.dmg
artifacts/flacidal-macos/flacidal_darwin_all.zip
artifacts/flacidal-linux/flacidal_linux_amd64.AppImage
artifacts/flacidal-linux/flacidal-x86_64.AppImage.zsync
checksums.txt
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- With `AUTH_TOKEN` set, `/api`, `/ws` and `/ws/queue` require a bearer token; `GET /api/health` and the web app stay public. The browser asks for the token on first access.
- Without a token on a loopback address, requests with a foreign `Host` header are rejected.
- The wildcard CORS policy is gone: cross-origin calls need an origin listed in the new `CORS_ORIGINS` variable.
- File routes of the headless server (delete, metadata, cover, rename, convert, lyrics, analyzer by path) are confined to the download folder and the external library paths, symlinks included. Deleting is limited to `.flac` files.
- File routes of the headless server (delete, metadata, cover, rename, convert, lyrics, analyzer by path) are confined to the download folder and the external library paths, symlinks included. Deleting is limited to `.flac` and `.m4a` files.
- The download folder and external library paths saved through the API must be absolute and cannot be `/`.

### Extensions
Expand All @@ -17,6 +17,19 @@
- **Extensions in the source order**: installed extensions show up in the source priority list and can be dragged like any other source. By default they sit right before Soulseek.
- Needs FLACidal-Core v0.30.0.

### Search, Files and Analyzer
- **Label filter in Search > Albums**: filters the albums already found by the text search, without starting a new search, and shows the label on each card. Albums without a known label are left out while the filter is on, and counted under the field. The label comes from a detail lookup for the first 20 results (4 at a time); a failed lookup leaves that label empty and never breaks the search. Latency added by the lookups: up to 5 rounds of one request, not measured against the live proxies yet.
- **Atmos button** on every Tidal track and album in Search: queues that item as Dolby Atmos (lossy `.m4a`) without changing the quality setting. A track with no Atmos version fails with `this track has no Dolby Atmos version` instead of falling back to another quality. Other sources can still be tried after a Tidal failure, as before, so a track without Atmos may end up as FLAC from another source. Without a quality in the request, nothing changes.
- **`quality` in the headless API**: `POST /api/downloads/queue`, `/api/downloads/single` and `/api/downloads/queue/album` accept `quality` (`HI_RES`, `HI_RES_LOSSLESS`, `LOSSLESS`, `HIGH`, `LOW`, `ATMOS`); anything else is a 400 before any side effect.
- **Files lists `.m4a`** (Atmos and AAC downloads) with a badge, and they can be analyzed and deleted. FLAC rows have no badge. The file list gains an additive `codec` field; mobile callers are unaffected.
- **Analyzer by batch**: progress (`n of total`), a Cancel button that keeps the results already received, files in error listed apart with their message, and CSV or JSON export (a save dialog on the desktop, a download in the browser). Up to 5000 files per batch, analyzed `min(NumCPU, 4)` at a time. The batch is also used by the analysis dialog of Files.
- **Headless analyzer**: `POST /api/analyze/batch` (progress on `/ws` as `analyze-progress`), `POST /api/analyze/batch/:id/cancel` and `POST /api/analyze/report?format=csv|json`. More than 5000 files is a 413; each path is still confined to the allowed folders and a refused path becomes an error row. CSV cells starting with `=`, `+`, `-` or `@` are neutralised.
- Light theme: the verdict badges of the Analyzer and the download buttons of Search now meet the contrast ratio.
- Needs FLACidal-Core v0.32.0.

### AppImage updates
- The AppImage embeds its update information (`gh-releases-zsync`) and each release publishes a `flacidal-x86_64.AppImage.zsync`, so AppImageUpdate can fetch deltas. The `.zsync` name has no `linux` in it on purpose, to keep the in-app updater's asset choice unambiguous (covered by a test).

### Web parity
- **Server file browser** (English, French, German, keyboard and screen reader friendly) replaces the native pickers in the browser: Analyzer, Converter, Resampler, Lyrics and File Manager choose files and folders on the server. Tools stay inside the download folder and the library paths (`GET /api/browse?scope=tools`); picking a download folder or library works anywhere on the server and lists folders only (`scope=folders`). `GET /api/browse/flac` lists the FLAC files of a chosen folder.
- **Export and import of the config in the browser**: `GET /api/config/export` and `POST /api/config/import`, same file format as the desktop app, the 8 credentials blanked, the user and password removed from every URL (proxy, Jellyfin, custom endpoints), and the server token never included.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Reach the Tools panel through the grid icon in the sidebar:

| Tool | What it does |
|------|-------------|
| **Quality Analyzer** | Examines actual frequency content to confirm true lossless status, reports BPM/musical key, and can retag from Deezer (album/tracknumber/discnumber/year/genre/cover) |
| **Quality Analyzer** | Examines actual frequency content to confirm true lossless status, reports BPM/musical key, and can retag from Deezer (album/tracknumber/discnumber/year/genre/cover); analyzes up to 5000 files per batch with progress and cancel, and exports a CSV or JSON report |
| **Resampler** | Adjusts sample rate (192 kHz down to 44.1 kHz, for instance) |
| **Converter** | Transcodes to other formats (MP3, AAC, OGG, Opus, Vorbis, ALAC, WAV, AIFF) through FFmpeg |
| **File Manager** | Batch-renames files based on metadata templates |
Expand Down Expand Up @@ -266,7 +266,7 @@ Settings live at `~/.flacidal/config.json` and can be edited from within the app

| Setting | Default | Options |
|---------|---------|---------|
| Quality | `Lossless` | `Hi-Res` (24-bit/48kHz+) · `Lossless` (16-bit/44.1kHz) · `High` (320kbps, lossy) · `Atmos` (lossy, .m4a, Tidal only) |
| Quality | `Lossless` | `Hi-Res` (24-bit/48kHz+) · `Lossless` (16-bit/44.1kHz) · `High` (320kbps, lossy) · `Atmos` (lossy, .m4a, Tidal only; the **Atmos** button in Search downloads one track or album this way without changing the setting) |
| File naming | `{artist} - {title}` | Custom template with metadata variables |
| Embed cover art | `true` | `true` · `false` |
| Concurrent downloads | `4` | `1` – `10` |
Expand Down
83 changes: 83 additions & 0 deletions frontend/e2e-http/10-analyzer-batch.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import fs from 'node:fs'
import { test, expect } from '@playwright/test'
import { seedFlac, setFolder } from './helpers'
import { TOKEN, TOKEN_URL } from './servers'

interface BatchBody {
results: Array<{ filePath: string; verdict: string; details: string }>
cancelled: boolean
total: number
}

test.describe('Batch analysis on the real server', () => {
let dir: string

test.beforeEach(async ({ request }) => {
dir = seedFlac(['alpha.flac'])
await setFolder(request, dir)
})

test.afterEach(() => {
fs.rmSync(dir, { recursive: true, force: true })
})

test('a mixed batch keeps one row per path and shows the confinement error', async ({ request }) => {
const inside = `${dir}/alpha.flac`
const res = await request.post('/api/analyze/batch', {
data: { batchId: 'e2e-mixed', paths: [inside, '/etc/hostname'] },
})
expect(res.status()).toBe(200)
const body = (await res.json()) as BatchBody
expect(body.total).toBe(2)
expect(body.cancelled).toBe(false)
expect(body.results).toHaveLength(2)
const outside = body.results.find((r) => r.filePath === '/etc/hostname')
expect(outside?.verdict).toBe('error')
expect(outside?.details).not.toBe('')
expect(body.results.some((r) => r.filePath === inside)).toBe(true)
})

test('refuses a batch above the ceiling with 413 before doing any work', async ({ request }) => {
const paths = Array.from({ length: 5001 }, (_, i) => `${dir}/${i}.flac`)
const res = await request.post('/api/analyze/batch', { data: { batchId: 'e2e-big', paths } })
expect(res.status()).toBe(413)
expect((await res.json()).error).toContain('maximum 5000')
const multiple = await request.post('/api/analyze/multiple', { data: { paths } })
expect(multiple.status()).toBe(413)
})

test('cancelling an unknown batch is a 404', async ({ request }) => {
const res = await request.post('/api/analyze/batch/nope/cancel')
expect(res.status()).toBe(404)
})

test('the report comes back as a CSV download with the formula neutralised', async ({ request }) => {
const res = await request.post('/api/analyze/report?format=csv', {
data: { results: [{ filePath: '/m/=cmd.flac', fileName: '=cmd.flac', verdict: 'lossless', verdictLabel: 'True Lossless' }] },
})
expect(res.status()).toBe(200)
expect(res.headers()['content-disposition']).toContain('analysis_report.csv')
const text = await res.text()
expect(text.split('\n')[0]).toContain('path,file,verdict')
expect(text).toContain("'=cmd.flac")
const bad = await request.post('/api/analyze/report?format=xml', { data: { results: [{ filePath: '/a' }] } })
expect(bad.status()).toBe(400)
})
})

test.describe('Batch analysis routes need the token', () => {
test.use({ baseURL: TOKEN_URL })

for (const [method, route] of [
['POST', '/api/analyze/batch'],
['POST', '/api/analyze/batch/x/cancel'],
['POST', '/api/analyze/report?format=csv'],
] as const) {
test(`${method} ${route} answers 401 without a token`, async ({ request }) => {
const res = await request.fetch(route, { method, data: {} })
expect(res.status()).toBe(401)
const withToken = await request.fetch(route, { method, data: {}, headers: { Authorization: `Bearer ${TOKEN}` } })
expect(withToken.status()).not.toBe(401)
})
}
})
47 changes: 47 additions & 0 deletions frontend/e2e-http/11-files-m4a.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { test, expect } from '@playwright/test'
import { setFolder } from './helpers'

test.describe('.m4a files on the real server', () => {
let dir: string

test.beforeEach(async ({ request }) => {
dir = fs.mkdtempSync(path.join(os.tmpdir(), 'flacidal-e2e-m4a-'))
// Arbitrary bytes: without a usable ffprobe result the entry is still listed, just without a codec.
for (const n of ['song.m4a', 'song.mp3']) fs.writeFileSync(path.join(dir, n), 'not real audio')
await setFolder(request, dir)
})

test.afterEach(() => {
fs.rmSync(dir, { recursive: true, force: true })
})

test('lists the .m4a (and not the .mp3), then deletes it', async ({ request }) => {
const list = await request.get('/api/files')
const files = (await list.json()) as Array<{ name: string; format: string }>
expect(files.map((f) => f.name)).toEqual(['song.m4a'])
expect(files[0].format).toBe('m4a')

const del = await request.delete(`/api/files?path=${encodeURIComponent(path.join(dir, 'song.m4a'))}`)
expect(del.status()).toBe(200)
expect(fs.existsSync(path.join(dir, 'song.m4a'))).toBe(false)
})

test('still refuses an .mp3 (400) and a path outside the folders (403)', async ({ request }) => {
const mp3 = await request.delete(`/api/files?path=${encodeURIComponent(path.join(dir, 'song.mp3'))}`)
expect(mp3.status()).toBe(400)
expect(fs.existsSync(path.join(dir, 'song.mp3'))).toBe(true)

const outside = path.join(os.tmpdir(), `outside-${Date.now()}.m4a`)
fs.writeFileSync(outside, 'x')
try {
const res = await request.delete(`/api/files?path=${encodeURIComponent(outside)}`)
expect(res.status()).toBe(403)
expect(fs.existsSync(outside)).toBe(true)
} finally {
fs.rmSync(outside, { force: true })
}
})
})
65 changes: 65 additions & 0 deletions frontend/e2e/15-analyzer-batch.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { test, expect, type Page } from '@playwright/test'
import { injectWailsMocks, type WinAny } from './mocks/wails'
import { expectNoBlockingViolations, setTheme } from './axe'

const row = (name: string) => ({
filePath: `/music/${name}`, fileName: name, verdict: 'lossless', verdictLabel: 'True Lossless',
isTrueLossless: true, confidence: 95, spectrumCutoff: 22000, expectedCutoff: 22050,
details: '', sampleRate: 44100, bitDepth: 16, bpm: 0, musicalKey: '',
})
const errorRow = (name: string) => ({
...row(name), verdict: 'error', verdictLabel: 'Error', isTrueLossless: false, confidence: 0,
details: 'cannot decode', sampleRate: 0, bitDepth: 0,
})

const PATHS = ['/music/a.flac', '/music/bad.flac', '/music/c.flac']
const RESULTS = [row('a.flac'), errorRow('bad.flac'), row('c.flac')]

async function startBatch(page: Page, delayMs: number) {
await injectWailsMocks(page, { OpenFLACFilesDialog: PATHS, AnalyzeBatch: { results: RESULTS, delayMs } })
await page.goto('/')
await page.locator('.sidebar button[title="Tools"]').click()
await page.locator('.flyout-item', { hasText: 'Audio Quality Analyzer' }).click()
await page.waitForTimeout(250)
await page.getByRole('button', { name: 'Select Files' }).first().click()
}

test.describe('Audio Quality Analyzer batch', () => {
test('shows progress, then lists the failing file apart from the results', async ({ page }) => {
await startBatch(page, 300)
await expect.poll(() => page.locator('.progress-text').first().textContent(), { intervals: [50] }).toContain('2 of 3')
await expect(page.locator('progress.analyze-progress').first()).toBeVisible()

await expect(page.locator('.errors-panel').first()).toContainText('bad.flac')
await expect(page.locator('.errors-panel').first()).toContainText('cannot decode')
await expect(page.locator('progress.analyze-progress')).toHaveCount(0, { timeout: 5000 })
await expect(page.locator('.results-table .table-row')).toHaveCount(2)
})

test('Cancel keeps the results received so far', async ({ page }) => {
await startBatch(page, 800)
await expect.poll(() => page.locator('.progress-text').first().textContent(), { intervals: [50] }).toContain('1 of 3')
await page.locator('.btn-cancel-analysis').first().click()

await expect(page.locator('.cancelled-note').first()).toContainText('Analysis cancelled')
await expect(page.locator('.results-table .table-row').first()).toBeVisible()
})

test('exports the report', async ({ page }) => {
await startBatch(page, 0)
await expect(page.locator('.btn-export-csv').first()).toBeEnabled()
await page.locator('.btn-export-csv').first().click()
const calls = await page.evaluate(() => (window as unknown as WinAny).__calls)
const exp = calls?.find((c) => c.name === 'ExportAnalysisReport')
expect(exp?.args[0]).toBe('csv')
})

for (const theme of ['dark', 'light'] as const) {
test(`has no blocking accessibility violations (${theme})`, async ({ page }) => {
await startBatch(page, 0)
await expect(page.locator('.errors-panel').first()).toBeVisible()
await setTheme(page, theme)
await expectNoBlockingViolations(page, `analyzer ${theme}`)
})
}
})
Loading
Loading