-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
51 lines (50 loc) · 1.83 KB
/
Copy pathvite.config.js
File metadata and controls
51 lines (50 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { defineConfig } from 'vite';
import basicSsl from '@vitejs/plugin-basic-ssl';
export default defineConfig({
plugins: [
basicSsl()
],
server: {
port: 3000,
open: true,
host: true, // Quest3などのローカルネットワーク機器から接続可能にする
proxy: {
'/api/local-brain': {
target: 'http://127.0.0.1:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/local-brain/, '')
},
'/api/ollama': {
target: 'http://127.0.0.1:11434',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/ollama/, '')
},
'/api/yahoo-news': {
target: 'https://news.yahoo.co.jp',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/yahoo-news/, '/rss/topics/top-picks.xml'),
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
proxyReq.setHeader('Referer', 'https://news.yahoo.co.jp/');
proxyReq.setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
});
}
},
'/api/tts': {
target: 'https://translate.google.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/tts/, '/translate_tts'),
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
// Spoof headers to bypass Google's strict hotlink and bot-detection blocks
proxyReq.setHeader('Referer', 'https://translate.google.com/');
proxyReq.setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
});
}
}
}
},
build: {
outDir: 'dist',
}
});