1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

localhost is direct URL now instead of geminispace.info/search?localhost (#326) (#327)

This commit is contained in:
William Rehwinkel 2023-05-19 20:44:23 -04:00 committed by GitHub
parent e432e28003
commit 40f55d894b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,9 +215,10 @@ func Init(version, commit, builtBy string) {
// We don't want to convert legitimate
// :// links to search terms.
query := strings.TrimSpace(query)
if (strings.Contains(query, " ") && !hasSpaceisURL.MatchString(query)) ||
if ((strings.Contains(query, " ") && !hasSpaceisURL.MatchString(query)) ||
(!strings.HasPrefix(query, "//") && !strings.Contains(query, "://") &&
!strings.Contains(query, ".")) && !strings.HasPrefix(query, "about:") {
!strings.Contains(query, ".")) && !strings.HasPrefix(query, "about:")) &&
!(query == "localhost" || strings.HasPrefix(query, "localhost/") || strings.HasPrefix(query, "localhost:")) {
// Has a space and follows regex, OR
// doesn't start with "//", contain "://", and doesn't have a dot either.
// Then it's a search