45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package api
|
|
|
|
import (
|
|
"next-terminal/server/common/maps"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
type AccessSettingApi struct{}
|
|
|
|
func (api AccessSettingApi) GetEndpoint(c echo.Context) error {
|
|
return Success(c, maps.Map{
|
|
"fontSize": "14",
|
|
"lineHeight": "1.5",
|
|
"fontFamily": "JetBrains Mono, Consolas, monospace",
|
|
"selectionCopy": "true",
|
|
"rightClickPaste": "true",
|
|
"treeExpandedKeys": "",
|
|
"useSnippets": "true",
|
|
"interceptSearchShortcut": "false",
|
|
})
|
|
}
|
|
|
|
func (api AccessSettingApi) SetEndpoint(c echo.Context) error {
|
|
var req map[string]interface{}
|
|
if err := c.Bind(&req); err != nil {
|
|
return err
|
|
}
|
|
_ = req
|
|
return Success(c, nil)
|
|
}
|
|
|
|
func (api AccessSettingApi) ShellAssistantEnabledEndpoint(c echo.Context) error {
|
|
return Success(c, maps.Map{"enabled": false})
|
|
}
|
|
|
|
func (api AccessSettingApi) ShellAssistantEndpoint(c echo.Context) error {
|
|
c.Response().Header().Set("Content-Type", "text/event-stream")
|
|
c.Response().Header().Set("Cache-Control", "no-cache")
|
|
c.Response().Header().Set("Connection", "keep-alive")
|
|
|
|
_, _ = c.Response().Write([]byte("data: {\"success\":false,\"error\":\"Shell assistant is not configured\"}\n\n"))
|
|
return nil
|
|
}
|