diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-12-16 09:16:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-16 09:16:41 +0100 |
| commit | 1296a46a68f7a63681f294c12fadc9ca5e0c6459 (patch) | |
| tree | 8b829389b78205d7dcc322c80fcef50fb8a0e669 /zellij-utils/src/plugin_api | |
| parent | HOTFIX: fix flaky macos test (diff) | |
| download | sl0ppij-1296a46a68f7a63681f294c12fadc9ca5e0c6459.tar.gz sl0ppij-1296a46a68f7a63681f294c12fadc9ca5e0c6459.tar.xz sl0ppij-1296a46a68f7a63681f294c12fadc9ca5e0c6459.zip | |
Read only web tokens (#4551)
* initial implementation
* fix race condition potentially allowing read-only clients to gain write access
* clear read only status on disconnect
* cleanups and formatting
* fix tests
* refactor first message + ipc pipe creation out of trait
* fix web tests
* fix web tests again
* refactor: move os_input connection establishment to session manager trait
* add read-only-token tests
* fix: identify watchers as web-clients when they are and enforce no-web-clients for them as well
* identify watcher web clients on the server
* fix tests
* cleanups and formatting
* add read-only-tokens to the plugin api
* update share plugin ui for read-only tokens
* cleanups and formatting
* docs(changelog): add PR
Diffstat (limited to 'zellij-utils/src/plugin_api')
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.proto | 6 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 18 |
2 files changed, 16 insertions, 8 deletions
diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto index f662c93b..fb456ccd 100644 --- a/zellij-utils/src/plugin_api/plugin_command.proto +++ b/zellij-utils/src/plugin_api/plugin_command.proto @@ -310,6 +310,7 @@ message RevokeWebLoginTokenPayload { message GenerateWebLoginTokenPayload { optional string token_label = 1; + optional bool read_only = 2; } message SetSelfMouseSelectionSupportPayload { @@ -709,10 +710,11 @@ message RevokeTokenResponse { } message ListTokensResponse { - // tokens/creation_times should be synchronized + // tokens/creation_times/read_only_flags should be synchronized repeated string tokens = 1; repeated string creation_times = 2; - optional string error = 3; + repeated bool read_only_flags = 3; + optional string error = 4; } message RevokeAllWebTokensResponse { diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 771bb9ec..542e1ea2 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -1761,6 +1761,7 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { Some(Payload::GenerateWebLoginTokenPayload(generate_web_login_token_payload)) => { Ok(PluginCommand::GenerateWebLoginToken( generate_web_login_token_payload.token_label, + generate_web_login_token_payload.read_only.unwrap_or(false), )) }, _ => Err("GenerateWebLoginToken requires a payload"), @@ -2996,12 +2997,17 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { )), }) }, - PluginCommand::GenerateWebLoginToken(token_label) => Ok(ProtobufPluginCommand { - name: CommandName::GenerateWebLoginToken as i32, - payload: Some(Payload::GenerateWebLoginTokenPayload( - GenerateWebLoginTokenPayload { token_label }, - )), - }), + PluginCommand::GenerateWebLoginToken(token_label, read_only) => { + Ok(ProtobufPluginCommand { + name: CommandName::GenerateWebLoginToken as i32, + payload: Some(Payload::GenerateWebLoginTokenPayload( + GenerateWebLoginTokenPayload { + token_label, + read_only: Some(read_only), + }, + )), + }) + }, PluginCommand::RevokeWebLoginToken(token_label) => Ok(ProtobufPluginCommand { name: CommandName::RevokeWebLoginToken as i32, payload: Some(Payload::RevokeWebLoginTokenPayload( |
