Release 3.10.0+1: sidebar UI (Home / Profiles / Settings / Logs / About), remembered account with 50 GB monthly renew + auto-renew, Windows VPN mode (wintun + tun2socks).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,10 @@ type UIState struct {
|
||||
Hy2 core.Hy2Options `json:"hy2"`
|
||||
StorePackaged bool `json:"store_packaged,omitempty"`
|
||||
ProvisionReady bool `json:"provision_ready,omitempty"`
|
||||
Account *remnawave.Account `json:"account,omitempty"`
|
||||
Mode string `json:"mode"`
|
||||
VPNSupported bool `json:"vpn_mode_supported"`
|
||||
VPNActive bool `json:"vpn_active"`
|
||||
}
|
||||
|
||||
type PingBestResult struct {
|
||||
@@ -70,6 +74,8 @@ type PingBestResult struct {
|
||||
}
|
||||
|
||||
func New(mgr *core.Manager, cfgPath string, logBuf *bytes.Buffer) *App {
|
||||
// Monthly plan upkeep: check at start and then periodically.
|
||||
mgr.StartAutoRenew(6 * time.Hour)
|
||||
return &App{
|
||||
Mgr: mgr,
|
||||
CfgPath: cfgPath,
|
||||
@@ -139,6 +145,10 @@ func (a *App) GetState() (UIState, error) {
|
||||
Hy2: a.Mgr.ActiveHy2Options(),
|
||||
StorePackaged: update.IsStorePackaged(),
|
||||
ProvisionReady: a.Mgr.ProvisionConfigured(),
|
||||
Account: a.Mgr.Account(),
|
||||
Mode: a.Mgr.Mode(),
|
||||
VPNSupported: a.Mgr.VPNModeSupported(),
|
||||
VPNActive: st.VPNActive,
|
||||
}
|
||||
if out.Protocol == "" {
|
||||
if p, err := cfg.ActiveProfile(); err == nil {
|
||||
@@ -259,6 +269,27 @@ func (a *App) ProvisionUser(username string) (core.ProvisionOutcome, error) {
|
||||
return a.Mgr.ProvisionAccess(username)
|
||||
}
|
||||
|
||||
func (a *App) RenewAccount() (core.ProvisionOutcome, error) {
|
||||
return a.Mgr.RenewAccount()
|
||||
}
|
||||
|
||||
func (a *App) SetMode(mode string) error {
|
||||
return a.Mgr.SetMode(strings.TrimSpace(mode))
|
||||
}
|
||||
|
||||
// GetLogs returns the tail of the core log buffer for the «Логи» page.
|
||||
func (a *App) GetLogs() (string, error) {
|
||||
if a.LogBuf == nil {
|
||||
return "", nil
|
||||
}
|
||||
const maxTail = 64 * 1024
|
||||
b := a.LogBuf.Bytes()
|
||||
if len(b) > maxTail {
|
||||
b = b[len(b)-maxTail:]
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
func (a *App) PingServers() ([]netcheck.Result, error) {
|
||||
return a.runPings()
|
||||
}
|
||||
@@ -519,6 +550,12 @@ func (a *App) dispatch(name string, args []json.RawMessage) (any, error) {
|
||||
return a.ImportRemnawave(s)
|
||||
case "provisionUser":
|
||||
return a.ProvisionUser(arg(args, 0, ""))
|
||||
case "renewAccount":
|
||||
return a.RenewAccount()
|
||||
case "setMode":
|
||||
return nil, a.SetMode(arg(args, 0, ""))
|
||||
case "getLogs":
|
||||
return a.GetLogs()
|
||||
case "quit":
|
||||
go func() {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user