summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-07-06 19:28:13 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-07-06 19:28:13 +0200
commit3017f704d92190967815066ae686354fd5bf4edc (patch)
treeb3c14a2d57bc3f696dea72b233e6ceb65cec7316 /src
parent0.0.22 (diff)
downloadsear.c-3017f704d92190967815066ae686354fd5bf4edc.tar
sear.c-3017f704d92190967815066ae686354fd5bf4edc.tar.gz
sear.c-3017f704d92190967815066ae686354fd5bf4edc.tar.bz2
sear.c-3017f704d92190967815066ae686354fd5bf4edc.tar.lz
sear.c-3017f704d92190967815066ae686354fd5bf4edc.tar.xz
sear.c-3017f704d92190967815066ae686354fd5bf4edc.tar.zst
sear.c-3017f704d92190967815066ae686354fd5bf4edc.zip
Diffstat (limited to 'src')
-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
6 files changed, 32 insertions, 7 deletions
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 @@
</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=128/>
+ <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>