pull/149/head
Philipp Heckel 2022-03-11 15:17:12 -05:00
parent c124434429
commit 09336fa1e4
9 changed files with 32 additions and 33 deletions

View File

@ -2,6 +2,16 @@
Binaries for all releases can be found on the GitHub releases pages for the [ntfy server](https://github.com/binwiederhier/ntfy/releases) Binaries for all releases can be found on the GitHub releases pages for the [ntfy server](https://github.com/binwiederhier/ntfy/releases)
and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/releases). and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/releases).
## ntfy server v1.17.0
Released Mar 11, 2022
**Features & bug fixes:**
* Replace [web app](https://ntfy.sh/app) with a React/MUI-based web app from the 21st century (#111)
* Web UI broken with auth (#132, thanks for reporting @arminus)
* Send static web resources as `Content-Encoding: gzip`, i.e. docs and web app (no ticket)
* Add support for auth via `?auth=...` query param, used by WebSocket in web app (no ticket)
## ntfy server v1.16.0 ## ntfy server v1.16.0
Released Feb 27, 2022 Released Feb 27, 2022

View File

@ -34,7 +34,7 @@
</head> </head>
<body> <body>
<noscript> <noscript>
ntfy web requires JavaScript, but you can use the <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a> ntfy web requires JavaScript, but you can also use the <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a>
or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to subscribe. or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to subscribe.
</noscript> </noscript>
<div id="root"></div> <div id="root"></div>

View File

@ -265,29 +265,6 @@ figcaption {
text-decoration: underline; text-decoration: underline;
} }
/* Subscribe box */
button {
background: #3a9784;
border: none;
border-radius: 3px;
padding: 3px 5px;
color: white;
cursor: pointer;
}
button:hover {
background: #317f6f;
padding: 5px;
}
ul {
padding-left: 1em;
list-style-type: circle;
padding-bottom: 0;
margin: 0;
}
li { li {
padding: 4px 0; padding: 4px 0;
margin: 4px 0; margin: 4px 0;

View File

@ -1,12 +1,4 @@
/**
* Hello, dear curious visitor. I am not a web-guy, so please don't judge my horrible JS code.
* In fact, please do tell me about all the things I did wrong and that I could improve. I've been trying
* to read up on modern JS, but it's just a little much.
*
* Feel free to open tickets at https://github.com/binwiederhier/ntfy/issues. Thank you!
*/
/* All the things */ /* All the things */
let currentUrl = window.location.hostname; let currentUrl = window.location.hostname;

View File

@ -2,6 +2,12 @@ import {basicAuth, encodeBase64Url, topicShortUrl, topicUrlWs} from "./utils";
const retryBackoffSeconds = [5, 10, 15, 20, 30]; const retryBackoffSeconds = [5, 10, 15, 20, 30];
/**
* A connection contains a single WebSocket connection for one topic. It handles its connection
* status itself, including reconnect attempts and backoff.
*
* Incoming messages and state changes are forwarded via listeners.
*/
class Connection { class Connection {
constructor(connectionId, subscriptionId, baseUrl, topic, user, since, onNotification, onStateChanged) { constructor(connectionId, subscriptionId, baseUrl, topic, user, since, onNotification, onStateChanged) {
this.connectionId = connectionId; this.connectionId = connectionId;

View File

@ -1,6 +1,12 @@
import Connection from "./Connection"; import Connection from "./Connection";
import {sha256} from "./utils"; import {sha256} from "./utils";
/**
* The connection manager keeps track of active connections (WebSocket connections, see Connection).
*
* Its refresh() method reconciles state changes with the target state by closing/opening connections
* as required. This is done pretty much exactly the same way as in the Android app.
*/
class ConnectionManager { class ConnectionManager {
constructor() { constructor() {
this.connections = new Map(); // ConnectionId -> Connection (hash, see below) this.connections = new Map(); // ConnectionId -> Connection (hash, see below)

View File

@ -3,6 +3,10 @@ import prefs from "./Prefs";
import subscriptionManager from "./SubscriptionManager"; import subscriptionManager from "./SubscriptionManager";
import logo from "../img/ntfy.png"; import logo from "../img/ntfy.png";
/**
* The notifier is responsible for displaying desktop notifications. Note that not all modern browsers
* support this; most importantly, all iOS browsers do not support window.Notification.
*/
class Notifier { class Notifier {
async notify(subscriptionId, notification, onClickFallback) { async notify(subscriptionId, notification, onClickFallback) {
if (!this.supported()) { if (!this.supported()) {

View File

@ -85,7 +85,7 @@ const SubscribePage = (props) => {
const isExistingTopicUrl = existingTopicUrls.includes(topicUrl(baseUrl, topic)); const isExistingTopicUrl = existingTopicUrls.includes(topicUrl(baseUrl, topic));
return validTopic(topic) && validUrl(baseUrl) && !isExistingTopicUrl; return validTopic(topic) && validUrl(baseUrl) && !isExistingTopicUrl;
} else { } else {
const isExistingTopicUrl = existingTopicUrls.includes(topicUrl(window.location.origin, topic)); // FIXME const isExistingTopicUrl = existingTopicUrls.includes(topicUrl(window.location.origin, topic));
return validTopic(topic) && !isExistingTopicUrl; return validTopic(topic) && !isExistingTopicUrl;
} }
})(); })();

View File

@ -66,6 +66,10 @@ export const useAutoSubscribe = (subscriptions, selected) => {
}, [params, subscriptions, selected, hasRun]); }, [params, subscriptions, selected, hasRun]);
}; };
/**
* Migrate the 'topics' item in localStorage to the subscriptionManager. This is only done once to migrate away
* from the old web UI.
*/
export const useLocalStorageMigration = () => { export const useLocalStorageMigration = () => {
const [hasRun, setHasRun] = useState(false); const [hasRun, setHasRun] = useState(false);
useEffect(() => { useEffect(() => {