mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add Vite proxy, change terminal to other channel
This commit is contained in:
1 parent
c3e735b627
commit
c248004484
5 files changed
+11
-8
No files matched your search
@@ -19,6 +19,7 @@ onMounted(async () => {
|
||||
socket.on('disconnect', function close() {
|
||||
console.log('Disconnected from the server.')
|
||||
})
|
||||
socket.on('message', console.log)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@ onMounted(() => {
|
||||
term.open(terminal.value)
|
||||
term.focus()
|
||||
resizeScreen()
|
||||
socket.on('message', (message) => {
|
||||
socket.on('terminal', (message) => {
|
||||
term.write(message)
|
||||
})
|
||||
term.onData((key) => {
|
||||
socket.send(key)
|
||||
socket.emit('terminal', key)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'https://odyssey.wancat.cc/api/v1',
|
||||
baseURL: '/api',
|
||||
})
|
||||
|
||||
export default api
|
||||
@@ -1,7 +1,5 @@
|
||||
import io from 'socket.io-client'
|
||||
|
||||
const host = 'wss://odyssey.wancat.cc'
|
||||
|
||||
class SocketWrapper {
|
||||
constructor() {
|
||||
this.socket = null
|
||||
@@ -14,7 +12,7 @@ class SocketWrapper {
|
||||
this.socket.disconnect()
|
||||
}
|
||||
|
||||
this.socket = io(host, {
|
||||
this.socket = io('', {
|
||||
query: {
|
||||
session_id: session._id,
|
||||
},
|
||||
|
||||
+6
-2
@@ -7,8 +7,12 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
// target: 'http://localhost:3000', // the server url
|
||||
target: 'http://odyssey.wancat.cc ',
|
||||
target: 'http://localhost:3000/api/v1',
|
||||
rewrite: (path) => path.replace(/^\/api/, ''), // Optional: remove "/api" prefix from the path
|
||||
},
|
||||
'/socket.io': {
|
||||
target: 'ws://localhost:3000',
|
||||
// target: 'wss://odyssey.wancat.cc',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user