Readme

An https://fav.farm alternative built on val.town

Fork this val to host your own!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
if (import.meta.main) {
Deno.serve(fav);
}
export function fav(request: Request) {
const url = new URL(request.url);
if (url.pathname === "/")
return new Response(
String.raw`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quick Favicon</title>
<link rel="icon" href="/🚜" />
<link rel="stylesheet" href="https://unpkg.com/landsoul" />
<style>
@import url('https://fonts.upset.dev/css2?family=Google+Sans:wght@400&display=swap');
* {
font-family: 'Google Sans', sans-serif !important;
}
body {
max-width: 38rem;
min-height: 100vh;
margin: 0 auto;
display: grid;
grid-template-rows: 1fr auto;
}
main {
padding: 1rem 0.25rem;
}
footer {
padding: 1rem;
background: aliceblue;
}
pre {
box-sizing: border-box;
max-width: calc(100vw - 2rem);
overflow: auto;
user-select: all;
}
:root {
cursor: url("/πŸ–•") 15 0, auto;
}
</style>
</head>
<body>
<main>
<h1>I bet you need a quick favicon</h1>
<p>
This service is similar to <a href="https://fav.farm/" target="_blank">https://fav.farm</a>, but it produce more
accurate svg!
</p>
<p>Note that this only supports one character.</p>
<p>Use it like <a href="/πŸ’©">/πŸ’©</a></p>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/πŸ’©" /&#x3E;</pre>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/🌢" /&#x3E;</pre>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/πŸ”₯" /&#x3E;</pre>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/πŸ₯°" /&#x3E;</pre>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/πŸ–₯" /&#x3E;</pre>
<pre>&#x3C;link rel=&#x22;icon&#x22; href="%BASE_URL%/πŸ‘“" /&#x3E;</pre>
<p>You can use it with CSS Cursors too!</p>
<pre>a {
&nbsp;&nbsp;&nbsp;&nbsp;cursor: url("%BASE_URL%/πŸ–•") 15 0, auto;
}</pre>
</main>
<footer>Powered by <a href="https://val.town" target="_blank">val.town</a></footer>
</body>
</html>`.replaceAll("%BASE_URL%", url.origin),
{
headers: {
"content-type": "text/html; charset=utf-8",
},
},
);
const symbol = url.pathname.slice(1);
return new Response(
`<svg xmlns='http://www.w3.org/2000/svg' width="20" height="20">
<text text-anchor="middle" x="10" y="16">${decodeURIComponent(symbol)}</text>
</svg>`,
{
headers: {
"content-type": "image/svg+xml",
},
},
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
yieldray-fav.web.val.run
v3
December 16, 2023