From 3017f704d92190967815066ae686354fd5bf4edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Wed, 6 Jul 2022 19:28:13 +0200 Subject: 0.0.23 --- Makefile | 6 ++---- README.md | 29 ++++++++++++++--------------- debian/changelog | 7 +++++++ debian/copyright | 2 +- src/hp.html | 10 +++++++--- src/httpd.c | 9 +++++++-- src/ico.ico | Bin 0 -> 1150 bytes src/icon.c | 12 ++++++++++++ src/main.c | 3 +++ src/osdd.xml | 5 +++-- 10 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 src/ico.ico create mode 100755 src/icon.c 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: ungoogled-chromium, icecat, links and many more +pages that sear.c generates were tested and are usable on the following www clients: ungoogled-chromium, icecat, links 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: -* arm64: -* armel: +* amd64: +* arm64: +* armel: * 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 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 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 050c8dd..09bd680 100644 --- a/src/hp.html +++ b/src/hp.html @@ -9,13 +9,12 @@ - - +
- + @@ -30,6 +29,11 @@

sear.c +

+ 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 Binary files /dev/null and b/src/ico.ico 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 +#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 }; +unsigned char sc_ico[] = { +#include +}; 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 @@ - sear.c - sear.c + sear.c @ %s + sear.c @ %s + 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== -- cgit v1.2.3