mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: add browser extension integration hooks
- Add lmExtensionHandled check to prevent duplicate downloads - Add lm:refreshVersions event listener for extension-triggered refresh - Expose downloadManager to window for extension access
This commit is contained in:
@@ -1142,6 +1142,11 @@ export function initVersionsTab({
|
|||||||
|
|
||||||
const actionButton = event.target.closest('[data-version-action]');
|
const actionButton = event.target.closest('[data-version-action]');
|
||||||
if (actionButton) {
|
if (actionButton) {
|
||||||
|
// Check if browser extension has already handled this action
|
||||||
|
if (actionButton.dataset.lmExtensionHandled === 'true') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const row = actionButton.closest('.model-version-row');
|
const row = actionButton.closest('.model-version-row');
|
||||||
if (!row) {
|
if (!row) {
|
||||||
return;
|
return;
|
||||||
@@ -1190,6 +1195,11 @@ export function initVersionsTab({
|
|||||||
window.open(targetUrl, '_blank', 'noopener,noreferrer');
|
window.open(targetUrl, '_blank', 'noopener,noreferrer');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Listen for extension-triggered refresh requests
|
||||||
|
container.addEventListener('lm:refreshVersions', async () => {
|
||||||
|
await refresh();
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
load: options => loadVersions(options),
|
load: options => loadVersions(options),
|
||||||
refresh,
|
refresh,
|
||||||
|
|||||||
@@ -744,3 +744,8 @@ export class DownloadManager {
|
|||||||
|
|
||||||
// Create global instance
|
// Create global instance
|
||||||
export const downloadManager = new DownloadManager();
|
export const downloadManager = new DownloadManager();
|
||||||
|
|
||||||
|
// Expose to window for browser extension integration
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
window.downloadManager = downloadManager;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user