0ae2a6a36d7b4c77e8e7d7df2a1049f4412e7099
max
  Fri Sep 18 07:03:44 2026 -0700
hgHubConnect: let a mirror hand out its own API keys, and stop swallowing links to another host

#Preview2 week - bugs introduced now will need a build patch to fix
Two of the three problems QA found on #38323.

The link in the mirror-only Hub Upload message did not go anywhere. The tab
handler in hgHubConnect.js catches every hgHubConnect link with a hash and turns
it into a tab switch, and 'Go to Hub Upload on genome.ucsc.edu' has a hash that
names a tab on the mirror too, so the click just reopened the tab the reader was
already on. It now only intercepts links to the page itself.

The API key section was decoupled from storeUserFiles, but only for display: the
Generate and Revoke buttons are cartJson requests, and both the javascript that
sends them and the code in main() that routes them were still inside the
storeUserFiles gate. A site with showHubApiKey on and hubSpace off therefore drew
two dead buttons. The key functions move out of hgMyData.js into a new
hubApiKey.js that the Hub Development tab includes on its own, main() routes a
cartJson request when either setting is on, and the hubSpace file commands stay
registered only when hubSpace is actually running.

The request also goes to this host's hgHubConnect now rather than to the login
host. Keys live in the central database of the server that issues them, so a key
made on genome-euro belongs in genome-euro's table.

refs #38323

diff --git src/hg/js/makefile src/hg/js/makefile
index 97bd5d3c8e2..820a3f99adc 100644
--- src/hg/js/makefile
+++ src/hg/js/makefile
@@ -1,27 +1,27 @@
 kentSrc = ../..
 include ../../inc/common.mk
 include install.mk
 
 SUBDIRS= external model react tutorials
 include subdirs.mk
 
 # UCSC js files must pass jshint
 UCSC_JS_FILES=ajax.js alleles.js assemblySearch.js autocomplete.js \
     autocompleteCat.js edwPersona.js facetedComposite.js \
     hgBlat.js hgSession.js hgCustom.js hgCollection.js  hgGateway.js hgGtexTrackSettings.js \
-    hgHubConnect.js hgTracks.js hgc.js hgMyData.js hgPhyloPlace.js \
+    hgHubConnect.js hgTracks.js hgc.js hgMyData.js hubApiKey.js hgPhyloPlace.js \
     hgVai.js hui.js jsHelper.js utils.js ddcl.js subCfg.js \
     encodeProject.js encodeDataSummary.js encodeDataMatrix.js encodeChipMatrix.js encodeMatrix.js d3.dendrograms.js \
 	cdwSummaryJs.js spectrum.min.js hgSearch.js lorax.js liftRequest.js \
 	myVariantsBlocks.js topLinks.js
 
 # ES6 module files loaded via dynamic import() on hgc details pages
 MODULE_FILES=hgc.histogram.js hgc.scatterPlot.js
 
 # STATIC files must pass jshint
 STATIC_FILES=staticDoc.js dbDbTaxonomy.js analytics.js
 
 # JQUERY files and other third pary files which have NOT BEEN TOUCHED by UCSC
 JQUERY_FILES_UNTOUCHED= \
     d3pie.min.js \
     jquery.js jquery.imgareaselect.js jquery-ui.js jquery.contextmenu.js \