Fix performance, add screenshots, make banner scrollable

- Make detail view banner scroll with content instead of staying fixed,
  preventing tall banners from eating screen space
- Optimize squashfs offset scanning with buffered 256KB chunk reading
  instead of loading entire file into memory (critical for 1.5GB+ files)
- Add screenshot URL parsing from AppStream XML and async image display
  with carousel in the overview tab
- Fix infinite re-analysis bug: has_appstream check caused every app
  without AppStream data to be re-analyzed on every startup. Now handled
  via one-time migration reset in v10
- Database migration v10: add screenshot_urls column, reset analysis
  status for one-time re-scan with new parser
This commit is contained in:
lashman
2026-02-27 18:44:50 +02:00
parent 1bb7a3bdc0
commit 8362e066f7
8 changed files with 231 additions and 34 deletions

View File

@@ -67,6 +67,7 @@ pub struct AppImageRecord {
pub release_history: Option<String>,
pub desktop_actions: Option<String>,
pub has_signature: bool,
pub screenshot_urls: Option<String>,
}
#[derive(Debug, Clone)]
@@ -364,6 +365,10 @@ impl Database {
self.migrate_to_v9()?;
}
if current_version < 10 {
self.migrate_to_v10()?;
}
// Ensure all expected columns exist (repairs DBs where a migration
// was updated after it had already run on this database)
self.ensure_columns()?;
@@ -741,6 +746,30 @@ impl Database {
Ok(())
}
fn migrate_to_v10(&self) -> SqlResult<()> {
let sql = "ALTER TABLE appimages ADD COLUMN screenshot_urls TEXT";
match self.conn.execute(sql, []) {
Ok(_) => {}
Err(e) => {
let msg = e.to_string();
if !msg.contains("duplicate column") {
return Err(e);
}
}
}
// Force one-time re-analysis so the new AppStream parser (screenshots,
// extended metadata) runs on existing apps
self.conn.execute(
"UPDATE appimages SET analysis_status = NULL WHERE analysis_status = 'complete'",
[],
)?;
self.conn.execute(
"UPDATE schema_version SET version = ?1",
params![10],
)?;
Ok(())
}
pub fn upsert_appimage(
&self,
path: &str,
@@ -825,6 +854,7 @@ impl Database {
release_history: Option<&str>,
desktop_actions: Option<&str>,
has_signature: bool,
screenshot_urls: Option<&str>,
) -> SqlResult<()> {
self.conn.execute(
"UPDATE appimages SET
@@ -843,7 +873,8 @@ impl Database {
project_group = ?14,
release_history = ?15,
desktop_actions = ?16,
has_signature = ?17
has_signature = ?17,
screenshot_urls = ?18
WHERE id = ?1",
params![
id,
@@ -863,6 +894,7 @@ impl Database {
release_history,
desktop_actions,
has_signature,
screenshot_urls,
],
)?;
Ok(())
@@ -907,7 +939,7 @@ impl Database {
appstream_id, appstream_description, generic_name, license,
homepage_url, bugtracker_url, donation_url, help_url, vcs_url,
keywords, mime_types, content_rating, project_group,
release_history, desktop_actions, has_signature";
release_history, desktop_actions, has_signature, screenshot_urls";
fn row_to_record(row: &rusqlite::Row) -> rusqlite::Result<AppImageRecord> {
Ok(AppImageRecord {
@@ -964,6 +996,7 @@ impl Database {
release_history: row.get(50).unwrap_or(None),
desktop_actions: row.get(51).unwrap_or(None),
has_signature: row.get::<_, bool>(52).unwrap_or(false),
screenshot_urls: row.get(53).unwrap_or(None),
})
}
@@ -1843,7 +1876,7 @@ mod tests {
[],
|row| row.get(0),
).unwrap();
assert_eq!(version, 9);
assert_eq!(version, 10);
// All tables that should exist after the full v1-v7 migration chain
let expected_tables = [