Revert home page to existing page

pull/600/head
binwiederhier 2023-01-21 08:55:31 -05:00
parent 31a3bb7cd6
commit 5b14c76e54
10 changed files with 66 additions and 255 deletions

View File

@ -40,10 +40,14 @@ import (
- v.user --> see publishSyncEventAsync() test - v.user --> see publishSyncEventAsync() test
payments: payments:
- delete messages + reserved topics on ResetTier delete attachments in access.go
- reconciliation - reconciliation
delete messages + reserved topics on ResetTier delete attachments in access.go
account deletion should delete messages and reservations and attachments
Limits & rate limiting: Limits & rate limiting:
rate limiting weirdness. wth is going on?
bandwidth limit must be in tier
users without tier: should the stats be persisted? are they meaningful? -> test that the visitor is based on the IP address! users without tier: should the stats be persisted? are they meaningful? -> test that the visitor is based on the IP address!
login/account endpoints login/account endpoints
when ResetStats() is run, reset messagesLimiter (and others)? when ResetStats() is run, reset messagesLimiter (and others)?
@ -52,7 +56,8 @@ import (
Make sure account endpoints make sense for admins Make sure account endpoints make sense for admins
UI: UI:
- revert home page change - reservation icons
- reservation table delete button: dialog "keep or delete messages?"
- flicker of upgrade banner - flicker of upgrade banner
- JS constants - JS constants
Sync: Sync:
@ -61,6 +66,7 @@ import (
Tests: Tests:
- Payment endpoints (make mocks) - Payment endpoints (make mocks)
- Message rate limiting and reset tests - Message rate limiting and reset tests
- Bandwidth limit test
- test that the visitor is based on the IP address when a user has no tier - test that the visitor is based on the IP address when a user has no tier
*/ */

View File

@ -4,8 +4,6 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>ntfy web</title> <title>ntfy web</title>
<link rel="stylesheet" href="static/css/home.css" type="text/css">
<!-- Mobile view --> <!-- Mobile view -->
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@ -31,7 +29,8 @@
<!-- Never index --> <!-- Never index -->
<meta name="robots" content="noindex, nofollow" /> <meta name="robots" content="noindex, nofollow" />
<!-- Fonts --> <!-- Style overrides & fonts -->
<link rel="stylesheet" href="%PUBLIC_URL%/static/css/app.css" type="text/css">
<link rel="stylesheet" href="%PUBLIC_URL%/static/css/fonts.css" type="text/css"> <link rel="stylesheet" href="%PUBLIC_URL%/static/css/fonts.css" type="text/css">
</head> </head>
<body> <body>

View File

@ -0,0 +1,10 @@
/* web app styling overrides */
a, a:visited {
color: #338574;
}
a:hover {
text-decoration: none;
color: #317f6f;
}

View File

@ -1,6 +1,6 @@
/* general styling */ /* general styling */
#site { html, body {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
font-weight: 400; font-weight: 400;
font-size: 1.1em; font-size: 1.1em;
@ -9,16 +9,22 @@
padding: 0; padding: 0;
} }
#site a, a:visited { html {
/* prevent scrollbar from repositioning website:
* https://www.w3docs.com/snippets/css/how-to-prevent-scrollbar-from-repositioning-web-page.html */
overflow-y: scroll;
}
a, a:visited {
color: #338574; color: #338574;
} }
#site a:hover { a:hover {
text-decoration: none; text-decoration: none;
color: #317f6f; color: #317f6f;
} }
#site h1 { h1 {
margin-top: 35px; margin-top: 35px;
margin-bottom: 30px; margin-bottom: 30px;
font-size: 2.5em; font-size: 2.5em;
@ -28,7 +34,7 @@
color: #666; color: #666;
} }
#site h2 { h2 {
margin-top: 30px; margin-top: 30px;
margin-bottom: 5px; margin-bottom: 5px;
font-size: 1.8em; font-size: 1.8em;
@ -36,7 +42,7 @@
color: #333; color: #333;
} }
#site h3 { h3 {
margin-top: 25px; margin-top: 25px;
margin-bottom: 5px; margin-bottom: 5px;
font-size: 1.3em; font-size: 1.3em;
@ -44,28 +50,28 @@
color: #333; color: #333;
} }
#site p { p {
margin-top: 10px; margin-top: 10px;
margin-bottom: 20px; margin-bottom: 20px;
line-height: 160%; line-height: 160%;
font-weight: 400; font-weight: 400;
} }
#site p.smallMarginBottom { p.smallMarginBottom {
margin-bottom: 10px; margin-bottom: 10px;
} }
#site b { b {
font-weight: 500; font-weight: 500;
} }
#site tt { tt {
background: #eee; background: #eee;
padding: 2px 7px; padding: 2px 7px;
border-radius: 3px; border-radius: 3px;
} }
#site code { code {
display: block; display: block;
background: #eee; background: #eee;
font-family: monospace; font-family: monospace;
@ -79,18 +85,18 @@
/* Main page */ /* Main page */
#site #main { #main {
max-width: 900px; max-width: 900px;
margin: 0 auto 50px auto; margin: 0 auto 50px auto;
padding: 0 10px; padding: 0 10px;
} }
#site #error { #error {
color: darkred; color: darkred;
font-style: italic; font-style: italic;
} }
#site #ironicCenterTagDontFreakOut { #ironicCenterTagDontFreakOut {
color: #666; color: #666;
} }
@ -114,22 +120,22 @@
/* Figures */ /* Figures */
#site figure { figure {
text-align: center; text-align: center;
} }
#site figure img, figure video { figure img, figure video {
filter: drop-shadow(3px 3px 3px #ccc); filter: drop-shadow(3px 3px 3px #ccc);
border-radius: 7px; border-radius: 7px;
max-width: 100%; max-width: 100%;
} }
#site figure video { figure video {
width: 100%; width: 100%;
max-height: 450px; max-height: 450px;
} }
#site figcaption { figcaption {
text-align: center; text-align: center;
font-style: italic; font-style: italic;
padding-top: 10px; padding-top: 10px;
@ -137,18 +143,18 @@
/* Screenshots */ /* Screenshots */
#site #screenshots { #screenshots {
text-align: center; text-align: center;
} }
#site #screenshots img { #screenshots img {
height: 190px; height: 190px;
margin: 3px; margin: 3px;
border-radius: 5px; border-radius: 5px;
filter: drop-shadow(2px 2px 2px #ddd); filter: drop-shadow(2px 2px 2px #ddd);
} }
#site #screenshots .nowrap { #screenshots .nowrap {
white-space: nowrap; white-space: nowrap;
} }
@ -214,60 +220,52 @@
/* Header */ /* Header */
#site #header { #header {
background: #338574; background: #338574;
background: linear-gradient(150deg, rgba(51,133,116,1) 0%, rgba(86,189,168,1) 100%); filter: drop-shadow(0 5px 10px #ccc); height: 130px;
height: 70px;
} }
#site #header #headerBox { #header #headerBox {
max-width: 900px; max-width: 900px;
margin: 0 auto; margin: 0 auto;
padding: 0 10px; padding: 0 10px;
} }
#site #header #logo { #header #logo {
margin-top: 14px; margin-top: 23px;
width: 48px;
float: left; float: left;
} }
#site #header #name { #header #name {
float: left; float: left;
color: white; color: white;
font-size: 1.7em; font-size: 2.6em;
font-weight: 400; font-weight: 300;
margin: 12px 0 0 10px; margin: 35px 0 0 20px;
} }
#site #header #menu { #header ol {
list-style-type: none; list-style-type: none;
float: right; float: right;
margin-top: 16px; margin-top: 80px;
} }
#site #header #menu li { #header ol li {
display: inline-block; display: inline-block;
padding: 3px 10px; margin: 0 10px;
font-weight: 400; font-weight: 400;
border-radius: 5px;
} }
#site #header #menu li { #header ol li a, nav ol li a:visited {
font-size: 1em;
}
#site #header #menu li a,
#site #header #menu li a:visited {
color: white; color: white;
text-decoration: none; text-decoration: none;
} }
#site #header #menu li:hover { #header ol li a:hover {
background: #3f9a86; text-decoration: underline;
} }
#site li { li {
padding: 4px 0; padding: 4px 0;
margin: 4px 0; margin: 4px 0;
font-size: 0.9em; font-size: 0.9em;
@ -276,7 +274,7 @@
/* Hide top menu SMALL SCREEN */ /* Hide top menu SMALL SCREEN */
@media only screen and (max-width: 780px) { @media only screen and (max-width: 780px) {
#header #menu { #header ol {
display: none; display: none;
} }
} }

View File

@ -22,12 +22,9 @@ import PublishDialog from "./PublishDialog";
import Messaging from "./Messaging"; import Messaging from "./Messaging";
import "./i18n"; // Translations! import "./i18n"; // Translations!
import {Backdrop, CircularProgress} from "@mui/material"; import {Backdrop, CircularProgress} from "@mui/material";
import Home from "./Home";
import Login from "./Login"; import Login from "./Login";
import Pricing from "./Pricing";
import Signup from "./Signup"; import Signup from "./Signup";
import Account from "./Account"; import Account from "./Account";
import accountApi from "../app/AccountApi";
export const AccountContext = createContext(null); export const AccountContext = createContext(null);
@ -41,8 +38,6 @@ const App = () => {
<CssBaseline/> <CssBaseline/>
<ErrorBoundary> <ErrorBoundary>
<Routes> <Routes>
<Route path={routes.home} element={<Home/>}/>
<Route path={routes.pricing} element={<Pricing/>}/>
<Route path={routes.login} element={<Login/>}/> <Route path={routes.login} element={<Login/>}/>
<Route path={routes.signup} element={<Signup/>}/> <Route path={routes.signup} element={<Signup/>}/>
<Route element={<Layout/>}> <Route element={<Layout/>}>

View File

@ -1,152 +0,0 @@
import * as React from 'react';
import SiteLayout from "./SiteLayout";
const Home = () => {
return (
<SiteLayout>
<h1>Send push notifications to your phone or desktop via PUT/POST</h1>
<p>
<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.
It allows you to send notifications to your phone or desktop via scripts from any computer,
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.
</p>
<div id="screenshots">
<a href="static/img/screenshot-curl.png"><img src="static/img/screenshot-curl.png"/></a>
<a href="static/img/screenshot-web-detail.png"><img src="static/img/screenshot-web-detail.png"/></a>
<span className="nowrap">
<a href="static/img/screenshot-phone-main.jpg"><img src="static/img/screenshot-phone-main.jpg"/></a>
<a href="static/img/screenshot-phone-detail.jpg"><img src="static/img/screenshot-phone-detail.jpg"/></a>
<a href="static/img/screenshot-phone-notification.jpg"><img src="static/img/screenshot-phone-notification.jpg"/></a>
</span>
</div>
<h2 id="publish" className="anchor">Publishing messages</h2>
<p>
<a href="docs/publish/">Publishing messages</a> can be done via PUT or POST. Topics are created on
the fly by subscribing or publishing to them.
Because there is no sign-up, <b>the topic is essentially a password</b>, so pick something that's
not easily guessable.
</p>
<p className="smallMarginBottom">
Here's an example showing how to publish a message using a POST request (via <tt>curl -d</tt>):
</p>
<code>
curl -d "Backup successful 😀" <span className="ntfyUrl">ntfy.sh</span>/mytopic
</code>
<p className="smallMarginBottom">
There are <a href="docs/publish/">more features</a> related to publishing messages: You can set a
<a href="docs/publish/#message-priority">notification priority</a>, a <a
href="docs/publish/#message-title">title</a>,
and <a href="docs/publish/#tags-emojis">tag messages</a>.
Here's an example using some of them together:
</p>
<code>
curl \<br/>
&nbsp;&nbsp;-H "Title: Unauthorized access detected" \<br/>
&nbsp;&nbsp;-H "Priority: urgent" \<br/>
&nbsp;&nbsp;-H "Tags: warning,skull" \<br/>
&nbsp;&nbsp;-d "Remote access to $(hostname) detected. Act right away." \<br/>
&nbsp;&nbsp;<span className="ntfyUrl">ntfy.sh</span>/mytopic
</code>
<p>
Here's what that looks like in the <a href="docs/subscribe/phone/">Android app</a>:
</p>
<figure>
<img src="static/img/screenshot-phone-popover.png" style={{maxHeight: "200px"}}/>
<figcaption>Urgent notification with pop-over</figcaption>
</figure>
<h2 id="subscribe" className="anchor">Subscribe to a topic</h2>
<p>
You can create and subscribe to a topic either <a href="docs/subscribe/phone/">using your phone</a>,
in <a href="docs/subscribe/web/">this web UI</a>, or in your own app by <a
href="docs/subscribe/api/">subscribing via the API</a>.
</p>
<h3 id="subscribe-phone" className="anchor">Subscribe from your phone</h3>
<p>
Simply get the app and start <a href="docs/publish/">publishing messages</a>. To learn more about
the app,
<a href="docs/subscribe/phone/">check out the documentation</a>.
</p>
<p>
<a href="https://play.google.com/store/apps/details?id=io.heckel.ntfy"><img src="static/img/badge-googleplay.png"/></a>
<a href="https://f-droid.org/en/packages/io.heckel.ntfy/"><img src="static/img/badge-fdroid.png"/></a>
<a href="https://apps.apple.com/us/app/ntfy/id1625396347"><img src="static/img/badge-appstore.png"/></a>
</p>
<p>
Here's a video showing the app in action:
</p>
<figure>
<video controls muted autoPlay loop src="static/img/android-video-overview.mp4" style={{maxWidth: "650px"}}></video>
<figcaption>Sending push notifications to your Android phone</figcaption>
</figure>
<h3 id="subscribe-web" className="anchor">Subscribe via web app</h3>
<p>
Subscribe to topics in the <a href="app">web app</a> and receive messages as <b>desktop
notification</b>.
It is available at <b><a href="app"><span className="ntfyUrl">ntfy.sh</span>/app</a></b>.
</p>
<figure>
<a href="app"><img src="static/img/screenshot-web-detail.png" width="100%"/></a>
<figcaption>ntfy web app, available at <a href="app"><span
className="ntfyUrl">ntfy.sh</span>/app</a></figcaption>
</figure>
<h3 id="subscribe-api" className="anchor">Subscribe using the API</h3>
<p>
There's a super simple API that you can use to integrate your own app. You can consume
a <a href="docs/subscribe/api/#subscribe-as-json-stream">JSON stream</a>,
an <a href="docs/subscribe/api/#subscribe-as-sse-stream">SSE/EventSource stream</a>,
a <a href="docs/subscribe/api/#subscribe-as-raw-stream">plain text stream</a>,
or <a href="docs/subscribe/api/#websockets">via WebSockets</a>.
</p>
<p className="smallMarginBottom">
Here's an example for JSON. The <b>connection stays open</b>, so you can retrieve messages as they
come in:
</p>
<code>
$ curl -s <span className="ntfyUrl">ntfy.sh</span>/mytopic/json<br/>
{`{"id":"SLiKI64DOt","time":1635528757,"event":"open","topic":"mytopic"}`}<br/>
{`{"id":"hwQ2YpKdmg","time":1635528741,"event":"message","topic":"mytopic","message":"Hi!"}`}<br/>
{`{"id":"DGUDShMCsc","time":1635528787,"event":"keepalive","topic":"mytopic"}`}<br/>
...
</code>
<p>
Here's a short video demonstrating it in action:
</p>
<figure>
<video controls muted autoPlay loop src="static/img/android-video-subscribe-api.mp4" style={{maxWidth: "650px"}}></video>
<figcaption>Subscribing to the JSON stream with <tt>curl</tt></figcaption>
</figure>
<h3 id="docs" className="anchor">Check out the docs!</h3>
<p>
ntfy has so many more features and you can learn about all of them <a href="docs/">in the
documentation</a>
(I tried my very best to make it the best docs ever 😉, not sure if I succeeded, hehe).
</p>
<figure>
<a href="docs/"><img width="100%" src="static/img/screenshot-docs.png"/></a>
<figcaption>Check out the documentation</figcaption>
</figure>
<h3 id="free-software" className="anchor">100% open source &amp; forever free</h3>
<p>
I love free software, and I'm doing this because it's fun. I have no bad intentions, and I will
never monetize or sell your information. This service will always stay
<a href="https://github.com/binwiederhier/ntfy">free and open</a>.
You can read more in the <a href="docs/faq/">FAQs</a> and in the <a href="docs/privacy/">privacy
policy</a>.
</p>
<center id="ironicCenterTagDontFreakOut"><i>Made with by <a href="https://heckel.io">Philipp C. Heckel</a></i></center>
</SiteLayout>
);
};
export default Home;

View File

@ -1,12 +0,0 @@
import * as React from 'react';
import SiteLayout from "./SiteLayout";
const Pricing = () => {
return (
<SiteLayout>
pricing
</SiteLayout>
);
};
export default Pricing;

View File

@ -1,31 +0,0 @@
import * as React from 'react';
import {NavLink} from "react-router-dom";
import routes from "./routes";
import CloudOutlinedIcon from '@mui/icons-material/CloudOutlined';
import GitHubIcon from '@mui/icons-material/GitHub';
import {Link} from "@mui/material";
const SiteLayout = (props) => {
return (
<div id="site">
<nav id="header">
<div id="headerBox">
<img id="logo" src="static/img/ntfy.png" alt="logo"/>
<div id="name">ntfy</div>
<ol id="menu">
<li><NavLink to={routes.home}>Features</NavLink></li>
<li><NavLink to={routes.pricing}>Pricing</NavLink></li>
<li><NavLink to="/docs" reloadDocument={true}>Docs</NavLink></li>
<li><Link href="https://github.com/binwiederhier/ntfy" reloadDocument={true}><GitHubIcon fontSize="small" sx={{verticalAlign: "text-top"}}/> Forever open</Link></li>
<li><NavLink to={routes.app}><CloudOutlinedIcon fontSize="small" sx={{verticalAlign: "text-top"}}/> Open app</NavLink></li>
</ol>
</div>
</nav>
<div id="main">
{props.children}
</div>
</div>
);
};
export default SiteLayout;

View File

@ -74,7 +74,7 @@ const UpgradeDialog = (props) => {
// Exceptional conditions // Exceptional conditions
if (loading) { if (loading) {
submitAction = null; submitAction = null;
} else if (newTier?.code && account?.reservations.length > newTier?.limits.reservations) { } else if (newTier?.code && account?.reservations?.length > newTier?.limits?.reservations) {
submitAction = null; submitAction = null;
banner = Banner.RESERVATIONS_WARNING; banner = Banner.RESERVATIONS_WARNING;
} }

View File

@ -4,8 +4,6 @@ import {shortUrl} from "../app/utils";
// Remember to also update the "disallowedTopics" list! // Remember to also update the "disallowedTopics" list!
const routes = { const routes = {
home: "/",
pricing: "/pricing",
login: "/login", login: "/login",
signup: "/signup", signup: "/signup",
resetPassword: "/reset-password", // Not used (yet) resetPassword: "/reset-password", // Not used (yet)