mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +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:set", ClientSetCommand)
|
||||
registerCmdFn("client:notifyupdatewriter", ClientNotifyUpdateWriterCommand)
|
||||
registerCmdFn("client:accepttos", ClientAcceptTosCommand)
|
||||
|
||||
registerCmdFn("telemetry", TelemetryCommand)
|
||||
registerCmdFn("telemetry:on", TelemetryOnCommand)
|
||||
@ -2798,6 +2799,27 @@ func boolToStr(v bool, trueStr string, falseStr string) string {
|
||||
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) {
|
||||
clientData, err := sstore.EnsureClientData(ctx)
|
||||
if err != nil {
|
||||
|
@ -77,6 +77,8 @@ func SubMetaCmd(cmd string) string {
|
||||
return "eval"
|
||||
case "export":
|
||||
return "setenv"
|
||||
case "connection":
|
||||
return "remote"
|
||||
default:
|
||||
return cmd
|
||||
}
|
||||
|
@ -2499,10 +2499,10 @@ func insertScreenUpdate(tx *TxWrap, screenId string, updateType string) {
|
||||
func insertScreenNewUpdate(tx *TxWrap, screenId string) {
|
||||
nowTs := time.Now().UnixMilli()
|
||||
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)
|
||||
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)
|
||||
NotifyUpdateWriter()
|
||||
}
|
||||
|
@ -212,7 +212,8 @@ func (tdata *TelemetryData) Scan(val interface{}) error {
|
||||
}
|
||||
|
||||
type ClientOptsType struct {
|
||||
NoTelemetry bool `json:"notelemetry,omitempty"`
|
||||
NoTelemetry bool `json:"notelemetry,omitempty"`
|
||||
AcceptedTos int64 `json:"acceptedtos,omitempty"`
|
||||
}
|
||||
|
||||
type FeOptsType struct {
|
||||
|
Loading…
Reference in New Issue
Block a user