Skip to content

Commit 2e0b557

Browse files
Merge pull request #49 from thefirehacker/3.6.0_Voice_DeepResearchPlayground_Integration
3.6.0 voice deep research playground integration
2 parents 35b47ba + 5d4e811 commit 2e0b557

File tree

6 files changed

+126
-5
lines changed

6 files changed

+126
-5
lines changed

Canvas.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<head>
44
<meta charset="UTF-8" />
55
<!-- Load Common Meta Configuration -->
6+
<!-- Load Custom Ollama Configuration -->
7+
<script src="ollama-custom.js"></script>
68
<script src="lib/common-meta.js"></script>
79
<script>
810
document.write(`

DeepResearch.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5+
<!-- Load Custom Ollama Configuration -->
6+
<script src="ollama-custom.js"></script>
57
<!-- Load Common Meta Configuration -->
68
<script src="lib/common-meta.js?v=2025010302"></script>
79
<script>

Playground.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5+
<!-- Load Custom Ollama Configuration -->
6+
<script src="ollama-custom.js"></script>
57
<!-- Load Common Meta Configuration -->
68
<script src="lib/common-meta.js?v=2025010302"></script>
79
<script>

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,19 @@ curl http://localhost:11434/api/tags
555555

556556
> **⚠️ Note**: Custom URLs only work in local builds, not hosted version.
557557
558-
**Setup:**
559-
1. **Add URL to CSP**: Edit `/lib/common-meta.js` → add your URL to `connectSrc` array
558+
**Easy Setup with ollama-custom.js:**
559+
1. **Edit Configuration File**: Open `ollama-custom.js` in the root directory
560+
2. **Add Your IPs**: Replace the example IPs with your actual Ollama servers
560561
```javascript
561-
'http://192.168.1.100:11434', // Example: your Ollama server
562+
customIPs: [
563+
"http://10.0.1.69:11434", // Your first Ollama server
564+
"http://192.168.1.200:11434", // Your second Ollama server
565+
"http://172.16.0.50:9434" // Your third Ollama server
566+
]
562567
```
568+
3. **Save and Refresh**: Save the file and hard refresh your browser (Ctrl+Shift+R)
563569

564-
2. **Use in App**: Click "Connect Ollama" → accept agreement → Enter custom URL in popup
570+
**Use in App**: Click "Connect Ollama" → accept agreement → Enter custom URL in popup
565571
- **DeepResearch**: Click "🦙 Connect Ollama"
566572
- **Playground**: Click "Connect AI" → Select Ollama
567573

lib/common-meta.js

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,70 @@
66

77
const COMMON_META = {
88
// 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+
},
1073

1174
// Common favicon
1275
favicon: "lib/Media/TimeCapsule_04.png",

ollama-custom.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Custom Ollama Server Configuration
3+
*
4+
* Add your custom Ollama server IPs here for easy access.
5+
* These will be automatically included in the Content Security Policy.
6+
*
7+
* Instructions:
8+
* 1. Replace the example IPs with your actual Ollama server addresses
9+
* 2. Use the format: "http://IP:PORT" (include quotes)
10+
* 3. Save the file and refresh your browser (Ctrl+Shift+R)
11+
*
12+
* Examples:
13+
* - "http://192.168.1.100:11434" (Home network)
14+
* - "http://10.0.1.50:11434" (Corporate network)
15+
* - "http://172.16.0.10:9434" (Docker container with custom port)
16+
*/
17+
18+
const OLLAMA_CUSTOM_CONFIG = {
19+
// Add your 3 custom Ollama server IPs here
20+
customIPs: [
21+
"http://10.0.1.69:11434", // Replace with your first Ollama server
22+
"http://192.168.1.200:11434", // Replace with your second Ollama server
23+
"http://172.16.0.50:9434" // Replace with your third Ollama server
24+
],
25+
26+
// Optional: Add custom ports for localhost/127.0.0.1
27+
customPorts: [
28+
"http://localhost:8080",
29+
"http://127.0.0.1:7777"
30+
],
31+
32+
// Get all custom URLs for CSP integration
33+
getAllCustomURLs() {
34+
return [...this.customIPs, ...this.customPorts];
35+
}
36+
};
37+
38+
// Export for use in common-meta.js
39+
if (typeof window !== 'undefined') {
40+
window.OLLAMA_CUSTOM_CONFIG = OLLAMA_CUSTOM_CONFIG;
41+
}
42+
43+
// For Node.js environments
44+
if (typeof module !== 'undefined' && module.exports) {
45+
module.exports = OLLAMA_CUSTOM_CONFIG;
46+
}

0 commit comments

Comments
 (0)