7545a188d43c6e1ea33f692b0d833ec96a7f76c5 chmalee Wed Aug 14 09:21:15 2024 -0700 refactor some methods into userdata.c for writing hub.txt files. Finish trackHubWizard.c back end for writing hub.txt and clean up the html. Start of adding a modal dialog for creating hub.txt diff --git src/hg/hgHubConnect/hooks/pre-create.c src/hg/hgHubConnect/hooks/pre-create.c index 053afcd..577acbb 100644 --- src/hg/hgHubConnect/hooks/pre-create.c +++ src/hg/hgHubConnect/hooks/pre-create.c @@ -55,31 +55,31 @@ { struct errCatch *errCatch = errCatchNew(0); if (errCatchStart(errCatch)) { struct lineFile *lf = lineFileStdin(FALSE); char *request = lineFileReadAll(lf); struct jsonElement *req = jsonParse(request); fprintf(stderr, "Hook request:\n"); jsonPrintToFile(req, NULL, stderr, 0); char *reqCookie= jsonQueryString(req, "", "Event.HTTPRequest.Header.Cookie[0]", NULL); if (reqCookie) { setenv("HTTP_COOKIE", reqCookie, 0); } fprintf(stderr, "reqCookie='%s'\n", reqCookie); - char *userName = (loginSystemEnabled() || wikiLinkEnabled()) ? wikiLinkUserName() : NULL; + char *userName = getUserName(); fprintf(stderr, "userName='%s'\n'", userName); if (!userName) { errAbort("You are not logged in. Please navigate to My Data -> My Sessions and log in or create an account."); } else { long reqFileSize = jsonQueryInt(req, "", "Event.Upload.Size", 0, NULL); char *reqFileName = jsonQueryString(req, "", "Event.Upload.MetaData.fileName", NULL); long currQuota = checkUserQuota(userName); long newQuota = currQuota + reqFileSize; long maxQuota = getMaxUserQuota(userName); if (newQuota > maxQuota) { errAbort("File '%s' is too large, need %s free space but current used space is %s out of %s", reqFileName, prettyFileSize(reqFileSize), prettyFileSize(currQuota), prettyFileSize(maxQuota));