pub / serci

Search the web with !keywords
git clone https://https://src.jayvii.de/pub/serci.git
Home | Log | Files | Exports | Refs | README | RSS

commit 3d9d2e215b994ffbb15957127eac65da6c5704ee
parent 204acb8e5689f01badda6a8a8170cef7a5b04bef
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sat,  6 Jul 2024 19:43:08 +0200

feat: rename "bangs" to "keywords"

the term keyword is a lot more generic and not as
branded by DDG as bang could potentially be
perceived as

Diffstat:
MREADME.md | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mconfig/config.php | 66+++++++++++++++++++++++++++++++++---------------------------------
Mindex.php | 26+++++++++++++-------------
Mmanifest.json | 2+-
Mopensearch.xml | 2+-
5 files changed, 112 insertions(+), 79 deletions(-)

diff --git a/README.md b/README.md @@ -1,57 +1,58 @@ # traserĉi -Search the web with [!bangs](https://duckduckgo.com/bangs). +Search the web with `!keywords`. Please send patches or remarks to [jayvii+traserci[AT]posteo[DOT]de](mailto:jayvii+traserci[AT]posteo[DOT]de). ## FAQs -1. What does traserĉi mean? +### What does traserĉi mean? -It is the Esperanto term for "to search" +It is the Esperanto term for +["to search"](https://www.reta-vortaro.de/revo/dlg/index-2l.html#sercx.tra0i). -2. What are `!bangs`? +### What are `!keywords`? -An idea lent from the search Engine [DuckDuckGo](https://duckduckgo.com), which -has been utilized by many others since: +An idea lent from the search Engine [DuckDuckGo](https://duckduckgo.com/bangs), +which has been utilized by many others since: -> Bangs are shortcuts that quickly take you to search results on other sites. +> keywords are shortcuts that quickly take you to search results on other sites. > For example, when you know you want to search on another site like Wikipedia -> or Amazon, our bangs get you there fastest. A search for !w filter bubble will +> or Amazon, our keywords get you there fastest. A search for !w filter bubble will > take you directly to Wikipedia. > > Remember, though, because your search is actually taking place on that other > site, you are subject to that site’s policies, including its data collection > practices. > -> We’ve had bangs since 2008 as part of our geek roots. Now we have thousands of -> !bangs and you can even submit your own. +> We’ve had keywords since 2008 as part of our geek roots. Now we have thousands of +> !keywords and you can even submit your own. -traserĉi implements bangs for all kinds of search engine and transparently +traserĉi implements keywords for all kinds of search engine and transparently redirects you right to them. The default set of search engine and fall-backs is geared towards privacy and data minimalism. However, you can simply host traserĉi yourself any time and configure your own favorite search engines and -`!bangs`. +`!keywords`. -If you think there are `!bangs` that other people would benefit from, feel free +If you think there are `!keywords` that other people would benefit from, feel free to contribute! -3. How can I use traserĉi? - - - You can try traserĉi on [search.jayvii.de](https://search.jayvii.de). Or - host it yourself! It barely needs any server resources, no database or lots - of RAM. traserĉi has minimal footprint (also on user data: there are NONE). - - Either type your search directly into the search bar of the traserĉi - webfrontend or add the search to your browser by rightclicking in the - URL-bar and choosing `add traserĉi - Search with !bangs`. - - Some browsers (for example Firefox on Android / Fennec) allow to configure - custom search engines via search URL. Simply list - `https://search.jayvii.de/?query=%s` (or whatever traserĉi host you want to - use). - - Please do not abuse my open search site search.jayvii.de and try to host - traserĉi yourself, if you can. There is no guarantee, my site is always - online or will be continued indefinitely. +### How can I use traserĉi? + +- You can try traserĉi on [search.jayvii.de](https://search.jayvii.de). Or + host it yourself! It barely needs any server resources, no database or lots + of RAM. traserĉi has minimal footprint (also on user data: there are NONE). +- Either type your search directly into the search bar of the traserĉi + webfrontend or add the search to your browser by rightclicking in the + URL-bar and choosing `add traserĉi - Search with !keywords`. +- Some browsers (for example Firefox on Android / Fennec) allow to configure + custom search engines via search URL. Simply list + `https://search.jayvii.de/?query=%s` (or whatever traserĉi host you want to + use). +- Please do not abuse my open search site search.jayvii.de and try to host + traserĉi yourself, if you can. There is no guarantee, my site is always + online or will be continued indefinitely. ## Hosting @@ -60,16 +61,48 @@ Simply upload the entire content of this repository to your webhost. Edit `search.example.com`, you can simply run: ```bash -sed -e 's/%%URL%%/https:\/\/search.example.com/g' -i opensearch.xml +sed -e 's/%%URL%%/http:\/\/search.example.com/g' -i opensearch.xml ``` -Search-Engines and `!bangs` are configured in `config/config.php`. +Search-Engines and `!keywords` are configured in `config/config.php`. + +Speed-Deployment: +```bash +DOMAIN="search.example.com" +mkdir -p /var/www/traserci && \ + cd /var/www/traserci && \ + wget https://src.jayvii.de/pub/traserci/exports/main.tar.gz -O - | \ + tar xfvz - && \ + sed -e "s/%%URL%%/https:\/\/${DOMAIN}/g" -i opensearch.xml +``` + +Example-configuration for Apache2: + +```apache +<VirtualHost *:80> + # server name and directory + ServerAdmin webmaster[AT]example[DOT]com + ServerName search.example.com + DocumentRoot /var/www/traserci + + # log- and error files + ErrorLog ${APACHE_LOG_DIR}/search.example.com_error.log + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" custom + CustomLog ${APACHE_LOG_DIR}/search.example.com.log custom + + # do not allow file browsing + Options -Indexes + +</VirtualHost> +``` ## License traserĉi is under the AGPL-3.0 license. It is [REUSE](https://reuse.software) compliant! +Icons are licensed under CC-BY-SA-4.0. + Other bundled assets are: -* [simple.css](https://simplecss.org/); MIT License; (c) Kev Quirk +- [simple.css](https://simplecss.org/): MIT License (c) Kev Quirk diff --git a/config/config.php b/config/config.php @@ -2,7 +2,7 @@ /* Define Search Engines * Insert "%s" for the search-query part -* Bangs are defined here as well. They may ONLY contain [A-Za-z0-9_\-\.]. +* keywords are defined here as well. They may ONLY contain [A-Za-z0-9_\-\.]. */ $searches = array( @@ -11,19 +11,19 @@ $searches = array( "name" => "MetaGer Web", "website" => "https://metager.de/?focus=web", "query" => "https://metager.de/meta/meta.ger3?focus=web&eingabe=%s", - "bangs" => array("metager_web", "metager", "meta", "mg", "metaweb") + "keywords" => array("metager_web", "metager", "meta", "mg", "metaweb") ), "metager_img" => array( "name" => "MetaGer Images", "website" => "https://metager.de/focus=bilder", "query" => "https://metager.de/meta/meta.ger3?focus=bilder&eingabe=%s", - "bangs" => array("metager_img", "mgimg", "metaimg") + "keywords" => array("metager_img", "mgimg", "metaimg") ), "metager_map" => array( "name" => "MetaGer Maps", "website" => "https://metager.de/?fokus=maps", "query" => "https://maps.metager.de/en/%s/guess", - "bangs" => array( + "keywords" => array( "metager_map", "metager_maps", "mgmap", "metamap", "map", "maps" ) ), @@ -32,184 +32,184 @@ $searches = array( "name" => "Qwant Web", "website" => "https://qwant.com/?t=web", "query" => "https://www.qwant.com/?t=web&q=%s", - "bangs" => array("qwant_web", "qwant", "qw") + "keywords" => array("qwant_web", "qwant", "qw") ), "qwant_img" => array( "name" => "Qwant Images", "website" => "https://qwant.com/?t=images", "query" => "https://www.qwant.com/?t=images&q=%s", - "bangs" => array("qwant_img", "qwimg", "images", "image", "img") + "keywords" => array("qwant_img", "qwimg", "images", "image", "img") ), "qwant_video" => array( "name" => "Qwant Videos", "website" => "https://qwant.com/?t=videos", "query" => "https://www.qwant.com/?t=videos&q=%s", - "bangs" => array("qwant_video", "qwvid") + "keywords" => array("qwant_video", "qwvid") ), /* Mojeek */ "mojeek_web" => array( "name" => "Mojeek Web", "website" => "https://mojeek.com", "query" => "https://www.mojeek.com/search?q=%s", - "bangs" => array("mojeek_web", "mojeek", "mj") + "keywords" => array("mojeek_web", "mojeek", "mj") ), /* Translations and Languages */ /* "leo" => array( "name" => "LEO (en-de)", "website" => "https://leo.org", "query" => "https://dict.leo.org/englisch-deutsch/%s", - "bangs" => array("leo") + "keywords" => array("leo") ),*/ "dictcc" => array( "name" => "dict.cc", "website" => "https://dict.cc", "query" => "https://m.dict.cc/?s=%s", - "bangs" => array("dictcc", "dict", "translate", "tl") + "keywords" => array("dictcc", "dict", "translate", "tl") ), "deepl" => array( "name" => "DeepL (en-de)", "website" => "https://deepl.com", "query" => "https://www.deepl.com/translator#de/en/%s", - "bangs" => array("deepl") + "keywords" => array("deepl") ), "duden" => array( "name" => "Duden", "website" => "https://www.duden.de", "query" => "https://www.duden.de/suchen/dudenonline/%s", - "bangs" => array("duden", "ger", "de") + "keywords" => array("duden", "ger", "de") ), /* Videos */ "youtube" => array( "name" => "YouTube", "website" => "https://www.youtube.com", "query" => "https://www.youtube.com/results?search_query=%s", - "bangs" => array("youtube", "yt", "video", "videos") + "keywords" => array("youtube", "yt", "video", "videos") ), "sepiasearch" => array( "name" => "Sepia Search", "website" => "https://sepiasearch.org", "query" => "https://sepiasearch.org/search?search=%s", - "bangs" => array("sepiasearch", "sepia", "peertube", "pt") + "keywords" => array("sepiasearch", "sepia", "peertube", "pt") ), /* Maps */ "openstreetmap" => array( "name" => "OpenStreetMap", "website" => "https://www.openstreetmap.org", "query" => "https://www.openstreetmap.org/search?query=%s", - "bangs" => array("openstreetmap", "osm") + "keywords" => array("openstreetmap", "osm") ), /* Science */ "base" => array( "name" => "BASE", "website" => "https://www.base-search.net", "query" => "https://www.base-search.net/Search/Results?lookfor=%s", - "bangs" => array("base", "basesearch", "science") + "keywords" => array("base", "basesearch", "science") ), "google_scholar" => array( "name" => "Google Scholar", "website" => "https://scholar.google.com", "query" => "https://scholar.google.com/scholar?q=%s", - "bangs" => array("google_scholar", "gscholar") + "keywords" => array("google_scholar", "gscholar") ), "semanticscholar" => array( "name" => "Semantic Scholar", "website" => "https://semanticscholar.org", "query" => "https://semanticscholar.org/search?q=%s", - "bangs" => array("semanticscholar", "scholar", "literature") + "keywords" => array("semanticscholar", "scholar", "literature") ), /* Wikis */ "wikipedia" => array( "name" => "Wikipedia", "website" => "https://wikipedia.org", "query" => "https://wikipedia.org/wiki/%s", - "bangs" => array("wikipedia", "wiki", "wp", "wk") + "keywords" => array("wikipedia", "wiki", "wp", "wk") ), "archwiki" => array( "name" => "Arch Wiki", "website" => "https://wiki.archlinux.org", "query" => "https://wiki.archlinux.org/index.php?search=%s", - "bangs" => array("archwiki", "arch", "aw") + "keywords" => array("archwiki", "arch", "aw") ), "debianwiki" => array( "name" => "Debian Wiki", "website" => "https://wiki.debian.org", "query" => "https://wiki.debian.org/?action=fullsearch&value=%s", - "bangs" => array("debianwiki", "debian", "deb", "dw") + "keywords" => array("debianwiki", "debian", "deb", "dw") ), /* Coding */ "stackoverflow" => array( "name" => "Stackoverflow", "website" => "https://stackoverflow.com", "query" => "https://stackoverflow.com/search?q=%s", - "bangs" => array("stackoverflow", "so", "code") + "keywords" => array("stackoverflow", "so", "code") ), "w3schools" => array( "name" => "W3schools (via Mojeek)", /* This is a workaround */ "website" => "https://www.w3schools.com", "query" => "https://www.mojeek.com/search?q=site:www.w3schools.com+%s", - "bangs" => array("w3schools", "w3school", "www", "w3", "webdev") + "keywords" => array("w3schools", "w3school", "www", "w3", "webdev") ), /* Code Repositories */ "github" => array( "name" => "GitHub", "website" => "https://github.com", "query" => "https://github.com/search?q=%s", - "bangs" => array("github", "gh") + "keywords" => array("github", "gh") ), "codeberg" => array( "name" => "Codeberg", "website" => "https://codeberg.org", "query" => "https://codeberg.org/explore/repos?only_show_relevant=true&q=%s", - "bangs" => array("codeberg", "cb") + "keywords" => array("codeberg", "cb") ), "sourcehut" => array( "name" => "Sourcehut", "website" => "https://sr.ht", "query" => "https://sr.ht/projects?search=%s", - "bangs" => array("sourcehut", "srht", "sir") + "keywords" => array("sourcehut", "srht", "sir") ), /* Software Repositories */ "dockerhub" => array( "name" => "dockerhub", "website" => "https://hub.docker.com", "query" => "https://hub.docker.com/search?q=%s", - "bangs" => array("dockerhub", "docker", "dh") + "keywords" => array("dockerhub", "docker", "dh") ), "flathub" => array( "name" => "Flathub", "website" => "https://flathub.org", "query" => "https://flathub.org/apps/search?q=%s", - "bangs" => array("flathub", "flatpak", "fh", "fp") + "keywords" => array("flathub", "flatpak", "fh", "fp") ), "fdroid" => array( "name" => "F-Droid", "website" => "https://f-droid.org", "query" => "https://search.f-droid.org/?q=%s", - "bangs" => array("fdroid", "f-droid", "fd", "android") + "keywords" => array("fdroid", "f-droid", "fd", "android") ), /* Misc */ "symbl" => array( "name" => "SYMBL", "website" => "https://symbl.cc", "query" => "https://symbl.cc/search/?q=%s", - "bangs" => array("symbl", "symbol", "unicode") + "keywords" => array("symbl", "symbol", "unicode") ), "waybackmachine" => array( "name" => "Wayback Machine", "website" => "https://web.archive.org", "query" => "https://web.archive.org/web/99999999000000*/%s", - "bangs" => array("waybackmachine", "webarchive", "wbm", "wb") + "keywords" => array("waybackmachine", "webarchive", "wbm", "wb") ), "internetarchive" => array( "name" => "Internet Archive", "website" => "https://archive.org", "query" => "https://archive.org/search?query=%s", - "bangs" => array("internetarchive", "archive", "ia") + "keywords" => array("internetarchive", "archive", "ia") ), ); /* Default Search Engine -* Search Engine to use when no (known) bang is given +* Search Engine to use when no (known) keyword is given */ $default_search = "metager_web"; diff --git a/index.php b/index.php @@ -13,24 +13,24 @@ $query = rawurldecode($_GET["query"]); if (strlen($query) > 0) { - /* Find bang (only first one is considered) */ - $bang = preg_replace( + /* Find keywords (only first one is considered) */ + $keyword = preg_replace( '/^.*?\!([A-Za-z0-9_\-\.]+).*$/', '${1}', $query ); - /* Based on given bang, choose a search engine */ + /* Based on given keyword, choose a search engine */ $search = $default_search; foreach (array_keys($searches) as $key) { - if (array_search($bang, $searches[$key]["bangs"]) !== false) { - /* If bang has been found, assign search engine and end the loop */ + if (array_search($keyword, $searches[$key]["keywords"]) !== false) { + /* If keyword has been found, assign search engine and end the loop */ $search = $key; break; } } - /* Strip bang from search term */ + /* Strip keyword from search term */ $search_term = preg_replace( '/\![A-Za-z0-9_\-\.]+/', '', @@ -60,23 +60,23 @@ if (strlen($query) > 0) { <link rel=icon href=/assets/img/favicon.ico type=x-image/ico> <link rel=stylesheet href=/assets/css/simple.min.css media=all> <link rel=stylesheet href=/assets/css/custom.css> - <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="traserĉi - search with !bangs"> + <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="traserĉi - search with !keywords"> <link rel="manifest" href="manifest.json"> - <title>traserĉi - search with !bangs</title> + <title>traserĉi - search with !keywords</title> </head> <!-- Body --> <body> <!-- Search Bar --> - <h1>traserĉi - Search with !bangs</h1> + <h1>traserĉi - Search with !keywords</h1> <form id="searchform" action="/" method="get"> <input id="searchbar" name="query" type="text" autofocus - placeholder="I am thinking about... !bang" + placeholder="I am thinking about... !keyword" alt="Search the web" onkeydown="if(event.keyCode===13)return this.form.submit(),!1" > @@ -95,7 +95,7 @@ if (strlen($query) > 0) { What does <em>traserĉi</em> mean? </a></li> <li><a href="https://src.jayvii.de/pub/traserci/#faqs" target="_blank"> - What are bangs? + What are keywords? </a></li> <li><a href="https://src.jayvii.de/pub/traserci/#faqs" target="_blank"> How to use traserĉi? @@ -110,7 +110,7 @@ if (strlen($query) > 0) { <table> <tr> <th>Engine</th> - <th>Bangs</th> + <th>keywords</th> <tr> <?php @@ -129,7 +129,7 @@ foreach (array_keys($searches) as $key) { $engine_table .= "</a>" . "</td><td>" . - "<code>!" . implode("</code>, <code>!", $searches[$key]["bangs"]) . + "<code>!" . implode("</code>, <code>!", $searches[$key]["keywords"]) . "</code>" . "</td></tr>"; } diff --git a/manifest.json b/manifest.json @@ -5,7 +5,7 @@ "display":"standalone", "scope":"/", "background_color":"#000000", - "description":"Search with bangs!", + "description":"Search with keywords!", "icons":[ { "src":"/assets/img/favicon.ico", diff --git a/opensearch.xml b/opensearch.xml @@ -1,6 +1,6 @@ <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> <ShortName>traserĉi</ShortName> - <Description>Search with !bangs</Description> + <Description>Search with !keywords</Description> <Url type="text/html" method="get" template="%%URL%%/?query={searchTerms}"/> <Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAABgNzUAAAAAABEKCTkIBQSdBwQEsgcEBLEHBASxBwQEsQcEBLEHBASxBwQEsQcEBLEHBASxBQMDsAEAAIcAAAAivm1oAMNxbESeW1fYik9M/4lPTP+JT0z/iU9M/4lPTP+JT0z/iU9M/4lPTP+JT0z/iU9M/4RMSf82Hx7+AAAAh8RxbAXEcWytxnJt/8dzbv/GcWz/xnJt/8dzbv/Hcm3/x3Nu/8dy bf/Hc23/x3Nu/8dzbv/KdW//hk1K/wYDA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