fix: cannot ota upgrade when connect to remote node #424

This commit is contained in:
Jacky 2024-07-21 18:21:27 +08:00
parent f41b6bc07b
commit 7ef4fec896
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
8 changed files with 115 additions and 156 deletions

View file

@ -13,5 +13,8 @@ func InitPublicRouter(r *gin.RouterGroup) {
func InitPrivateRouter(r *gin.RouterGroup) {
r.GET("upgrade/release", GetRelease)
r.GET("upgrade/current", GetCurrentVersion)
}
func InitWebSocketRouter(r *gin.RouterGroup) {
r.GET("upgrade/perform", PerformCoreUpgrade)
}

View file

@ -21,3 +21,47 @@ manual `h(...)` calls), you can enable Volar's Take Over mode by following these
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
## Project Setup
```sh
pnpm install
```
**Note:** The default target of the api proxy is `http://localhost:9000`,
if you need to change this, create the `.env` file in root directory and set your target in it.
```env
VITE_PROXY_TARGET=http://localhost:9001
```
### Compile and Hot-Reload for Development
```sh
pnpm dev
```
**Note:** The default port of the dev server is `3002`,
if you need to change this, create the `.env` file in root directory and set your port in it.
```env
VITE_PORT=3456
```
### Code Style Check
```sh
pnpm lint
```
### Type Check
```sh
pnpm typecheck
```
### Compile and Minify for Production
```sh
pnpm build
```

View file

@ -1 +1 @@
{"version":"2.0.0-beta.26","build_id":141,"total_build":345}
{"version":"2.0.0-beta.26","build_id":142,"total_build":346}

View file

@ -1 +1 @@
{"version":"2.0.0-beta.26","build_id":141,"total_build":345}
{"version":"2.0.0-beta.26","build_id":142,"total_build":346}

View file

@ -71,6 +71,7 @@ export default defineConfig(({ mode }) => {
},
},
server: {
port: Number.parseInt(env.VITE_PORT) || 3002,
proxy: {
'/api': {
target: env.VITE_PROXY_TARGET || 'http://localhost:9000',

File diff suppressed because one or more lines are too long

View file

@ -65,9 +65,7 @@ func (e *Environment) GetWebSocketURL(uri string) (decodedUri string, err error)
if err != nil {
return
}
// http will be replaced with ws, https will be replaced with wss
decodedUri = strings.ReplaceAll(decodedUri, "http", "ws")
return
}

View file

@ -71,8 +71,8 @@ func InitRouter() *gin.Engine {
terminal.InitRouter(w)
nginx.InitNginxLogRouter(w)
upstream.InitRouter(w)
system.InitWebSocketRouter(w)
}
}
return r