|
6 | 6 |
|
7 | 7 | const COMMON_META = { |
8 | 8 | // Content Security Policy |
9 | | - csp: "script-src 'self' 'unsafe-eval' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://www.googletagmanager.com https://www.google-analytics.com data: blob:; style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com data:; connect-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://huggingface.co https://*.hf.co https://www.google-analytics.com https://analytics.google.com wss://api.openai.com wss://api.anthropic.com http://localhost:1234 http://localhost:11434 http://127.0.0.1:9434 https://beluga.bubblspace.com https://api.openai.com https://api.anthropic.com https://openrouter.ai; img-src 'self' data: blob:; font-src 'self' data:; worker-src 'self' blob: data:; object-src 'none';", |
| 9 | + // Content Security Policy - Note: CSP doesn't support IP wildcards, so we include common private IP ranges |
| 10 | + // Users can add their specific IPs to ollama-custom.js file for easier management |
| 11 | + |
| 12 | + // Base connect-src URLs (always included) |
| 13 | + baseConnectSrc: [ |
| 14 | + "'self'", |
| 15 | + "https://cdn.jsdelivr.net", |
| 16 | + "https://cdnjs.cloudflare.com", |
| 17 | + "https://unpkg.com", |
| 18 | + "https://huggingface.co", |
| 19 | + "https://*.hf.co", |
| 20 | + "https://www.google-analytics.com", |
| 21 | + "https://analytics.google.com", |
| 22 | + "wss://api.openai.com", |
| 23 | + "wss://api.anthropic.com", |
| 24 | + "http://localhost:1234", |
| 25 | + "http://localhost:11434", |
| 26 | + "http://localhost:8080", |
| 27 | + "http://localhost:9434", |
| 28 | + "http://localhost:3000", |
| 29 | + "http://127.0.0.1:11434", |
| 30 | + "http://127.0.0.1:9434", |
| 31 | + "http://127.0.0.1:8080", |
| 32 | + "http://127.0.0.1:3000", |
| 33 | + // Common private network IPs for Ollama - add your specific IP here |
| 34 | + // 10.0.x.x range (common in corporate/cloud networks) |
| 35 | + "http://10.0.0.1:11434", "http://10.0.0.10:11434", "http://10.0.0.100:11434", |
| 36 | + "http://10.0.1.1:11434", "http://10.0.1.10:11434", "http://10.0.1.69:11434", "http://10.0.1.100:11434", |
| 37 | + "http://10.0.2.1:11434", "http://10.0.2.10:11434", "http://10.0.2.100:11434", |
| 38 | + "http://10.0.10.1:11434", "http://10.0.10.10:11434", "http://10.0.10.100:11434", |
| 39 | + "http://10.0.50.1:11434", "http://10.0.50.10:11434", "http://10.0.50.100:11434", |
| 40 | + "http://10.0.100.1:11434", "http://10.0.100.10:11434", "http://10.0.100.100:11434", |
| 41 | + // 192.168.x.x range (home networks) |
| 42 | + "http://192.168.1.1:11434", "http://192.168.1.10:11434", "http://192.168.1.100:11434", |
| 43 | + "http://192.168.0.1:11434", "http://192.168.0.10:11434", "http://192.168.0.100:11434", |
| 44 | + "http://192.168.2.1:11434", "http://192.168.10.1:11434", "http://192.168.50.1:11434", |
| 45 | + // 172.16-31.x.x range (Docker/container networks) |
| 46 | + "http://172.16.0.1:11434", "http://172.17.0.1:11434", "http://172.18.0.1:11434", |
| 47 | + // Common alternative ports for all ranges |
| 48 | + "http://10.0.1.69:9434", "http://192.168.1.100:9434", "http://172.17.0.1:9434", |
| 49 | + // Add more IPs as needed - just append to this array |
| 50 | + "https://beluga.bubblspace.com", |
| 51 | + "https://api.openai.com", |
| 52 | + "https://api.anthropic.com", |
| 53 | + "https://openrouter.ai" |
| 54 | + ], |
| 55 | + |
| 56 | + // Get all connect-src URLs (base + custom from ollama-custom.js) |
| 57 | + get connectSrc() { |
| 58 | + let allURLs = [...this.baseConnectSrc]; |
| 59 | + |
| 60 | + // Add custom Ollama IPs from ollama-custom.js if available |
| 61 | + if (typeof window !== 'undefined' && window.OLLAMA_CUSTOM_CONFIG) { |
| 62 | + const customURLs = window.OLLAMA_CUSTOM_CONFIG.getAllCustomURLs(); |
| 63 | + allURLs = allURLs.concat(customURLs); |
| 64 | + console.log('🔧 Added custom Ollama URLs to CSP:', customURLs); |
| 65 | + } |
| 66 | + |
| 67 | + return allURLs; |
| 68 | + }, |
| 69 | + |
| 70 | + get csp() { |
| 71 | + return `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://www.googletagmanager.com https://www.google-analytics.com data: blob:; style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com data:; connect-src ${this.connectSrc.join(' ')}; img-src 'self' data: blob:; font-src 'self' data:; worker-src 'self' blob: data:; object-src 'none';`; |
| 72 | + }, |
10 | 73 |
|
11 | 74 | // Common favicon |
12 | 75 | favicon: "lib/Media/TimeCapsule_04.png", |
|
0 commit comments