main #11

Merged
mstoeck3 merged 66 commits from main into forensic-ai 2025-08-11 12:02:56 +00:00
5 changed files with 5 additions and 25 deletions
Showing only changes of commit b1c31379b2 - Show all commits

View File

@ -1,4 +1,3 @@
// src/pages/api/upload/media.ts - Enhanced with detailed logging and error handling
import type { APIRoute } from 'astro';
import { withAPIAuth } from '../../../utils/auth.js';
import { apiResponse, apiError, apiServerError, apiSpecial, handleAPIRequest } from '../../../utils/api.js';
@ -21,13 +20,10 @@ interface UploadResult {
const UPLOAD_CONFIG = {
maxFileSize: 50 * 1024 * 1024, // 50MB
allowedTypes: new Set([
// Images
'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml',
// Videos
'video/mp4', 'video/webm', 'video/ogg', 'video/avi', 'video/mov',
// Documents
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
@ -36,17 +32,15 @@ const UPLOAD_CONFIG = {
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
// Text files
'text/plain',
'text/csv',
'text/markdown', // Added markdown
'text/x-markdown', // Alternative markdown MIME type
'text/markdown',
'text/x-markdown',
'application/json',
'application/xml',
'text/xml',
'text/html',
// Archives
'application/zip',
'application/x-tar',
'application/gzip',
@ -55,10 +49,9 @@ const UPLOAD_CONFIG = {
'application/x-rar-compressed',
'application/x-7z-compressed',
// Additional useful formats
'application/rtf', // Rich Text Format
'application/rtf',
'text/richtext',
'application/x-yaml', // YAML files
'application/x-yaml',
'text/yaml',
'application/yaml'
]),
@ -185,7 +178,6 @@ export const POST: APIRoute = async ({ request }) => {
return await handleAPIRequest(async () => {
console.log('[UPLOAD] Processing upload request');
// Enhanced auth logging
const authResult = await withAPIAuth(request, 'contributions');
console.log('[UPLOAD] Auth result:', {
authenticated: authResult.authenticated,
@ -230,7 +222,6 @@ export const POST: APIRoute = async ({ request }) => {
return apiError.badRequest(validation.error!);
}
// Enhanced environment logging
const nextcloudConfigured = isNextcloudConfigured();
console.log('[UPLOAD] Environment check:', {
nextcloudConfigured,

View File

@ -309,7 +309,6 @@ class KnowledgebaseForm {
private handleFiles(files: File[]) {
files.forEach(file => {
// Client-side validation before upload
const validation = this.validateFileBeforeUpload(file);
if (!validation.valid) {
console.log('[UPLOAD]Cannot upload ', file.name, ' Error: ', validation.error);
@ -340,7 +339,6 @@ class KnowledgebaseForm {
};
}
// Check file type
const allowedExtensions = [
'.pdf', '.doc', '.docx', '.txt', '.md', '.markdown', '.csv', '.json',
'.xml', '.html', '.rtf', '.yaml', '.yml', '.zip', '.tar', '.gz',

View File

@ -12,7 +12,6 @@ const data = await getToolsData();
const tools = data.tools;
const phases = data.phases;
// Check AI authentication requirements
const aiAuthRequired = getAuthRequirementForContext('ai');
let aiAuthContext: { authenticated: boolean; userId: string; session?: any; authRequired: boolean; } | null = null;
@ -332,7 +331,6 @@ if (aiAuthRequired) {
return;
}
// Handle AI authentication button click
if (aiLoginBtn) {
aiLoginBtn.addEventListener('click', () => {
const currentUrl = encodeURIComponent(window.location.href);
@ -385,7 +383,6 @@ if (aiAuthRequired) {
if (filtersSection) filtersSection.style.display = 'block';
break;
case 'ai':
// Only show AI interface if authentication allows it
if (aiAuthRequired && !aiAuthenticated) {
console.log('[AUTH] AI access denied, redirecting to login');
const currentUrl = encodeURIComponent(window.location.href);

View File

@ -91,7 +91,6 @@ class AuditService {
}
private loadConfig(): AuditConfig {
// Use the env() helper function that handles both server and client contexts
const enabledFlag = env('FORENSIC_AUDIT_ENABLED', 'false');
const detailLevel = env('FORENSIC_AUDIT_DETAIL_LEVEL', 'standard') as 'minimal' | 'standard' | 'verbose';
const retentionHours = parseInt(env('FORENSIC_AUDIT_RETENTION_HOURS', '72') || '72', 10);
@ -398,9 +397,7 @@ class AuditService {
export const auditService = new AuditService();
export type { ProcessedAuditTrail, CompressedAuditEntry };
// Add this at the bottom of auditService.ts (after the existing exports)
// Export debug utilities for troubleshooting
export const debugAuditService = {
getDebugInfo() {
return auditService.getDebugInfo();

View File

@ -467,7 +467,6 @@ const embeddingsService = new EmbeddingsService();
export { embeddingsService, type EmbeddingData, type SimilarityResult };
// Export utility functions for debugging
export const debugEmbeddings = {
async recheckEnvironment() {
return embeddingsService.forceRecheckEnvironment();
@ -476,5 +475,3 @@ export const debugEmbeddings = {
return embeddingsService.getStats();
}
};
// Remove auto-initialization - let it initialize lazily when first needed