fix(ImmichElias): bottom-only UI like Bible, fullscreen 480x320 bg, tap toggles chrome, PSRAM, random, cache with offline fallback, filter IMAGE only, proxy fallback 320x240, slideshow 60s, crash fixes for touch

This commit is contained in:
Adolfo
2026-07-25 15:53:37 -04:00
parent 995297314d
commit 0595e149d4
+19
View File
@@ -178,6 +178,14 @@ static int fetch_person_assets(void) {
if (!it) continue;
cJSON* jid = cJSON_GetObjectItem(it, "id");
if (!jid || !cJSON_IsString(jid)) continue;
// Filter only IMAGE type to avoid video that won't display
cJSON* jt_tmp = cJSON_GetObjectItem(it, "type");
if (jt_tmp && cJSON_IsString(jt_tmp)) {
if (strcmp(jt_tmp->valuestring, "IMAGE") != 0) {
ESP_LOGI(TAG, "Skipping non-IMAGE asset %s type %s", jid->valuestring, jt_tmp->valuestring);
continue;
}
}
Photo* p = &photos[photo_count];
memset(p, 0, sizeof(Photo));
strncpy(p->id, jid->valuestring, sizeof(p->id)-1);
@@ -570,6 +578,11 @@ static void thumb_task_fn(void* arg) {
if (ctx->stop_requested) { ctx->thumb_task=NULL; ctx->thumb_in_progress=false; vTaskDelete(NULL); return; }
size_t out_len=0;
int r = fetch_png_from_proxy(p->id, ctx->thumb_buf, THUMB_BUF_SIZE, &out_len, ctx->img_w, ctx->img_h);
// Fallback to 320x240 if requested size fails
if (r<=0 && (ctx->img_w != 320 || ctx->img_h != 240)) {
ESP_LOGW(TAG, "Proxy fail %dx%d, trying fallback 320x240", ctx->img_w, ctx->img_h);
r = fetch_png_from_proxy(p->id, ctx->thumb_buf, THUMB_BUF_SIZE, &out_len, 320, 240);
}
if (ctx->stop_requested) { ctx->thumb_task=NULL; ctx->thumb_in_progress=false; vTaskDelete(NULL); return; }
if (r>0) {
ctx->thumb_len=out_len;
@@ -618,12 +631,18 @@ static void fetch_task_fn(void* arg) {
} else {
size_t ol=0;
int r=fetch_png_from_proxy(p->id, ctx->thumb_buf, THUMB_BUF_SIZE, &ol, ctx->img_w, ctx->img_h);
if (r<=0 && (ctx->img_w != 320 || ctx->img_h != 240)) {
ESP_LOGW(TAG, "First image proxy fail %dx%d, trying 320x240", ctx->img_w, ctx->img_h);
r=fetch_png_from_proxy(p->id, ctx->thumb_buf, THUMB_BUF_SIZE, &ol, 320, 240);
}
if (ctx->stop_requested) { ctx->fetch_task=NULL; ctx->fetch_in_progress=false; vTaskDelete(NULL); return; }
if (r>0) {
ctx->thumb_len=ol;
char saved_tmp[320]={0};
const char* saved=save_buffer_to_cache(ctx, p->id, ctx->thumb_buf, ol, saved_tmp, sizeof(saved_tmp));
if (saved) { strncpy(ctx->saved_img_path, saved_tmp, sizeof(ctx->saved_img_path)-1); ctx->has_image=true; snprintf(ctx->status_text, sizeof(ctx->status_text), "PNG %d random %dx%d", (int)ol, ctx->img_w, ctx->img_h); }
} else {
snprintf(ctx->status_text, sizeof(ctx->status_text), "First PNG fail %d", r);
}
ui_update_all(ctx); show_chrome(ctx);
}