Skip to content

Commit 71af1af

Browse files
author
Philipp Heckel
committedNov 24, 2021
New logo and header
1 parent 9af64bf commit 71af1af

File tree

4 files changed

+55
-27
lines changed

4 files changed

+55
-27
lines changed
 

‎server/index.gohtml

+30-17
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
{{end}}
3535
</head>
3636
<body>
37+
<div id="header"><div id="headerBox"><img src="static/img/ntfy.png" alt="ntfy"/></div></div>
3738
<div id="main"{{if .Topic}} style="display: none"{{end}}>
38-
<h1><img src="static/img/ntfy.png" alt="ntfy"/><br/>ntfy.sh | simple HTTP-based pub-sub</h1>
39+
<h1>ntfy.sh | simple HTTP-based pub-sub</h1>
3940
<p>
40-
<b>Ntfy</b> (pronounce: <i>notify</i>) is a simple HTTP-based <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">pub-sub</a> notification service.
41-
It allows you to send notifications <a href="#subscribe-phone">to your phone</a> or desktop via scripts from any computer,
42-
entirely <b>without signup or cost</b>. It's also <a href="https://github.com/binwiederhier/ntfy">open source</a> if you want to run your own.
41+
<b>ntfy</b> (pronounce: <i>notify</i>) is a simple HTTP-based <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">pub-sub</a> notification service.
42+
It allows you to send notifications to your phone or desktop via scripts from any computer,
43+
entirely <b>without signup, cost or setup</b>. It's also <a href="https://github.com/binwiederhier/ntfy">open source</a> if you want to run your own.
4344
</p>
44-
4545
<div id="screenshots">
4646
<a href="static/img/screenshot-curl.png"><img src="static/img/screenshot-curl.png"/></a>
4747
<a href="static/img/screenshot-web-detail.png"><img src="static/img/screenshot-web-detail.png"/></a>
@@ -51,11 +51,9 @@
5151
<a href="static/img/screenshot-phone-notification.jpg"><img src="static/img/screenshot-phone-notification.jpg"/></a>
5252
</span>
5353
</div>
54-
5554
<p>
56-
There are many ways to use Ntfy. You can send yourself messages for all sorts of things: When a long process finishes or fails,
57-
or to notify yourself when somebody logs into your server(s). Or you may want to use it in your own app to distribute messages to subscribed clients.
58-
Endless possibilities 😀. Be sure to check out the <a href="#examples">examples below</a>.
55+
There are many ways to use it: Notify yourself when a build finishes, when an rsync is done or a backup fails,
56+
or know when somebody logs into your server. There are <a href="#examples">many more examples</a>, endless possibilities 😀.
5957
</p>
6058

6159
<h2 id="publish" class="anchor">Publishing messages</h2>
@@ -64,16 +62,16 @@
6462
Because there is no sign-up, <b>the topic is essentially a password</b>, so pick something that's not easily guessable.
6563
</p>
6664
<p class="smallMarginBottom">
67-
Here's an example showing how to publish a message using <tt>curl</tt> (via POST):
65+
Here's an example showing how to publish a message using a POST request (via <tt>curl -d</tt>):
6866
</p>
6967
<code>
7068
curl -d "Backup successful 😀" <span class="ntfyUrl">ntfy.sh</span>/mytopic
7169
</code>
7270
<p class="smallMarginBottom">
73-
And another one using PUT:
71+
And another one using PUT (via <tt>curl -T</tt>):
7472
</p>
7573
<code>
76-
echo -en "\u26A0\uFE0F Unauthorized login" | curl -sT- <span class="ntfyUrl">ntfy.sh</span>/mytopic
74+
echo -en "\u26A0\uFE0F Unauthorized login" | curl -T- <span class="ntfyUrl">ntfy.sh</span>/mytopic
7775
</code>
7876
<p class="smallMarginBottom">
7977
Here's an example in JS with <tt>fetch()</tt> (see <a href="https://github.com/binwiederhier/ntfy/tree/main/examples">full example</a>):
@@ -200,7 +198,7 @@
200198

201199
<h2 id="examples" class="anchor">Examples</h2>
202200
<p>
203-
There are a million ways to use Ntfy, but here are some inspirations. I try to collect
201+
There are a million ways to use ntfy, but here are some inspirations. I try to collect
204202
<a href="https://github.com/binwiederhier/ntfy/tree/main/examples">examples on GitHub</a>, so be sure to check
205203
those out, too.
206204
</p>
@@ -220,7 +218,7 @@
220218

221219
<h3 id="example-web" class="anchor">Example: Server-sent messages in your web app</h3>
222220
<p>
223-
Just as you can <a href="#subscribe-web">subscribe to topics in this Web UI</a>, you can use Ntfy in your own
221+
Just as you can <a href="#subscribe-web">subscribe to topics in this Web UI</a>, you can use ntfy in your own
224222
web application. Check out the <a href="example.html">live example</a> or just look the source of this page.
225223
</p>
226224

@@ -302,9 +300,24 @@
302300
is to facilitate instant notifications on Android.
303301
</p>
304302

303+
<p>
304+
<b id="battery-usage" class="anchor">How much battery does the Android app use?</b><br/>
305+
If you use the ntfy.sh server and you don't use the <i>instant delivery</i> feature, the Android app uses no
306+
additional battery, since Firebase Cloud Messaging (FCM) is used. If you use your own server, or you use
307+
<i>instant delivery</i>, the app has to maintain a constant connection to the server, which consumes about 4% of
308+
battery in 17h of use (on my phone). I use it and it makes no difference to me.
309+
</p>
310+
311+
<p>
312+
<b id="instant-delivery" class="anchor">What is instant delivery?</b><br/>
313+
Instant delivery is a feature in the Android app. If turned on, the app maintains a constant connection to the
314+
server and listens for incoming notifications. This consumes <a href="#battery-usage">additional battery</a>,
315+
but delivers notifications instantly.
316+
</p>
317+
305318
<p>
306319
<b id="why-no-ios" class="anchor">Why is there no iOS app (yet)?</b><br/>
307-
I don't have an iPhone or a Mac, so I didn't make an iOS app yet. I'd be awesome if
320+
I don't have an iPhone or a Mac, so I didn't make an iOS app yet. It'd be awesome if
308321
<a href="https://github.com/binwiederhier/ntfy/issues/4">someone else could help out</a>.
309322
</p>
310323

@@ -325,9 +338,9 @@
325338
<div id="detail"{{if not .Topic}} style="display: none"{{end}}>
326339
<div id="detailMain">
327340
<button id="detailCloseButton"><img src="static/img/close_black_24dp.svg"/></button>
328-
<h1><img src="static/img/ntfy.png" alt="ntfy"/><br/><span id="detailTitle"></span></h1>
341+
<h1><span id="detailTitle"></span></h1>
329342
<p class="smallMarginBottom">
330-
<b>Ntfy</b> is a simple HTTP-based pub-sub notification service. This is a Ntfy topic.
343+
<b>ntfy</b> is a simple HTTP-based pub-sub notification service. This is a ntfy topic.
331344
To send notifications to it, simply PUT or POST to the topic URL. Here's an example using <tt>curl</tt>:
332345
</p>
333346
<code>

‎server/static/css/app.css

+24-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ html, body {
44
font-family: 'Lato', sans-serif;
55
color: #333;
66
font-size: 1.1em;
7+
margin: 0;
8+
padding: 0;
79
}
810

911
html {
@@ -25,6 +27,8 @@ h1 {
2527
margin-top: 25px;
2628
margin-bottom: 18px;
2729
font-size: 2.5em;
30+
word-wrap: break-word; /* For very long topics */
31+
padding-right: 40px; /* For the X on the detail page */
2832
}
2933

3034
h2 {
@@ -84,6 +88,7 @@ code {
8488
#main {
8589
max-width: 900px;
8690
margin: 0 auto 50px auto;
91+
padding: 0 10px;
8792
}
8893

8994
#error {
@@ -190,6 +195,23 @@ code {
190195
background-color: #fff;
191196
}
192197

198+
/* Header */
199+
200+
#header {
201+
background: #3a9784;
202+
height: 130px;
203+
}
204+
205+
#header #headerBox {
206+
max-width: 900px;
207+
margin: 0 auto;
208+
padding: 0 10px;
209+
}
210+
211+
#header img {
212+
margin-top: 23px;
213+
}
214+
193215
/* Subscribe box */
194216

195217
button {
@@ -352,13 +374,6 @@ li {
352374
/** Detail view */
353375
#detail {
354376
display: none;
355-
position: absolute;
356-
z-index: 1;
357-
left: 8px;
358-
right: 8px;
359-
top: 0;
360-
bottom: 0;
361-
background: white;
362377
}
363378

364379
#detail .detailDate {
@@ -375,7 +390,7 @@ li {
375390
max-width: 900px;
376391
margin: 0 auto;
377392
position: relative; /* required for close button's "position: absolute" */
378-
padding-bottom: 50px; /* Chrome and Firefox behave differently regarding bottom margin */
393+
padding: 0 10px 50px 10px; /* Chrome and Firefox behave differently regarding bottom margin */
379394
}
380395

381396
#detail #detailCloseButton {
@@ -384,7 +399,7 @@ li {
384399
border: none;
385400
padding: 5px;
386401
position: absolute;
387-
right: 0;
402+
right: 10px;
388403
top: 10px;
389404
display: block;
390405
}

‎server/static/img/ntfy.png

-1.61 KB
Loading

‎server/static/js/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const hideDetailView = () => {
181181
currentTopic = "";
182182
history.replaceState('', originalTitle, '/');
183183
detailView.style.display = 'none';
184-
main.style.display = '';
184+
main.style.display = 'block';
185185
return false;
186186
};
187187

0 commit comments

Comments
 (0)