mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-22 21:42:49 +01:00
add client:accepttos command
This commit is contained in:
parent
1d5fe3c5be
commit
f6c6a40aba
@ -177,6 +177,7 @@ func init() {
|
|||||||
registerCmdFn("client:show", ClientShowCommand)
|
registerCmdFn("client:show", ClientShowCommand)
|
||||||
registerCmdFn("client:set", ClientSetCommand)
|
registerCmdFn("client:set", ClientSetCommand)
|
||||||
registerCmdFn("client:notifyupdatewriter", ClientNotifyUpdateWriterCommand)
|
registerCmdFn("client:notifyupdatewriter", ClientNotifyUpdateWriterCommand)
|
||||||
|
registerCmdFn("client:accepttos", ClientAcceptTosCommand)
|
||||||
|
|
||||||
registerCmdFn("telemetry", TelemetryCommand)
|
registerCmdFn("telemetry", TelemetryCommand)
|
||||||
registerCmdFn("telemetry:on", TelemetryOnCommand)
|
registerCmdFn("telemetry:on", TelemetryOnCommand)
|
||||||
@ -2798,6 +2799,27 @@ func boolToStr(v bool, trueStr string, falseStr string) string {
|
|||||||
return falseStr
|
return falseStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ClientAcceptTosCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||||
|
clientData, err := sstore.EnsureClientData(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot retrieve client data: %v", err)
|
||||||
|
}
|
||||||
|
clientOpts := clientData.ClientOpts
|
||||||
|
clientOpts.AcceptedTos = time.Now().UnixMilli()
|
||||||
|
err = sstore.SetClientOpts(ctx, clientOpts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error updating client data: %v", err)
|
||||||
|
}
|
||||||
|
clientData, err = sstore.EnsureClientData(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot retrieve updated client data: %v", err)
|
||||||
|
}
|
||||||
|
update := sstore.ModelUpdate{
|
||||||
|
ClientData: clientData,
|
||||||
|
}
|
||||||
|
return update, nil
|
||||||
|
}
|
||||||
|
|
||||||
func ClientSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
func ClientSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||||
clientData, err := sstore.EnsureClientData(ctx)
|
clientData, err := sstore.EnsureClientData(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -77,6 +77,8 @@ func SubMetaCmd(cmd string) string {
|
|||||||
return "eval"
|
return "eval"
|
||||||
case "export":
|
case "export":
|
||||||
return "setenv"
|
return "setenv"
|
||||||
|
case "connection":
|
||||||
|
return "remote"
|
||||||
default:
|
default:
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -2499,10 +2499,10 @@ func insertScreenUpdate(tx *TxWrap, screenId string, updateType string) {
|
|||||||
func insertScreenNewUpdate(tx *TxWrap, screenId string) {
|
func insertScreenNewUpdate(tx *TxWrap, screenId string) {
|
||||||
nowTs := time.Now().UnixMilli()
|
nowTs := time.Now().UnixMilli()
|
||||||
query := `INSERT INTO screenupdate (screenid, lineid, updatetype, updatets)
|
query := `INSERT INTO screenupdate (screenid, lineid, updatetype, updatets)
|
||||||
SELECT screenid, lineid, ?, ? FROM line WHERE screenid = ? AND NOT archived ORDER BY linenum`
|
SELECT screenid, lineid, ?, ? FROM line WHERE screenid = ? AND NOT archived ORDER BY linenum DESC`
|
||||||
tx.Exec(query, UpdateType_LineNew, nowTs, screenId)
|
tx.Exec(query, UpdateType_LineNew, nowTs, screenId)
|
||||||
query = `INSERT INTO screenupdate (screenid, lineid, updatetype, updatets)
|
query = `INSERT INTO screenupdate (screenid, lineid, updatetype, updatets)
|
||||||
SELECT c.screenid, l.lineid, ?, ? FROM cmd c, line l WHERE c.screenid = ? AND l.cmdid = c.cmdid AND NOT l.archived`
|
SELECT c.screenid, l.lineid, ?, ? FROM cmd c, line l WHERE c.screenid = ? AND l.cmdid = c.cmdid AND NOT l.archived ORDER BY l.linenum DESC`
|
||||||
tx.Exec(query, UpdateType_PtyPos, nowTs, screenId)
|
tx.Exec(query, UpdateType_PtyPos, nowTs, screenId)
|
||||||
NotifyUpdateWriter()
|
NotifyUpdateWriter()
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,7 @@ func (tdata *TelemetryData) Scan(val interface{}) error {
|
|||||||
|
|
||||||
type ClientOptsType struct {
|
type ClientOptsType struct {
|
||||||
NoTelemetry bool `json:"notelemetry,omitempty"`
|
NoTelemetry bool `json:"notelemetry,omitempty"`
|
||||||
|
AcceptedTos int64 `json:"acceptedtos,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FeOptsType struct {
|
type FeOptsType struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user