{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771836045,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","fix repo management and refactor\nimplement more GRASP support"]],"content":"Signed commit: fix repo management and refactor\nimplement more GRASP support","id":"6ae016621b13e22809e7bcebe34e5250fd6e0767d2b12ca634104def4ca78a29","sig":"99c34f66a8a67d352622621536545b7dee11cfd9d14a007ec0550d138109116a2f24483c6836fea59b94b9e96066fba548bcb7600bc55adbe0562d999c3c651d"}
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771836045,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","fix repo management and refactor\nimplement more GRASP support"]],"content":"Signed commit: fix repo management and refactor\nimplement more GRASP support","id":"6ae016621b13e22809e7bcebe34e5250fd6e0767d2b12ca634104def4ca78a29","sig":"99c34f66a8a67d352622621536545b7dee11cfd9d14a007ec0550d138109116a2f24483c6836fea59b94b9e96066fba548bcb7600bc55adbe0562d999c3c651d"}
// API fetch failed - repo is not cloned and API fetch didn't work
// API fetch failed - repo is not cloned and API fetch didn't work
returnerror(404,'Repository is not cloned locally and could not fetch file via API. Privileged users can clone this repository using the "Clone to Server" button.');
// Check if announcement has clone URLs to provide better error message
logger.debug({npub,repo,filePath,hasCloneUrls,cloneUrlCount: cloneUrls.length},'API fallback failed or no clone URLs available');
returnerror(404,hasCloneUrls
?'Repository is not cloned locally and could not fetch file via API. Privileged users can clone this repository using the "Clone to Server" button.'
:'Repository is not cloned locally and has no external clone URLs for API fallback. Privileged users can clone this repository using the "Clone to Server" button.');
}else{
}else{
returnerror(404,'Repository announcement not found in Nostr');
returnerror(404,'Repository announcement not found in Nostr');
logger.debug({npub: context.npub,repo: context.repo,hasCloneUrls,cloneUrlCount: cloneUrls.length},'API fallback failed or no clone URLs available');
throwhandleNotFoundError(
throwhandleNotFoundError(
'Repository is not cloned locally and could not be fetched via API. Privileged users can clone this repository using the "Clone to Server" button.',
hasCloneUrls
?'Repository is not cloned locally and could not be fetched via API. Privileged users can clone this repository using the "Clone to Server" button.'
:'Repository is not cloned locally and has no external clone URLs for API fallback. Privileged users can clone this repository using the "Clone to Server" button.',
if (errorText.includes('not cloned locally') && errorText.includes('API')) {
if (errorText.includes('not cloned locally')) {
// API fallback might be available, but this specific request failed
// Repository is not cloned - check if API fallback might be available
// Try to detect if API fallback works by checking if we have clone URLs
if (pageData.repoCloneUrls && pageData.repoCloneUrls.length > 0) {
if (pageData.repoCloneUrls && pageData.repoCloneUrls.length > 0) {
// We have clone URLs, so API fallback might work - mark as unknown for now
// We have clone URLs, so API fallback might work - mark as unknown for now
// It will be set to true if a subsequent request succeeds
// It will be set to true if a subsequent request succeeds
apiFallbackAvailable = null;
apiFallbackAvailable = null;
// Don't set repoNotFound or error yet - allow API fallback to be attempted
} else {
} else {
// No clone URLs, API fallback won't work
repoNotFound = true;
apiFallbackAvailable = false;
apiFallbackAvailable = false;
error = errorText || `Repository not found. This repository exists in Nostr but hasn't been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.`;
}
}
} else {
} else {
// Repository not provisioned yet - set error message and flag
// Generic 404 - repository doesn't exist
repoNotFound = true;
repoNotFound = true;
error = `Repository not found. This repository exists in Nostr but hasn't been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.`;
apiFallbackAvailable = false;
apiFallbackAvailable = false;
error = `Repository not found. This repository exists in Nostr but hasn't been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.`;
}
}
} else if (response.status === 403) {
} else if (response.status === 403) {
// Access denied - don't set repoNotFound, allow retry after login
// Access denied - don't set repoNotFound, allow retry after login
@ -2874,20 +2877,28 @@
if (!response.ok) {
if (!response.ok) {
if (response.status === 404) {
if (response.status === 404) {
// Check if this is a "not cloned" error with API fallback suggestion
// Check if this is a "not cloned" error - API fallback might be available
if (errorText.includes('not cloned locally')&& errorText.includes('API')) {
if (errorText.includes('not cloned locally')) {
// API fallback might be available, but this specific request failed
// Repository is not cloned - check if API fallback might be available
if (pageData.repoCloneUrls && pageData.repoCloneUrls.length > 0) {
if (pageData.repoCloneUrls && pageData.repoCloneUrls.length > 0) {
apiFallbackAvailable = null; // Unknown, will be set if a request succeeds
// We have clone URLs, so API fallback might work - mark as unknown for now
// It will be set to true if a subsequent request succeeds
apiFallbackAvailable = null;
// Don't set repoNotFound - allow API fallback to be attempted
} else {
} else {
// No clone URLs, API fallback won't work
repoNotFound = true;
apiFallbackAvailable = false;
apiFallbackAvailable = false;
}
}
// Throw error but use the actual error text from the API
throw new Error(errorText || 'Repository not found. This repository exists in Nostr but hasn\'t been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.');
} else {
} else {
// Generic 404 - repository doesn't exist
repoNotFound = true;
repoNotFound = true;
apiFallbackAvailable = false;
apiFallbackAvailable = false;
}
throw new Error(`Repository not found. This repository exists in Nostr but hasn't been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.`);
throw new Error(`Repository not found. This repository exists in Nostr but hasn't been provisioned on this server yet. The server will automatically provision it soon, or you can contact the server administrator.`);
}
} else if (response.status === 403) {
} else if (response.status === 403) {
// 403 means access denied - don't set repoNotFound, just show error
// 403 means access denied - don't set repoNotFound, just show error