From 012073fb01d79d72173872089f8a7978ec78cffd Mon Sep 17 00:00:00 2001 From: Joshua Blum Date: Mon, 3 Feb 2025 14:24:15 -0500 Subject: [PATCH] move support page from keybase.pub & remove deprecated API (#328) * move support page * remove deprecated API --- zoombot/SUPPORT.md | 28 ---------------- zoombot/zoombot/api.go | 58 --------------------------------- zoombot/zoombot/http.go | 18 +++------- zoombot/zoombot/support_html.go | 57 ++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 99 deletions(-) delete mode 100644 zoombot/SUPPORT.md create mode 100644 zoombot/zoombot/support_html.go diff --git a/zoombot/SUPPORT.md b/zoombot/SUPPORT.md deleted file mode 100644 index 9f204d8e..00000000 --- a/zoombot/SUPPORT.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## Installation - -- Step by step guide - 1. Install Keybase (https://keybase.io/download) - 2. Add the Keybase Zoom Bot to your teams and conversations through the following steps: - 1. Navigate to the conversation you wish to install Zoom Bot for - 2. Click the ‘Chat info & sessions’ button (the icon is an i in a circle) in the top right corner - 3. Select the ‘Bots’ tab - 4. Scroll down to the entry that says ‘Zoom Bot’ and click the plus. Keybase will guide you through installing the bot -- Uninstalling or deauthorizing the Keybase Zoom Bot from your Zoom Account - - Navigate to https://marketplace.zoom.us/user/installed and click on the “Uninstall” button next to the Keybase integration - -## Usage - -- `!zoom`: Create a new Zoom meeting - - To use the bot, type `!zoom` in conversations that the Keybase Zoom Bot has been added to. - If you haven’t used the bot before, it will direct message you in order to authenticate with Zoom. - Otherwise, the bot will broadcast a Zoom Instant Meeting link on your behalf to the conversation that you sent - the command into - -## Contact Support - -- Use the `!zoombot feedback ` to provide feedback and questions. -- Report issues here: https://github.com/keybase/managed-bots/issues -- Join @keybasefriends to discuss with the community https://keybase.io/team/keybasefriends -- In app going to `Settings > Feedback` to submit bugs or `keybase log send` from the command line. diff --git a/zoombot/zoombot/api.go b/zoombot/zoombot/api.go index ffb5f9ce..94209399 100644 --- a/zoombot/zoombot/api.go +++ b/zoombot/zoombot/api.go @@ -151,25 +151,6 @@ type DeauthorizationEvent struct { ClientID string `json:"client_id"` } -// Compliance - -type DataComplianceRequest struct { - ClientID string `json:"client_id"` - UserID string `json:"user_id"` - AccountID string `json:"account_id"` - DeauthorizationEventReceived DeauthorizationEvent `json:"deauthorization_event_received"` - ComplianceCompleted bool `json:"compliance_completed"` -} - -type DataComplianceResponse struct { - UserDataRetention bool `json:"user_data_retention"` - AccountID string `json:"account_id"` - UserID string `json:"user_id"` - Signature string `json:"signature"` - DeauthorizationTime string `json:"deauthorization_time"` - ClientID string `json:"client_id"` -} - func GetUser(client *http.Client, userID string) (*GetUserResponse, error) { apiURL := fmt.Sprintf("%s/users/%s", apiBaseURLV2, userID) resp, err := client.Get(apiURL) @@ -229,45 +210,6 @@ func CreateMeeting(client *http.Client, userID string, request *CreateMeetingReq return &meeting, nil } -func DataCompliance(clientID, clientSecret string, request *DataComplianceRequest) (*DataComplianceResponse, error) { - apiURL := fmt.Sprintf("%s/oauth/data/compliance", apiBaseURL) - payload, err := json.Marshal(request) - if err != nil { - return nil, err - } - - client := &http.Client{} - req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(payload)) - if err != nil { - return nil, err - } - req.Header.Add("content-type", "application/json") - req.SetBasicAuth(clientID, clientSecret) - resp, err := client.Do(req) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - data, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if resp.StatusCode != http.StatusOK { - return nil, parseError(resp.StatusCode, data) - } - - var event DataComplianceResponse - err = json.Unmarshal(data, &event) - if err != nil { - return nil, err - } - - return &event, nil -} - type ZoomAPIError struct { Code int `json:"code"` Message string `json:"message"` diff --git a/zoombot/zoombot/http.go b/zoombot/zoombot/http.go index 893bc0ea..e995755f 100644 --- a/zoombot/zoombot/http.go +++ b/zoombot/zoombot/http.go @@ -36,6 +36,7 @@ func NewHTTPSrv(stats *base.StatsRegistry, kbc *kbchat.API, debugConfig *base.Ch "zoombot", base.Images["logo"], "/zoombot") http.HandleFunc("/zoombot", h.healthCheckHandler) http.HandleFunc("/zoombot/deauthorize", h.zoomDeauthorize) + http.HandleFunc("/zoombot/support", h.supportHandler) return h } @@ -43,6 +44,10 @@ func (h *HTTPSrv) healthCheckHandler(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, "OK") } +func (h *HTTPSrv) supportHandler(w http.ResponseWriter, _ *http.Request) { + fmt.Fprint(w, supportHTML) +} + // see https://developers.zoom.us/docs/api/webhooks/#verify-with-zooms-header func (h *HTTPSrv) validateWebhookMessage(bodyBytes []byte, r *http.Request) (err error) { requestTimestamp := r.Header.Get("x-zm-request-timestamp") @@ -97,17 +102,4 @@ func (h *HTTPSrv) zoomDeauthorize(w http.ResponseWriter, r *http.Request) { http.Error(w, "unable to delete user", http.StatusBadRequest) return } - - _, err = DataCompliance(h.credentials.ClientID, h.credentials.ClientSecret, &DataComplianceRequest{ - ClientID: deauthorizationRequest.Payload.ClientID, - UserID: deauthorizationRequest.Payload.UserID, - AccountID: deauthorizationRequest.Payload.AccountID, - DeauthorizationEventReceived: deauthorizationRequest.Payload, - ComplianceCompleted: true, - }) - if err != nil { - h.Errorf("zoomDeauthorize: compliance error: %s", err) - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } } diff --git a/zoombot/zoombot/support_html.go b/zoombot/zoombot/support_html.go new file mode 100644 index 00000000..22f35202 --- /dev/null +++ b/zoombot/zoombot/support_html.go @@ -0,0 +1,57 @@ +package zoombot + +const supportHTML = ` + + Keybase Meeting Link Bot Support + + + +

Installation

+ +

Usage

+ +

Contact Support

+ + + + +`