aboutsummaryrefslogtreecommitdiff
path: root/cmd/hdrwtch/web.templ
blob: c19a239924446385f17947f0507200f30449e6f8 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
package main

import (
	"fmt"
	"within.website/x/htmx"
)

templ telegramWidget(botUsername string, avatarSize string, redirectURL string, requestAccess string) {
	<script async src="https://telegram.org/js/telegram-widget.js?22" data-telegram-login={ botUsername } data-size={ avatarSize } data-auth-url={ redirectURL } data-request-access={ requestAccess }></script>
}

templ notFoundPage() {
	<section class="relative h-screen mb-0 md:h-[350px] mt-8">
		<div class="container mx-auto h-full flex items-center justify-center bg-contain overflow-hidden bg-center bg-no-repeat xe-hero-image rounded-lg">
			<div class="frosted-glass p-10 text-center">
				<h1 class="text-4xl font-extrabold text-blue-600">Not found</h1>
				<p class="mt-4 text-lg text-gray-700">If you expected to find a page here, this ain't it chief. Try <a href="/">going home</a>.</p>
				<a href="/" class="mt-8 inline-block bg-blue-600 text-white font-semibold py-3 px-6 rounded shadow hover:bg-blue-700">Go home</a>
			</div>
		</div>
	</section>
}

templ homepageHead() {
	<meta name="title" content="hdrwtch - Monitor Last-Modified headers"/>
	<meta name="description" content="hdrwtch is a tool that watches for changes in the Last-Modified header of a URL. If it changes, it messages you on Telegram."/>
	<meta property="og:type" content="website"/>
	<meta property="og:url" content="https://hdrwtch.xeserv.us/"/>
	<meta property="og:title" content="hdrwtch - Monitor Last-Modified headers"/>
	<meta property="og:description" content="hdrwtch is a tool that watches for changes in the Last-Modified header of a URL. If it changes, it messages you on Telegram."/>
	<meta property="og:image" content="https://hdrwtch.xeserv.us/static/img/preview.jpg"/>
	<meta property="twitter:card" content="summary_large_image"/>
	<meta property="twitter:url" content="https://hdrwtch.xeserv.us/"/>
	<meta property="twitter:title" content="hdrwtch - Monitor Last-Modified headers"/>
	<meta property="twitter:description" content="hdrwtch is a tool that watches for changes in the Last-Modified header of a URL. If it changes, it messages you on Telegram."/>
	<meta property="twitter:image" content="https://hdrwtch.xeserv.us/static/img/preview.jpg"/>
}

templ base(title string, head, navbar, body templ.Component) {
	<!DOCTYPE html>
	<html lang="en">
		<head>
			<meta charset="UTF-8"/>
			<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
			<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
			<link rel="stylesheet" href="/static/css/styles.css"/>
			<title>{ title }</title>
			if head != nil {
				@head
			}
			@htmx.Use("remove-me")
			<script async src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
		</head>
		<body class="flex items-start justify-center h-full bg-gray-50 my-4">
			<div class="w-full max-w-5xl px-2 m-4">
				if navbar != nil {
					@navbar
				}
				@body
				@footer()
			</div>
		</body>
	</html>
}

templ footer() {
	<footer class="mt-4">
		<div class="mx-auto max-w-7xl overflow-hidden px-6 py-20 sm:py-24 lg:px-8">
			<nav class="-mb-6 columns-2 sm:flex sm:justify-center sm:space-x-12" aria-label="Footer">
				<div class="pb-6">
					<a href="/" class="text-sm leading-6 text-gray-600 hover:text-gray-900">Home</a>
				</div>
				<div class="pb-6">
					<a href="/docs/" class="text-sm leading-6 text-gray-600 hover:text-gray-900">Docs</a>
				</div>
				<div class="pb-6">
					<a href="/docs/pricing" class="text-sm leading-6 text-gray-600 hover:text-gray-900">Pricing</a>
				</div>
			</nav>
			<div class="mt-10 flex justify-center space-x-10">
				<a href="https://x.com/theprincessxena" class="text-gray-400 hover:text-gray-500">
					<span class="sr-only">X</span>
					<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
						<path d="M13.6823 10.6218L20.2391 3H18.6854L12.9921 9.61788L8.44486 3H3.2002L10.0765 13.0074L3.2002 21H4.75404L10.7663 14.0113L15.5685 21H20.8131L13.6819 10.6218H13.6823ZM11.5541 13.0956L10.8574 12.0991L5.31391 4.16971H7.70053L12.1742 10.5689L12.8709 11.5655L18.6861 19.8835H16.2995L11.5541 13.096V13.0956Z"></path>
					</svg>
				</a>
				<a href="https://github.com/Xe" class="text-gray-400 hover:text-gray-500">
					<span class="sr-only">GitHub</span>
					<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
						<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path>
					</svg>
				</a>
			</div>
			<p class="mt-10 text-center text-xs leading-5 text-gray-500">&copy; 2024 <a href="https://xeiaso.net" class="underline">Xe Iaso</a>. All rights reserved.</p>
		</div>
	</footer>
}

templ loginPage(redirURL string) {
	<p class="my-4">Use the widget below to authenticate to hdrwtch:</p>
	@telegramWidget(*botUsername, "large", redirURL, "write")
}

templ anonNavBar(showLogin bool) {
	<nav class="relative flex items-center justify-between sm:h-10 md:justify-center pb-4" aria-label="Global">
		<div class="flex items-center flex-1 md:absolute md:inset-y-0 md:left-0">
			<div class="flex items-center justify-between w-full md:w-auto">
				<a href="/">
					<span class="sr-only">hdrwtch</span>
					<img class="w-auto h-8 sm:h-10" src="/static/img/logo.svg" loading="lazy" width="40" height="40"/>
				</a>
				<div class="flex -mr-2 md:hidden">
					<button
						class="inline-flex items-center justify-center p-2 text-gray-400 bg-gray-50 rounded-md hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-gray-50"
						type="button"
						aria-expanded="false"
					>
						<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-6 h-6">
							<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16"></path>
						</svg>
					</button>
				</div>
			</div>
		</div>
		<div class="hidden md:flex md:space-x-10 list-none">
			<li>
				<a
					href="/docs/pricing"
					class="text-base font-normal text-gray-500 list-none hover:text-gray-900"
				>Pricing</a>
			</li>
			<li>
				<a
					href="/docs/"
					class="text-base font-normal text-gray-500 list-none hover:text-gray-900"
				>
					Docs
				</a>
			</li>
		</div>
		<div class="hidden md:absolute md:flex md:items-center md:justify-end md:inset-y-0 md:right-0">
			if showLogin {
				<div class="inline-flex rounded-full shadow">
					<a
						href="/login"
						class="inline-flex items-center px-4 py-2 text-base text-gray-900 bg-white border border-transparent rounded-full cursor-pointer font-base hover:bg-gray-50 "
					>
						Sign in
					</a>
				</div>
			}
		</div>
	</nav>
}

templ authedNavBar(userData *TelegramUser) {
	<nav class="relative flex items-center justify-between sm:h-10 md:justify-center pb-4" aria-label="Global">
		<div class="flex items-center flex-1 md:absolute md:inset-y-0 md:left-0">
			<div class="flex items-center justify-between w-full md:w-auto">
				<a href="/">
					<img class="w-auto h-8 sm:h-10" src="/static/img/logo.svg" loading="lazy" width="40" height="40"/>
					<span class="ml-2 sr-only">hdrwtch</span>
				</a>
				<div class="flex -mr-2 md:hidden">
					<button
						class="inline-flex items-center justify-center p-2 text-gray-400 bg-gray-50 rounded-md hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-gray-50"
						type="button"
						aria-expanded="false"
					>
						<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-6 h-6">
							<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16"></path>
						</svg>
					</button>
				</div>
			</div>
		</div>
		<div class="hidden md:flex md:space-x-10 list-none">
			<li>
				<a
					href="/docs/"
					class="text-base font-normal text-gray-500 list-none hover:text-gray-900"
				>
					Docs
				</a>
			</li>
			<li>
				<a
					href="/probe"
					class="text-base font-normal text-gray-500 list-none hover:text-gray-900"
				>
					Probes
				</a>
			</li>
		</div>
		<div class="hidden md:absolute md:flex md:items-center md:justify-end md:inset-y-0 md:right-0">
			<div class="inline-flex rounded-full shadow">
				<a
					href="/user"
					class="inline-flex items-center px-4 py-2 text-base text-gray-900 bg-white border border-transparent rounded-full cursor-pointer font-base hover:bg-gray-50"
				>
					<div class="flex items-center">
						<img
							class="inline-block h-10 w-10 rounded-full"
							src={ userData.PhotoURL }
						/>
						<span class="pl-2">
							<div>{ userData.FirstName } { userData.LastName }</div>
							<div class="text-xs">{ "@" }{ userData.Username }</div>
						</span>
					</div>
				</a>
			</div>
		</div>
	</nav>
}

templ homePage() {
	<section class="relative h-screen mb-0 md:h-[350px] mt-8">
		<div class="container mx-auto h-full flex items-center justify-center bg-contain overflow-hidden bg-center bg-no-repeat xe-hero-image rounded-lg">
			<div class="frosted-glass p-10 text-center">
				<h1 class="text-4xl font-extrabold text-blue-600">Monitor Last-Modified Headers with hdrwtch</h1>
				<p class="mt-4 text-lg text-gray-700">Stay updated with the latest changes on any URL by tracking the Last-Modified headers effortlessly.</p>
				<a href="/login" class="mt-8 inline-block bg-blue-600 text-white font-semibold py-3 px-6 rounded shadow hover:bg-blue-700">Get Started</a>
			</div>
		</div>
	</section>
	<!-- Features Section -->
	<section id="features" class="py-12">
		<div class="container mx-auto text-center">
			<h2 class="text-3xl font-bold text-gray-900">Features</h2>
			<div class="mt-10 grid grid-cols-1 md:grid-cols-3 gap-8">
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Real-Time Monitoring</h3>
					<p class="mt-4 text-gray-600">Receive instant alerts whenever a Last-Modified header changes on your monitored URLs.</p>
					<a href="/docs/alerts" class="mt-4 inline-block bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700">Learn More</a>
				</div>
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Customizable Alerts</h3>
					<p class="mt-4 text-gray-600">Set up alerts via Email, Telegram, or webhooks to suit your monitoring needs.</p>
					<a href="/docs/alerts" class="mt-4 inline-block bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700">Learn More</a>
				</div>
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Detailed Reporting</h3>
					<p class="mt-4 text-gray-600">Access comprehensive reports on the changes detected over time.</p>
					<a href="/docs/reports" class="mt-4 inline-block bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700">Learn More</a>
				</div>
			</div>
		</div>
	</section>
	<!-- Pricing Section -->
	<section id="pricing" class="py-12">
		<div class="container mx-auto text-center">
			<h2 class="text-3xl font-bold text-gray-900">Pricing</h2>
			<p class="mt-4 text-gray-600">Simple and transparent pricing to suit your needs.</p>
			<div class="mt-10 grid grid-cols-1 md:grid-cols-3 gap-8">
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Free</h3>
					<p class="mt-4 text-4xl font-bold text-gray-900">$0</p>
					<p class="mt-2 text-gray-600">per month</p>
					<ul class="mt-4 text-gray-600">
						<li>Monitor up to 5 URLs</li>
						<li>Telegram alerts</li>
						<li>Community support</li>
					</ul>
					<a href="/login" class="mt-6 inline-block bg-blue-600 text-white py-3 px-6 rounded hover:bg-blue-700">Choose Plan</a>
				</div>
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Pro</h3>
					<p class="mt-4 text-4xl font-bold text-gray-900">$3</p>
					<p class="mt-2 text-gray-600">per month</p>
					<ul class="mt-4 text-gray-600">
						<li>Monitor up to 50 URLs</li>
						<li>Email & Telegram alerts</li>
						<li>Webhook integration</li>
					</ul>
					<a href="/docs/pricing" class="mt-6 inline-block bg-blue-600 text-white py-3 px-6 rounded hover:bg-blue-700">Choose Plan</a>
				</div>
				<div class="p-6 bg-white shadow rounded">
					<h3 class="text-xl font-semibold text-blue-600">Enterprise</h3>
					<p class="mt-4 text-4xl font-bold text-gray-900">Custom</p>
					<p class="mt-2 text-gray-600">pricing</p>
					<ul class="mt-4 text-gray-600">
						<li>Unlimited URLs</li>
						<li>Priority support</li>
						<li>Custom integrations</li>
					</ul>
					<a href="/docs/contact" class="mt-6 inline-block bg-blue-600 text-white py-3 px-6 rounded hover:bg-blue-700">Contact Us</a>
				</div>
			</div>
		</div>
	</section>
	<!-- Contact Section -->
	<!--
	<section id="contact" class="py-12">
		<div class="container max-w-xl py-8 bg-white mx-auto text-center">
			<h2 class="text-3xl font-bold text-gray-900">Contact Us</h2>
			<p class="mt-4 text-gray-600">Have questions? We're here to help.</p>
			<form class="mt-10 max-w-lg mx-auto" hx-post="/sales/contact" hx-trigger="submit" hx-swap="outerHTML">
				<div class="mb-6">
					<input type="text" name="name" placeholder="Your Name" class="w-full p-4 bg-white border border-gray-300 rounded" required/>
				</div>
				<div class="mb-6">
					<input type="email" name="email" placeholder="Your Email" class="w-full p-4 bg-white border border-gray-300 rounded" required/>
				</div>
				<div class="mb-6">
					<textarea name="message" placeholder="Your Message" class="w-full p-4 bg-white border border-gray-300 rounded h-40" required></textarea>
				</div>
				<button type="submit" class="bg-blue-600 text-white py-3 px-6 rounded hover:bg-blue-700">Send Message</button>
			</form>
		</div>
	</section>
	-->
}

templ userPage(tu *TelegramUser, probeCount int64) {
	<h1 class="my-2 pt-4 mt-0 text-3xl font-medium leading-tight text-primary">
		User Info
	</h1>
	<div class="flex">
		<div class="mr-4 flex-shrink-0">
			<img
				class="inline-block h-16 w-16 rounded-full"
				src={ tu.PhotoURL }
			/>
		</div>
		<div>
			<h4 class="text-lg font-bold">{ tu.FirstName } { tu.LastName }</h4>
			<p class="mt-1">{ "@" }{ tu.Username }</p>
			<p class="mt-1"><b>Probes used</b>: { fmt.Sprint(probeCount) } / { fmt.Sprint(tu.ProbeLimit) }</p>
		</div>
	</div>
	<br/>
	<a
		class="rounded-md bg-indigo-600 m-4 px-4 py-4 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
		href="/logout"
	>Logout</a>
}