mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Update unauthorized access error message
This commit is contained in:
@@ -80,12 +80,7 @@ class CivitaiClient:
|
|||||||
if response.status == 401:
|
if response.status == 401:
|
||||||
logger.warning(f"Unauthorized access to resource: {url} (Status 401)")
|
logger.warning(f"Unauthorized access to resource: {url} (Status 401)")
|
||||||
|
|
||||||
# Check if this is an API key issue (has Set-Cookie headers)
|
return False, "Invalid or missing CivitAI API key, or early access restriction."
|
||||||
if 'Set-Cookie' in response.headers:
|
|
||||||
return False, "Invalid or missing CivitAI API key. Please check your API key in settings."
|
|
||||||
|
|
||||||
# Otherwise it's an early access restriction
|
|
||||||
return False, "Early access restriction: You must purchase early access to download this LoRA."
|
|
||||||
|
|
||||||
# Handle other client errors that might be permission-related
|
# Handle other client errors that might be permission-related
|
||||||
if response.status == 403:
|
if response.status == 403:
|
||||||
|
|||||||
@@ -905,6 +905,7 @@ export class ImportManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to download LoRAs
|
// Check if we need to download LoRAs
|
||||||
|
let failedDownloads = 0;
|
||||||
if (this.downloadableLoRAs && this.downloadableLoRAs.length > 0) {
|
if (this.downloadableLoRAs && this.downloadableLoRAs.length > 0) {
|
||||||
// For download, we need to validate the target path
|
// For download, we need to validate the target path
|
||||||
const loraRoot = document.getElementById('importLoraRoot')?.value;
|
const loraRoot = document.getElementById('importLoraRoot')?.value;
|
||||||
@@ -931,8 +932,7 @@ export class ImportManager {
|
|||||||
const updateProgress = this.loadingManager.showDownloadProgress(this.downloadableLoRAs.length);
|
const updateProgress = this.loadingManager.showDownloadProgress(this.downloadableLoRAs.length);
|
||||||
|
|
||||||
let completedDownloads = 0;
|
let completedDownloads = 0;
|
||||||
let failedDownloads = 0;
|
let accessFailures = 0;
|
||||||
let earlyAccessFailures = 0;
|
|
||||||
let currentLoraProgress = 0;
|
let currentLoraProgress = 0;
|
||||||
|
|
||||||
// Set up progress tracking for current download
|
// Set up progress tracking for current download
|
||||||
@@ -999,12 +999,10 @@ export class ImportManager {
|
|||||||
console.error(`Failed to download LoRA ${lora.name}: ${errorText}`);
|
console.error(`Failed to download LoRA ${lora.name}: ${errorText}`);
|
||||||
|
|
||||||
// Check if this is an early access error (status 401 is the key indicator)
|
// Check if this is an early access error (status 401 is the key indicator)
|
||||||
if (response.status === 401 ||
|
if (response.status === 401) {
|
||||||
(errorText.toLowerCase().includes('early access') ||
|
accessFailures++;
|
||||||
errorText.toLowerCase().includes('purchase'))) {
|
|
||||||
earlyAccessFailures++;
|
|
||||||
this.loadingManager.setStatus(
|
this.loadingManager.setStatus(
|
||||||
`Failed to download ${lora.name}: Early Access required`
|
`Failed to download ${lora.name}: Access restricted`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,9 +1034,9 @@ export class ImportManager {
|
|||||||
if (failedDownloads === 0) {
|
if (failedDownloads === 0) {
|
||||||
showToast(`All ${completedDownloads} LoRAs downloaded successfully`, 'success');
|
showToast(`All ${completedDownloads} LoRAs downloaded successfully`, 'success');
|
||||||
} else {
|
} else {
|
||||||
if (earlyAccessFailures > 0) {
|
if (accessFailures > 0) {
|
||||||
showToast(
|
showToast(
|
||||||
`Downloaded ${completedDownloads} of ${this.downloadableLoRAs.length} LoRAs. ${earlyAccessFailures} failed due to Early Access restrictions.`,
|
`Downloaded ${completedDownloads} of ${this.downloadableLoRAs.length} LoRAs. ${accessFailures} failed due to access restrictions. Check your API key in settings or early access status.`,
|
||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -1049,7 +1047,9 @@ export class ImportManager {
|
|||||||
|
|
||||||
// Show success message
|
// Show success message
|
||||||
if (isDownloadOnly) {
|
if (isDownloadOnly) {
|
||||||
showToast('LoRAs downloaded successfully', 'success');
|
if (failedDownloads === 0) {
|
||||||
|
showToast('LoRAs downloaded successfully', 'success');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast(`Recipe "${this.recipeName}" saved successfully`, 'success');
|
showToast(`Recipe "${this.recipeName}" saved successfully`, 'success');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user