From 360671c021292fd4772cc21adc9dd885a7f6beb4 Mon Sep 17 00:00:00 2001 From: Nicolas Franck Date: Tue, 19 Mar 2024 14:39:57 +0100 Subject: [PATCH 1/3] Fix proposal for #929 --- .../ContentLeftPanel.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts index e35e98d26..5f1d0e030 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts @@ -23,6 +23,7 @@ import { import { AnnotationGroup, TreeSortType } from "@iiif/manifold"; import { isVisible } from "../../../../Utils"; import { ContentLeftPanel as ContentLeftPanelConfig } from "../../extensions/config/ContentLeftPanel"; +import { Dates } from "@edsilv/utils"; export class ContentLeftPanel extends LeftPanel { $bottomOptions: JQuery; @@ -52,6 +53,7 @@ export class ContentLeftPanel extends LeftPanel { treeSortType: TreeSortType = TreeSortType.NONE; treeView: TreeView; thumbsRoot: Root; + thumbsCacheKey: string; constructor($element: JQuery) { super($element); @@ -62,6 +64,8 @@ export class ContentLeftPanel extends LeftPanel { super.create(); + this.updateThumbsCacheKey(); + this.extensionHost.subscribe(IIIFEvents.SETTINGS_CHANGE, () => { this.render(); }); @@ -115,6 +119,12 @@ export class ContentLeftPanel extends LeftPanel { this.updateTreeTabBySelection(); }); + this.extensionHost.subscribe(IIIFEvents.LOGIN, () => { + this.updateThumbsCacheKey(); + this.renderThumbs(); + this.renderGallery(); + }); + // this.extensionHost.subscribe( // OpenSeadragonExtensionEvents.PAGING_TOGGLED, // (_paged: boolean) => { @@ -246,6 +256,10 @@ export class ContentLeftPanel extends LeftPanel { // ); // } + updateThumbsCacheKey(): void { + this.thumbsCacheKey = Dates.getTimeStamp().toString(); + } + createTreeView(): void { this.treeView = new TreeView(this.$treeView); this.treeView.treeData = this.getTreeData(); @@ -457,9 +471,16 @@ export class ContentLeftPanel extends LeftPanel { // height = this.config.options.oneColThumbHeight; // } - const thumbs: Thumb[] = this.extension.helper.getThumbs(90); + let thumbs: Thumb[] = this.extension.helper.getThumbs(90); // this.extension.helper.getThumbs(width, height) + thumbs = thumbs.map( + (t) => { + t.uri += '?t=' + this.thumbsCacheKey; + return t; + } + ); + if ( viewingDirection && viewingDirection === ViewingDirectionEnum.BOTTOM_TO_TOP From ea1eee534f614f99bdf92b4de4d42812fe043584 Mon Sep 17 00:00:00 2001 From: Nicolas Franck Date: Tue, 19 Mar 2024 15:01:30 +0100 Subject: [PATCH 2/3] change parameter `t` to `_uv_t`; try not to break url structure --- .../uv-contentleftpanel-module/ContentLeftPanel.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts index 5f1d0e030..93947b93b 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts @@ -476,7 +476,13 @@ export class ContentLeftPanel extends LeftPanel { thumbs = thumbs.map( (t) => { - t.uri += '?t=' + this.thumbsCacheKey; + let u = new URL(t.uri) + if (u.search == '') { + u.search += '?_uv_t='+ this.thumbsCacheKey; + } else { + u.search += '&_uv_t='+ this.thumbsCacheKey; + } + t.uri = u.href; return t; } ); From c6e5b5ee42a1280a1917648a1d20b909e73040f3 Mon Sep 17 00:00:00 2001 From: Nicolas Franck Date: Tue, 9 Apr 2024 20:21:52 +0200 Subject: [PATCH 3/3] Trigger event LOGIN to refresh thumbnails --- src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts b/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts index 3769ddb8e..00a6c814b 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts @@ -100,6 +100,7 @@ export class Auth1 { // It can but wait. const poll: number = window.setInterval(() => { if (contentProviderWindow.closed) { + Auth1.publish(IIIFEvents.LOGIN); window.clearInterval(poll); resolve(true); }