09f26ed9a7dcc52b03b4d3e5b2f97c5177cd9334 max Mon Sep 21 06:00:40 2026 -0700 Drop the ${hgsid} trackDb variable; add session ids to links in the browser instead A description page's links can carry the session id without the page itself holding one. addHgsidToLinks() in utils.js walks the rendered page and appends hgsid to every that stays on this host and points into the same cgi-bin directory: a relative CGI link gets one, a static .html, a link to another host, a mailto and a plain #anchor do not, and a link that already names a session is left alone. hgc and hgTrackUi call it through a new jsAddHgsidToLinks(), and hgTracks.js calls it on the track description popup once the ajax content is in. A link written with a literal $hgsid is rewritten rather than skipped, so the description pages already deployed in the GenArk hubs work again. hVarSubst no longer knows about hgsid: it is out of the trackDb variable list, so hVarSubstTrackDbHtml is a hub-only pass again and needs no cart, and hVarSubstWithCart and webIncludeHelpFileSubst, which existed only to resolve it, are gone. The variable is taken out of the trackDb README and out of the twenty-odd description pages that used it. refs #38380 diff --git src/hg/hgTrackUi/hgTrackUi.c src/hg/hgTrackUi/hgTrackUi.c index ad5c3dbea05..d7edeb8f5e5 100644 --- src/hg/hgTrackUi/hgTrackUi.c +++ src/hg/hgTrackUi/hgTrackUi.c @@ -3740,31 +3740,31 @@ printf("Configure track container: " "" "%s ", hgTrackUiName(), cartSessionVarName(), cartSessionId(cart), database, chromosome, cgiEncode(tdbParent->track), tdbParent->longLabel); printf("

"); if (tdbIsFacetedComposite(tdb)) return; if (tdbParent->html) { // the excerpt below is the container's own description page, so it needs the same // substitution the track's page gets further down - hVarSubstTrackDbHtml(cart, tdbParent, database); + hVarSubstTrackDbHtml(tdbParent, database); // collapsed panel for Description printf("

"); // required by jsCollapsible jsBeginCollapsibleSectionFontSize(cart, tdb->track, "superDescription", "Description", FALSE, "medium"); // TODO: better done with regex char *html = replaceChars(tdbParent->html, "Description", ""); html = replaceChars(html, "

Description

", ""); html = replaceChars(html, "

Description

", ""); // remove everything after Description text char *end = stringIn("

", html); @@ -3862,47 +3862,47 @@ // NOTE: Currently only composite multi-view tracks because // reset relies upon all cart vars following naming convention: // {track}.{varName}... ( One exception supported: {track}_sel ). if (trackDbLocalSetting(tdb, "container")) { /* For the moment, be a composite... */ tdbMarkAsComposite(tdb); } if (ajax && cartOptionalString(cart, "descriptionOnly")) { char *liftDb = cloneString(trackDbSetting(tdb, "quickLiftDb")); if (liftDb) tdb->html = getTrackHtml(liftDb, tdb->table); - // resolve $hgsid, and for a hub the rest of its description page variables - hVarSubstTrackDbHtml(cart, tdb, database); + // a hub's description page has not been substituted yet + hVarSubstTrackDbHtml(tdb, database); //struct trackDb *tdbParent = tdbFillInAncestry(cartString(cart, "db"),tdb); if (tdb->html != NULL && tdb->html[0] != 0) { printRelatedTracks(database,trackHash,tdb,cart); puts(tdb->html); } else { struct trackDb *tdbParent = tdb->parent; for (;tdbParent && (tdbParent->html == NULL || tdbParent->html[0] == 0); tdbParent = tdbParent->parent ) ; // Get the first parent that has html if (tdbParent != NULL && tdbParent->html != NULL && tdbParent->html[0]) { - hVarSubstTrackDbHtml(cart, tdbParent, database); + hVarSubstTrackDbHtml(tdbParent, database); printf("

Retrieved from %s Track...

\n", COLOR_DARKGREEN,tdbParent->shortLabel); printRelatedTracks(database,trackHash,tdb,cart); puts(tdbParent->html); } else printf("

No description found for: %s.

",tdbParent?tdbParent->track:tdb->track); } cartRemove(cart,"descriptionOnly"); // This is a once only request and should be deleted return; } if (tdbIsContainer(tdb) || tdbIsSuperTrack(tdb)) { safef(setting,sizeof(setting),"%s.%s",tdb->track,RESET_TO_DEFAULTS); // NOTE: if you want track vis to not be reset, move to after vis dropdown @@ -4295,32 +4295,32 @@ char *genome = hGenome(database); char *desc = hFreezeDateOpt(database); printf("Assembly: %s %s
", genome, desc); /* Print lift information from trackDb, if any */ trackDbPrintOrigAssembly(tdb, database); printUpdateTime(database, tdb, NULL); } char *liftDb = cloneString(trackDbSetting(tdb, "quickLiftDb")); // quickLiftChain has static html if (liftDb && differentString(trackHubSkipHubName(tdb->track), "quickLiftChain")) tdb->html = getTrackHtml(liftDb, tdb->table); -// resolve $hgsid, and for a hub the rest of its description page variables -hVarSubstTrackDbHtml(cart, tdb, database); +// a hub's description page has not been substituted yet +hVarSubstTrackDbHtml(tdb, database); if (tdb->html != NULL && tdb->html[0] != 0) { char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8') htmlHorizontalLine(); else // Move line down, since

Description (in ->html) is proceded by too much space printf("
"); printf("

"); puts(""); // include anchor for Description link // Add pennantIcon printPennantIconNote(tdb); char *html = tdb->html; @@ -4772,30 +4772,31 @@ "" "%s %s", htmlEncode(tdb->parent->shortLabel), htmlEncode(tdb->shortLabel)); } else dyStringPrintf(title, "%s", htmlEncode(tdb->shortLabel)); char *titleEnd = (tdbIsSuper(tdb) ? "Tracks" : tdbIsDownloadsOnly(tdb) ? DOWNLOADS_ONLY_TITLE : "Track Settings"); htmlNoEscape(); // allow HTML tags to format title blue bar (using short label) cartWebStart(cart, database, "%s %s", title->string, titleEnd); htmlDoEscape(); trackUi(tdb, tdbList, ct, FALSE); printf("
\n"); + jsAddHgsidToLinks(); jsonPrintGlobals(); webEnd(); } } char *excludeVars[] = { "submit", "Submit", "g", "fileUrl", "track", "sourceDb", NULL, "ajax", NULL,}; int main(int argc, char *argv[]) /* Process command line. */ { long enteredMainTime = clock1000(); /* 0, 0, == use default 10 second for warning, 20 second for immediate exit */ issueBotWarning = earlyBotCheck(enteredMainTime, "hgTrackUi", delayFraction, 0, 0, "html"); cgiSpoof(&argc, argv); cartEmptyShellNoContent(doMiddle, hUserCookie(), excludeVars, NULL);