8f0b9b181e4b7be813445c43693a3f666e8b7619 lrnassar Fri Oct 10 18:57:15 2025 -0700 Adding API key documentation and updating the CAPTCHA message so people can find it, refs #36428 diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index a9fae7b6897..35a4fc6ebee 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -422,60 +422,60 @@ static char *getApiKey(char *userName) /* Grab the already created api key if it exists */ { char *tableName = cfgOptionDefault("authTableName", AUTH_TABLE_DEFAULT); struct sqlConnection *conn = hConnectCentral(); struct dyString *query = sqlDyStringCreate("select apiKey from %s where userName='%s'", tableName, userName); char *apiKey = sqlQuickString(conn, dyStringCannibalize(&query)); hDisconnectCentral(&conn); return apiKey; } void printApiKeySection() { puts("<div id='apiKeySection' class='tabSection'>"); -puts("<h4>Hubtools API key</h4>"); +puts("<h4>API key</h4>"); char *userName = wikiLinkUserName(); char *userId = wikiLinkUserId(); if (userName==NULL || userId==NULL) { char *hgsid = cartSessionId(cart); char *loginUrl = wikiLinkUserLoginUrlReturning(hgsid, wikiLinkEncodeReturnUrl(hgsid, "hgHubConnect", "#dev")); printf("<div class='help'>You are not logged in. Please <a href='%s'>Login</a> now, then this page will show the API key.</div>", loginUrl); } else { char *existingKey = getApiKey(userName); if (existingKey) { - puts("<div id='apiKeyInstructions' class='help'>You have <span id='removeOnGenerate'>already</span> generated an api key for use in hubtools. If you would like to generate a new key (which automatically revokes old keys), please click 'generate key'. Otherwise, you can copy and paste the below key to your ~/.hubtools.conf file:<br><br>"); + puts("<div id='apiKeyInstructions' class='help'>You have <span id='removeOnGenerate'>already</span> generated an API key. If you would like to generate a new key (which revokes old keys), click 'Generate key'. To use your API key with Hubtools, copy and paste the below key to your ~/.hubtools.conf file. This is not necessary for URL use to bypass our CAPTCHA.<br><br>"); puts("<div id='apiKey' style='margin-left: 15px; font-family: monospace'>"); printf("%s\n", existingKey); puts("</div>"); puts("</div>"); - puts("<div id='generateDiv' class='help'>Generate an api key <button id='generateApiKey'>generate key</button></div>"); + puts("<div id='generateDiv' class='help'>Generate an API key <button id='generateApiKey'>Generate key</button></div>"); } else { puts("<div id='generateDiv' class='help'>To use the <tt>hubtools up</tt> command, click 'generate key'"); puts("<button id='generateApiKey'>generate key</button></div>"); printf("<div id='apiKeyInstructions' style='display: %s'>Now, create a file ~/.hubtools.conf and add the key:<br>\n", existingKey != NULL ? "block" : "none"); puts("<div id='apiKey' style='margin-left: 15px; font-family: monospace'>"); puts("</div></div>"); } - printf("<div id='revokeDiv' class='help' style='display: %s'>\nTo revoke any apiKeys associated with your account, click the revoke button: <button id='revokeApiKeys'>revoke</button>\n</div>", existingKey != NULL ? "block" : "none"); + printf("<div id='revokeDiv' class='help' style='display: %s'>\nTo revoke any API keys associated with your account, click the revoke button: <button id='revokeApiKeys'>Revoke</button>\n</div>", existingKey != NULL ? "block" : "none"); // add the event handlers for clicking the generate/revoke buttons jsInlineF("" "document.getElementById('generateApiKey').addEventListener('click', generateApiKey);\n" "document.getElementById('revokeApiKeys').addEventListener('click', revokeApiKeys);\n" ); } puts("</div>"); // tabSection apiKey } void hgHubConnectDeveloperMode() /* Put up the controls for the "Hub Development" Tab, which includes a button to run the * hubCheck utility on a hub and load a hub with the udcTimeout and measureTiming * variables turned on */ {