mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -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]');
|
||||
if (actionButton) {
|
||||
// Check if browser extension has already handled this action
|
||||
if (actionButton.dataset.lmExtensionHandled === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
const row = actionButton.closest('.model-version-row');
|
||||
if (!row) {
|
||||
return;
|
||||
@@ -1190,6 +1195,11 @@ export function initVersionsTab({
|
||||
window.open(targetUrl, '_blank', 'noopener,noreferrer');
|
||||
});
|
||||
|
||||
// Listen for extension-triggered refresh requests
|
||||
container.addEventListener('lm:refreshVersions', async () => {
|
||||
await refresh();
|
||||
});
|
||||
|
||||
return {
|
||||
load: options => loadVersions(options),
|
||||
refresh,
|
||||
|
||||
@@ -744,3 +744,8 @@ export class DownloadManager {
|
||||
|
||||
// Create global instance
|
||||
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