summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--README.md29
-rw-r--r--debian/changelog7
-rw-r--r--debian/copyright2
-rw-r--r--src/hp.html10
-rw-r--r--src/httpd.c9
-rw-r--r--src/ico.icobin0 -> 1150 bytes
-rwxr-xr-xsrc/icon.c12
-rw-r--r--src/main.c3
-rw-r--r--src/osdd.xml5
10 files changed, 56 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index f72022e..f232335 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ default:
echo ', 0' >> tmp/osdd.xxd
xxd -i < src/css.css > tmp/css.xxd
echo ', 0' >> tmp/css.xxd
+ xxd -i < src/ico.ico > tmp/ico.xxd
$(CC) $(cflags) $(CFLAGS) $(SRCFILE) $(ldflags) $(LDFLAGS) -o$(BINFILE)
install:
@@ -32,9 +33,6 @@ distclean:
clean:
rm sear.c tmp -rf
-prepare:
- apt install libmicrohttpd-dev xxd build-essential libxml2-dev php-cli debmake debheler -y
-
test-http:
mkdir -p tmp
gcc -Wall -pedantic -g -Isrc -Itmp test/nanohttp.c $$(xml2-config --libs --cflags) -otmp/nanohttp
@@ -45,4 +43,4 @@ test-http-valgrind:
valgrind:
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./sear.c
-.PHONY: valgrind test-http-valgrind test-http prepare clean distclean install default
+.PHONY: valgrind test-http-valgrind test-http clean distclean install default
diff --git a/README.md b/README.md
index 8956403..37960ae 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,13 @@
# sear.c
-sear.c is used as a lightweight replacement for [SearX](http://en.wikipedia.org/wiki/Searx) that proxies and caches search results
+sear.c is used as a lightweight replacement for [SearX](//en.wikipedia.org/wiki/Searx) that proxies and caches search results
from the Google web search engine. The main advantages over SearX are speed and simplicity.
## packaging
### debian and ubuntu
-First add my software distribution repository [prog.sijanec.eu](http://prog.sijanec.eu) into your APT sources list. See instructions [there](http://prog.sijanec.eu).
+First add my software distribution repository [prog.sijanec.eu](//prog.sijanec.eu) into your APT sources list. See instructions [there](//prog.sijanec.eu).
```
apt install sear.c
@@ -17,7 +17,7 @@ service sear.c start
### gentoo
-First add my ebuild overlay repository [sijanec/ebuild](http://git.sijanec.eu/sijanec/ebuild) into your portage repos.conf. See instructions [there](http://git.sijanec.eu/sijanec/ebuild). [Read this note.](#user-content-notes)
+First add my ebuild overlay repository [sijanec/ebuild](//git.sijanec.eu/sijanec/ebuild) into your portage repos.conf. See instructions [there](//git.sijanec.eu/sijanec/ebuild). [Read this note.](#notes)
```
emerge --ask www-apps/searc
@@ -37,12 +37,11 @@ rc-service start sear.c
### supported browsers
-pages that sear.c generates were tested and are usable on the following www clients: <a href=http://github.com/Eloston/ungoogled-chromium>ungoogled-chromium</a>, <a href=//gnu.org/software/gnuzilla>icecat</a>, <a href=//links.twibright.com>links</a> and many more
+pages that sear.c generates were tested and are usable on the following www clients: <a href=//github.com/Eloston/ungoogled-chromium>ungoogled-chromium</a>, <a href=//gnu.org/software/gnuzilla>icecat</a>, <a href=//links.twibright.com>links</a> and many more
## compiling from source
```
-make prepare # debian only, runs apt install (run as root)
make # compiles
./sear.c # runs the server
```
@@ -78,20 +77,20 @@ apart from the usual debian distribution, there are also prebuilt dynamically li
before downloading, check that the build passed, indicated below on the badge:
-[![Build Status](https://jenkins.sijanec.eu/job/sear.c/badge/icon)](http://jenkins.sijanec.eu/job/sear.c/)
+[![Build Status](//jenkins.sijanec.eu/job/sear.c/badge/icon)](//jenkins.sijanec.eu/job/sear.c/)
-* amd64: <https://amd64.sijanec.eu/prog/sear.c>
-* arm64: <https://arm64.sijanec.eu/prog/sear.c>
-* armel: <https://armel.sijanec.eu/prog/sear.c>
+* amd64: <//amd64.sijanec.eu/prog/sear.c>
+* arm64: <//arm64.sijanec.eu/prog/sear.c>
+* armel: <//armel.sijanec.eu/prog/sear.c>
* i386: *only published in debian package repository because they are built on my personal laptop*
## screenshots
-![screenshot in chromium 0](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc.png)
-![screenshot in chromium 2](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc2.png)
-![screenshot in chromium 3](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc3.png)
-![screenshot in chromium 4](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc4.png)
-![screenshot in chromium 5](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc5.png)
+![screenshot in chromium 0](//cdn.sijanec.eu/img/2021/04/sear.c_prtsc.png)
+![screenshot in chromium 2](//cdn.sijanec.eu/img/2021/04/sear.c_prtsc2.png)
+![screenshot in chromium 3](//cdn.sijanec.eu/img/2021/04/sear.c_prtsc3.png)
+![screenshot in chromium 4](//cdn.sijanec.eu/img/2021/04/sear.c_prtsc4.png)
+![screenshot in chromium 5](//cdn.sijanec.eu/img/2021/04/sear.c_prtsc5.png)
## security
@@ -106,4 +105,4 @@ before downloading, check that the build passed, indicated below on the badge:
### notes
-* **gentoo ebuild**: openrc's start-stop-daemon lacks support for easy creation of unprivileged daemons in chrooted environments with logging enabled, which sear.c absolutely requires due to it being in early alpha unstable stage. [a pull request was submitted to openrc that adds such features](//http://github.com/OpenRC/openrc/pull/517); until it's merged and until it's changes are gentoo, sear.c's init script is unusable.
+* **gentoo ebuild**: openrc's start-stop-daemon lacks support for easy creation of unprivileged daemons in chrooted environments with logging enabled, which sear.c absolutely requires due to it being in early alpha unstable stage. [a pull request was submitted to openrc that adds such features](//github.com/OpenRC/openrc/pull/517); until it's merged and until it's changes are gentoo, sear.c's init script is unusable.
diff --git a/debian/changelog b/debian/changelog
index f8caead..3e4973e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sear.c (0.0.23-1) stable; urgency=low
+
+ * added a hreflink with window.external.AddSearchProvider (for palemoon)
+ * added a bitmap ico icon drawn with bitmap(1)
+
+ -- Anton Luka Šijanec <anton@sijanec.eu> Wed, 6 Jul 2022 19:00:00 +0200
+
sear.c (0.0.22-1) stable; urgency=low
* loglevel environment variable and compile-time option
diff --git a/debian/copyright b/debian/copyright
index 5a0b54f..1566650 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,6 +2,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: sear.c
Upstream-Contact: Anton Luka Šijanec <anton@sijanec.eu>
Source: http://git.sijanec.eu/sijanec/sear.c
-Copyright: 2021 Anton Luka Šijanec
+Copyright: 2022 Anton Luka Šijanec
Disclaimer: This package is not licensed under any license.
Comment: At least in current version of this program, no licensing information was published.
diff --git a/src/hp.html b/src/hp.html
index 967a236..09bd680 100644
--- a/src/hp.html
+++ b/src/hp.html
@@ -9,13 +9,12 @@
</title>
<meta name=viewport content="width=device-width, initial-scale=1">
<link rel=stylesheet href=/css.css />
- <link rel="shortcut icon" href=data:image/x-icon;, type=image/x-icon> <!-- prevents favicon lookups -->
- <link rel=icon href="data:;base64,iVBORw0KGgo=">
+ <link rel=icon type=image/x-icon href="/favicon.ico"> <!-- cd tmp; gcc ../src/icon.c; ./a.out > i.pgm; convert i.pgm src/ico.ico -->
<link title=sear.c rel=search type=application/opensearchdescription+xml href=/osdd.xml>
</head>
<body>
<form class=container action=.>
- <input accesskey=s type=text name=q value="%s" placeholder="sear.c ..." size=256 />
+ <input accesskey=s type=text name=q value="%s" placeholder="sear.c ..." size=50 />
<button type=submit value=🔍 ><span>=&gt;</span></button>
<button accesskey=f type=submit name=f value=Ʊ ><span>1.</span></button>
<button accesskey=i type=submit name=i value=🖼 ><span>[^]</span></button>
@@ -30,6 +29,11 @@
<h4 align=center>
<a href=//git.sijanec.eu/sijanec/sear.c >sear.c</a>
<!-- the following is replaced by git or ebuild version --> <!--ver-->
+ <a href=javascript:window.external.AddSearchProvider(window.location.origin+"/osdd.xml") id=r hidden=hidden >registriraj v brskalnik</a>
</h4>
+ <script>
+ if (typeof window.external.AddSearchProvider === "function")
+ document.getElementById("r").hidden = false;
+ </script>
</body>
</html>
diff --git a/src/httpd.c b/src/httpd.c
index efebd75..abe025a 100644
--- a/src/httpd.c
+++ b/src/httpd.c
@@ -149,8 +149,8 @@ enum MHD_Result sc_httpd (void * cls,
content_type = "text/plain";
break;
case 'o': /* osdd.xml - opensearch description document */
- response = malloc(strlen(sc_osdd)+strlen(host));
- sprintf(response, sc_osdd, host);
+ response = malloc(strlen(sc_osdd)+strlen(host)*3);
+ sprintf(response, sc_osdd, host, host, host);
content_type = "application/opensearchdescription+xml";
break;
case 'c': /* css.css - stylesheets */
@@ -158,6 +158,11 @@ enum MHD_Result sc_httpd (void * cls,
response = sc_css;
content_type = "text/css";
break;
+ case 'f': /* favicon.ico */
+ mhdrmm = MHD_RESPMEM_PERSISTENT;
+ response = (char *) sc_ico;
+ content_type = "image/x-icon";
+ break;
case 'l': /* logs.html */
{
#ifdef SC_LOGMEM
diff --git a/src/ico.ico b/src/ico.ico
new file mode 100644
index 0000000..6d3265d
--- /dev/null
+++ b/src/ico.ico
Binary files differ
diff --git a/src/icon.c b/src/icon.c
new file mode 100755
index 0000000..0611086
--- /dev/null
+++ b/src/icon.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#define sear_width 16
+#define sear_height 16
+static unsigned char sear_bits[] = {
+ 0x00, 0x00, 0x0c, 0x07, 0x92, 0x08, 0x44, 0x10, 0x29, 0x24, 0x26, 0x28,
+ 0x20, 0x24, 0x40, 0x10, 0xc0, 0x08, 0x60, 0x07, 0x30, 0x00, 0x18, 0x30,
+ 0x0c, 0x08, 0x06, 0x08, 0x00, 0x32, 0x00, 0x00};
+int main (void) {
+ printf("P5 16 16 1\n");
+ for (unsigned i = 0; i < sizeof(sear_bits)*8; i++)
+ putchar(sear_bits[i/8] & 1 << i % 8 ? 0 : 1);
+}
diff --git a/src/main.c b/src/main.c
index e03b0c2..5a30742 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,6 +61,9 @@ char sc_osdd[] = { /* xml document for opensearch */
char sc_css[] = { /* css */
#include <css.xxd>
};
+unsigned char sc_ico[] = {
+#include <ico.xxd>
+};
char sc_robotstxt[] = "User-Agent: *\nDisallow: /\n";
char sc_securitytxt[] = "# This content information is provided by the developer of this opensource application.\n"
"# The developer is not responsible for the actions of his software\n"
diff --git a/src/osdd.xml b/src/osdd.xml
index 9522910..21b7bf4 100644
--- a/src/osdd.xml
+++ b/src/osdd.xml
@@ -2,7 +2,8 @@
<!-- this file is a format string, so make sure it does not exceed ~4000 characters and it has percents escaped with
percent percent. -->
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" >
- <ShortName>sear.c</ShortName>
- <Description>sear.c</Description>
+ <ShortName>sear.c @ %s</ShortName>
+ <Description>sear.c @ %s</Description>
<Url type="text/html" method="get" template="http://%s/?q={searchTerms}" />
+ <Image height="16" width="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAA////////////AAAA/wAAAP////////////////8AAAD/AAAA////////////////////////////////////////////AAAA/////////////////////////////////wAAAP8AAAD//////////////////////////////////////wAAAP//////////////////////////////////////AAAA/wAAAP//////////////////////////////////////AAAA/wAAAP////////////////////////////////8AAAD/AAAA/////////////////////////////////////////////////////////////////////////////////wAAAP8AAAD//////wAAAP8AAAD/AAAA////////////////////////////////////////////////////////////AAAA/wAAAP////////////////8AAAD//////////////////////////////////////////////////////wAAAP///////////////////////////wAAAP///////////////////////////////////////////wAAAP//////////////////////AAAA////////////AAAA/////////////////wAAAP8AAAD///////////8AAAD///////////////////////////8AAAD//////wAAAP///////////wAAAP///////////wAAAP//////AAAA//////////////////////8AAAD///////////8AAAD//////////////////////wAAAP////////////////8AAAD///////////////////////////8AAAD//////////////////////wAAAP///////////wAAAP///////////wAAAP////////////////8AAAD/////////////////////////////////AAAA/wAAAP//////////////////////AAAA/wAAAP8AAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Image>
</OpenSearchDescription>