From 43747c997e25522b6de878081573a3e809d032b0 Mon Sep 17 00:00:00 2001 From: "Richard W. Norton" Date: Mon, 2 Dec 2024 23:52:45 +0000 Subject: [PATCH] support github webhook Summary: Merge pull request #387 from corbosman/main Adds support for Github webhooks, so that committing to a repository sends a webhook request to hound, which then re-indexes the repository. Per contributor @corbosman, this enabled his org to use Hound with thousands of repos and keep indexes fresh. Omit ports in constructed URL (#383) Improve accessibility (#398) * Resolve WCAG2AA.Principle3.Guideline3_1.3_1_1.H57.2 * Resolve WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.InputText.Name * Resolve WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.Button.Name * Improve stats contrast * Improve advanced text contrast * Improve repo title contrast * Improve contrast in advanced section * Improve line number contrast * Improve excluded files contrast * Improve "load all" button contrast Automatically build docker image and publish to ghcr.io (#401) * Feat: Use goreleaser * Feat: Add docker build, remove goreleaser * Fix: Add image name * Feat: Use ghcr.io and build-push-action@2 * We try again * Trying yet again * Fix: Use actor and GITHUB_TOKEN * Fix: Use github.actor in image tag path * Fix: use github.repository_owner instead of github.actor When you have an organisation, github.actor != github.repository_owner Co-authored-by: Jone Marius Vignes Update default-config.json (#391) * Update default-config.json * Update default-config.json (ref: main) Add hyperlinks to repository root (#396) Add literal search option (#397) * Add literal search option * Pull EscapeRegExp into common.js * Add db/ to Jest ignore patterns * Test EscapeRegExp() matches its input * Test vacuous EscapeRegExp Give repo links a target of blank (#404) Add rel="noopener noreferrer" to _blank links Adding pull request template Update README to use ghcr.io Currently, the README suggests running an outdated version of hound. There's been a lot of good work done in the past [3 years](https://hub.docker.com/r/etsy/hound/tags). The container registry was updated in https://github.com/hound-search/hound/pull/401 Add latest tag Fix typo Remove default branch warning It's been almost a year since we renamed the default branch to `main`. The warning can probably be taken out. ui: collapse and expand files Fixes #182 Fix the linter, update golang versions. (#422) * golangci to v3 per https://stackoverflow.com/questions/71758856/github-action-for-golangci-lint-fails-with-cant-load-fmt * add with latest * add setup-go and specific version * update version * Use only one actions/checkout, previous version of go linter The linter (`golangci`) and the action that runs the linter (`golangci/golangci-lint-action`) are separate. The linter seems to be running but finding new errors, so this change might be enough to temporarily squash those. * Drop go 1.12 and 1.13, add 1.17 and 1.18 There's a new golang version every 6 months. The latest two golang versions are supported officially. I'm keeping 1.14 around for now since it was previously the latest supported version. * Only run linter on 1.17 The 1.18 linter has import issues that we'll investigate later. * update version * nolint * nolint * nolint * nolint * update lint to go 1.18 Co-authored-by: David Schott chore: Bump version const Otherwise, `houndd -version` spits out the wrong version. Anticipating the patch release that this commit will go out with. Add config.json to .gitignore Add .dockerignore Adding the setup-qemu-action to enable multiplatform docker builds from github actions Attempt auto-generated files Add badge refactor to use filenames and no regex add config override add some docs add config test Update version for release Update Makefile to reflect the move to a go module. Convert Signal to es6 class. (#440) Upgrade all devDependencies in webpack build. (#439) Corrected a typo in readme.md chore: add manual install option (#446) * chore: add another option to install hound * chore: format * chore: add $GOPATH/bin in installation * fix indentation for bulleted list --------- Co-authored-by: dschott kick off for pull requests (#448) Add my name to the README change Advanced options div ID Merge pull request #449 from hound-search/jswensen-bug-385 [Issue 385] change Advanced options div ID Update list of maintainers with additional volunteers (#451) Add `display-name` option to customize/disambiguate output (#454) Rebuild ui/bindata.go It seems that ui/bindata.go has got out of sync; the changes from d25b221872426b03d9be8cf6924327e5eab6c314 aren't applying and the advanced dialog box is always showing, as the div doesn't match. Regenerating this seems to make things work Closes: #453 bump the version (#457) Update alpine to 3.16 and switch from bzr to breezy (#429) Co-authored-by: David Schott Add support for manually setting a limit on results * Added a query parameter to allow user to specify max results, rather than a hard limit at 5000, for each index. * Added support for a default max result limit in the config. If unset, it remains at the former default of 5000 results per index. * Fixed issue where no results would be returned if the limit was exceeded - now it simply returns the results up to the limit. Add tests for parse min/max bounds Merge pull request #464 from hound-search/AlexTalks/tests Add support for manually setting a limit on results(copy) Another attempt to replace go-bindata with //go:embed (#460) * switch from go-bindata to embed Signed-off-by: moson-mo * bump semver dependency to v4 Signed-off-by: moson-mo * amend workflow jobs for go-embed switch Signed-off-by: moson-mo --------- Signed-off-by: moson-mo Remove jquery from hound Merge pull request #465 from hound-search/iagu/remove-jquery Remove jquery from hound Add fake source Copy with rsync fake: Do not copy, use a symlink Rebase on the latest version Replace tar hashing with golang.org/x/mod and add options Rename vcs driver from "fake" to "local" Rename "detect-changes" to "watch-changes" Update the README Clarify a few things in the comments Suppress the linting error Prevent line numbers from being copied in search results Merge remote-tracking branch 'mainline/main' into sync_with_mainline support phab repo links Reviewers: #risk_assessment_framework! Subscribers: #risk_assessment_framework Differential Revision: https://phab.easypo.net/D61327 --- ui/assets/js/common.js | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/ui/assets/js/common.js b/ui/assets/js/common.js index 7ace5cc0..22554b38 100644 --- a/ui/assets/js/common.js +++ b/ui/assets/js/common.js @@ -33,7 +33,7 @@ export function UrlParts(repo, path, line, rev) { // hostname, optionally a port, and then a path var ssh_protocol = /^(git|hg|ssh):\/\/([^@\/]+@)?([^:\/]+)(:[0-9]+)?\/(.*)/.exec(url); - // Begin EasyPost edit: support phab links + //// Begin EasyPost edit: support phab links { // // Regex explained: Match either `git` or `hg` followed by an `@`. @@ -47,13 +47,13 @@ export function UrlParts(repo, path, line, rev) { repoName = sshParts[7] // Port is omitted in most cases. Bitbucket Server is special: // ssh://git@bitbucket.atlassian.com:7999/ATLASSIAN/jira.git - if(sshParts[3]){ + if (sshParts[3]) { port = sshParts[3] } url = hostname + port + '/' + project + '/' + repoName; } } - // End EasyPost edit + //// End EasyPost edit return { url : url, @@ -67,10 +67,38 @@ export function UrlParts(repo, path, line, rev) { }; } +//// Begin EasyPost edit: support phab links +function toPhabURL(parts) { + // https://phab.easypo.net/source/easy_post/browse/master/app/helpers/sessions_helper.rb + const rev = parts['rev'], + path = parts['path'], + project = parts['project'], + repo = parts['repo'], + anchor = parts['anchor']; + const linenum = anchor ? anchor.replace(/^#L/, '') : undefined; + const branch = 'master'; + // Caveat: Assumes "master" branch is primary/exists. + const result = ('https://phab.easypo.net/' + project + + '/' + repo + '/browse/' + branch + '/' + path + + ';' + rev); + if (linenum) { + return result + '$' + linenum; + } + return result; +} +//// End EasyPost edit + export function UrlToRepo(repo, path, line, rev) { var urlParts = UrlParts(repo, path, line, rev), pattern = repo['url-pattern'] + //// Begin EasyPost edit: support phab links + const hostname = urlParts['hostname'] || ''; + if (hostname.endsWith('phab.easypo.net')) { + return toPhabURL(urlParts); + } + //// End EasyPost edit + // I'm sure there is a nicer React/jsx way to do this: return ExpandVars(pattern['base-url'], urlParts); }