diff --git a/cmd/serve.go b/cmd/serve.go index 95e63797..912e295a 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -59,7 +59,7 @@ var flagsServe = append( altsrc.NewDurationFlag(&cli.DurationFlag{Name: "keepalive-interval", Aliases: []string{"keepalive_interval", "k"}, EnvVars: []string{"NTFY_KEEPALIVE_INTERVAL"}, Value: server.DefaultKeepaliveInterval, Usage: "interval of keepalive messages"}), altsrc.NewDurationFlag(&cli.DurationFlag{Name: "manager-interval", Aliases: []string{"manager_interval", "m"}, EnvVars: []string{"NTFY_MANAGER_INTERVAL"}, Value: server.DefaultManagerInterval, Usage: "interval of for message pruning and stats printing"}), altsrc.NewStringSliceFlag(&cli.StringSliceFlag{Name: "disallowed-topics", Aliases: []string{"disallowed_topics"}, EnvVars: []string{"NTFY_DISALLOWED_TOPICS"}, Usage: "topics that are not allowed to be used"}), - altsrc.NewStringFlag(&cli.StringFlag{Name: "web-root", Aliases: []string{"web_root"}, EnvVars: []string{"NTFY_WEB_ROOT"}, Value: "app", Usage: "sets web root to landing page (home), web app (app) or disabled (disable)"}), + altsrc.NewStringFlag(&cli.StringFlag{Name: "web-root", Aliases: []string{"web_root"}, EnvVars: []string{"NTFY_WEB_ROOT"}, Value: "/", Usage: "sets root of the web app (e.g. /, or /app), or disables it (disable)"}), altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-signup", Aliases: []string{"enable_signup"}, EnvVars: []string{"NTFY_ENABLE_SIGNUP"}, Value: false, Usage: "allows users to sign up via the web app, or API"}), altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-login", Aliases: []string{"enable_login"}, EnvVars: []string{"NTFY_ENABLE_LOGIN"}, Value: false, Usage: "allows users to log in via the web app, or API"}), altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-reservations", Aliases: []string{"enable_reservations"}, EnvVars: []string{"NTFY_ENABLE_RESERVATIONS"}, Value: false, Usage: "allows users to reserve topics (if their tier allows it)"}), @@ -195,8 +195,6 @@ func execServe(c *cli.Context) error { return errors.New("if set, base-url must start with http:// or https://") } else if baseURL != "" && strings.HasSuffix(baseURL, "/") { return errors.New("if set, base-url must not end with a slash (/)") - } else if !util.Contains([]string{"app", "home", "disable"}, webRoot) { - return errors.New("if set, web-root must be 'home' or 'app'") } else if upstreamBaseURL != "" && !strings.HasPrefix(upstreamBaseURL, "http://") && !strings.HasPrefix(upstreamBaseURL, "https://") { return errors.New("if set, upstream-base-url must start with http:// or https://") } else if upstreamBaseURL != "" && strings.HasSuffix(upstreamBaseURL, "/") { @@ -213,8 +211,16 @@ func execServe(c *cli.Context) error { return errors.New("if stripe-secret-key is set, stripe-webhook-key and base-url must also be set") } - webRootIsApp := webRoot == "app" - enableWeb := webRoot != "disable" + // Backwards compatibility + if webRoot == "app" { + webRoot = "/" + } else if webRoot == "home" { + webRoot = "/app" + } else if webRoot == "disable" { + webRoot = "" + } else if !strings.HasPrefix(webRoot, "/") { + webRoot = "/" + webRoot + } // Default auth permissions authDefault, err := user.ParsePermission(authDefaultAccess) @@ -293,7 +299,7 @@ func execServe(c *cli.Context) error { conf.KeepaliveInterval = keepaliveInterval conf.ManagerInterval = managerInterval conf.DisallowedTopics = disallowedTopics - conf.WebRootIsApp = webRootIsApp + conf.WebRoot = webRoot conf.UpstreamBaseURL = upstreamBaseURL conf.SMTPSenderAddr = smtpSenderAddr conf.SMTPSenderUser = smtpSenderUser @@ -317,7 +323,6 @@ func execServe(c *cli.Context) error { conf.StripeSecretKey = stripeSecretKey conf.StripeWebhookKey = stripeWebhookKey conf.BillingContact = billingContact - conf.EnableWeb = enableWeb conf.EnableSignup = enableSignup conf.EnableLogin = enableLogin conf.EnableReservations = enableReservations diff --git a/docs/config.md b/docs/config.md index 10e00ebd..fa599388 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1255,7 +1255,7 @@ variable before running the `ntfy` command (e.g. `export NTFY_LISTEN_HTTP=:80`). | `visitor-request-limit-exempt-hosts` | `NTFY_VISITOR_REQUEST_LIMIT_EXEMPT_HOSTS` | *comma-separated host/IP list* | - | Rate limiting: List of hostnames and IPs to be exempt from request rate limiting | | `visitor-subscription-limit` | `NTFY_VISITOR_SUBSCRIPTION_LIMIT` | *number* | 30 | Rate limiting: Number of subscriptions per visitor (IP address) | | `visitor-subscriber-rate-limiting` | `NTFY_VISITOR_SUBSCRIBER_RATE_LIMITING` | *bool* | `false` | Rate limiting: Enables subscriber-based rate limiting | -| `web-root` | `NTFY_WEB_ROOT` | `app`, `home` or `disable` | `app` | Sets web root to landing page (home), web app (app) or disables the web app entirely (disable) | +| `web-root` | `NTFY_WEB_ROOT` | *path*, e.g. `/` or `/app`, or `disable` | `/` | Sets root of the web app (e.g. /, or /app), or disables it entirely (disable) | | `enable-signup` | `NTFY_ENABLE_SIGNUP` | *boolean* (`true` or `false`) | `false` | Allows users to sign up via the web app, or API | | `enable-login` | `NTFY_ENABLE_LOGIN` | *boolean* (`true` or `false`) | `false` | Allows users to log in via the web app, or API | | `enable-reservations` | `NTFY_ENABLE_RESERVATIONS` | *boolean* (`true` or `false`) | `false` | Allows users to reserve topics (if their tier allows it) | diff --git a/docs/releases.md b/docs/releases.md index df12f1af..698110f5 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1178,6 +1178,12 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release ## Not released yet +## ntfy server v2.5.0 (UNRELEASED) + +**Bug fixes + maintenance:** + +* Removed old ntfy website from ntfy entirely (no ticket) + ### ntfy Android app v1.16.1 (UNRELEASED) **Features:** diff --git a/server/config.go b/server/config.go index 7b533a55..59da448a 100644 --- a/server/config.go +++ b/server/config.go @@ -92,7 +92,7 @@ type Config struct { KeepaliveInterval time.Duration ManagerInterval time.Duration DisallowedTopics []string - WebRootIsApp bool + WebRoot string // empty to disable DelayedSenderInterval time.Duration FirebaseKeepaliveInterval time.Duration FirebasePollInterval time.Duration @@ -133,7 +133,6 @@ type Config struct { StripeWebhookKey string StripePriceCacheDuration time.Duration BillingContact string - EnableWeb bool EnableSignup bool // Enable creation of accounts via API and UI EnableLogin bool EnableReservations bool // Allow users with role "user" to own/reserve topics @@ -171,7 +170,7 @@ func NewConfig() *Config { KeepaliveInterval: DefaultKeepaliveInterval, ManagerInterval: DefaultManagerInterval, DisallowedTopics: DefaultDisallowedTopics, - WebRootIsApp: false, + WebRoot: "/", DelayedSenderInterval: DefaultDelayedSenderInterval, FirebaseKeepaliveInterval: DefaultFirebaseKeepaliveInterval, FirebasePollInterval: DefaultFirebasePollInterval, @@ -209,7 +208,6 @@ func NewConfig() *Config { StripeWebhookKey: "", StripePriceCacheDuration: DefaultStripePriceCacheDuration, BillingContact: "", - EnableWeb: true, EnableSignup: false, EnableLogin: false, EnableReservations: false, diff --git a/server/server.go b/server/server.go index d07a6159..c0ebc6eb 100644 --- a/server/server.go +++ b/server/server.go @@ -100,11 +100,10 @@ var ( urlRegex = regexp.MustCompile(`^https?://`) //go:embed site - webFs embed.FS - webFsCached = &util.CachingEmbedFS{ModTime: time.Now(), FS: webFs} - webSiteDir = "/site" - webHomeIndex = "/home.html" // Landing page, only if "web-root: home" - webAppIndex = "/app.html" // React app + webFs embed.FS + webFsCached = &util.CachingEmbedFS{ModTime: time.Now(), FS: webFs} + webSiteDir = "/site" + webAppIndex = "/app.html" // React app //go:embed docs docsStaticFs embed.FS @@ -404,8 +403,8 @@ func (s *Server) handleError(w http.ResponseWriter, r *http.Request, v *visitor, } func (s *Server) handleInternal(w http.ResponseWriter, r *http.Request, v *visitor) error { - if r.Method == http.MethodGet && r.URL.Path == "/" { - return s.ensureWebEnabled(s.handleHome)(w, r, v) + if r.Method == http.MethodGet && r.URL.Path == "/" && s.config.WebRoot == "/" { + return s.ensureWebEnabled(s.handleRoot)(w, r, v) } else if r.Method == http.MethodHead && r.URL.Path == "/" { return s.ensureWebEnabled(s.handleEmpty)(w, r, v) } else if r.Method == http.MethodGet && r.URL.Path == apiHealthPath { @@ -490,12 +489,8 @@ func (s *Server) handleInternal(w http.ResponseWriter, r *http.Request, v *visit return errHTTPNotFound } -func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, v *visitor) error { - if s.config.WebRootIsApp { - r.URL.Path = webAppIndex - } else { - r.URL.Path = webHomeIndex - } +func (s *Server) handleRoot(w http.ResponseWriter, r *http.Request, v *visitor) error { + r.URL.Path = webAppIndex return s.handleStatic(w, r, v) } @@ -527,13 +522,9 @@ func (s *Server) handleHealth(w http.ResponseWriter, _ *http.Request, _ *visitor } func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visitor) error { - appRoot := "/" - if !s.config.WebRootIsApp { - appRoot = "/app" - } response := &apiConfigResponse{ BaseURL: "", // Will translate to window.location.origin - AppRoot: appRoot, + AppRoot: s.config.WebRoot, EnableLogin: s.config.EnableLogin, EnableSignup: s.config.EnableSignup, EnablePayments: s.config.StripeSecretKey != "", diff --git a/server/server.yml b/server/server.yml index 24371b65..204005ca 100644 --- a/server/server.yml +++ b/server/server.yml @@ -167,11 +167,13 @@ # # disallowed-topics: -# Defines if the root route (/) is pointing to the landing page (as on ntfy.sh) or the -# web app. If you self-host, you don't want to change this. -# Can be "app" (default), "home" or "disable" to disable the web app entirely. +# Defines the root path of the web app, or disables the web app entirely. # -# web-root: app +# Can be any simple path, e.g. "/", "/app", or "/ntfy". For backwards-compatibility reasons, +# the values "app" (maps to "/"), "home" (maps to "/app"), or "disable" (maps to "") to disable +# the web app entirely. +# +# web-root: / # Various feature flags used to control the web app, and API access, mainly around user and # account management. diff --git a/server/server_middleware.go b/server/server_middleware.go index 5c83cf70..facd5698 100644 --- a/server/server_middleware.go +++ b/server/server_middleware.go @@ -51,7 +51,7 @@ func (s *Server) limitRequestsWithTopic(next handleFunc) handleFunc { func (s *Server) ensureWebEnabled(next handleFunc) handleFunc { return func(w http.ResponseWriter, r *http.Request, v *visitor) error { - if !s.config.EnableWeb { + if s.config.WebRoot == "" { return errHTTPNotFound } return next(w, r, v) diff --git a/server/server_test.go b/server/server_test.go index fa41ac52..adf77a73 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -220,10 +220,6 @@ func TestServer_StaticSites(t *testing.T) { require.Equal(t, 200, rr.Code) require.Contains(t, rr.Body.String(), ``) - rr = request(t, s, "GET", "/static/css/home.css", "", nil) - require.Equal(t, 200, rr.Code) - require.Contains(t, rr.Body.String(), `/* general styling */`) - rr = request(t, s, "GET", "/docs", "", nil) require.Equal(t, 301, rr.Code) @@ -232,7 +228,7 @@ func TestServer_StaticSites(t *testing.T) { func TestServer_WebEnabled(t *testing.T) { conf := newTestConfig(t) - conf.EnableWeb = false + conf.WebRoot = "" // Disable web app s := newTestServer(t, conf) rr := request(t, s, "GET", "/", "", nil) @@ -245,7 +241,7 @@ func TestServer_WebEnabled(t *testing.T) { require.Equal(t, 404, rr.Code) conf2 := newTestConfig(t) - conf2.EnableWeb = true + conf2.WebRoot = "/" s2 := newTestServer(t, conf2) rr = request(t, s2, "GET", "/", "", nil) @@ -253,9 +249,6 @@ func TestServer_WebEnabled(t *testing.T) { rr = request(t, s2, "GET", "/config.js", "", nil) require.Equal(t, 200, rr.Code) - - rr = request(t, s2, "GET", "/static/css/home.css", "", nil) - require.Equal(t, 200, rr.Code) } func TestServer_PublishLargeMessage(t *testing.T) { diff --git a/web/public/home.html b/web/public/home.html deleted file mode 100644 index 43007ca3..00000000 --- a/web/public/home.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - ntfy.sh | Send push notifications to your phone via PUT/POST - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Send push notifications to your phone or desktop via PUT/POST

-

- ntfy (pronounce: notify) is a simple HTTP-based pub-sub notification service. - It allows you to send notifications to your phone or desktop via scripts from any computer, - entirely without signup, cost or setup. It's also open source if you want to run your own. -

-
- - - - - - - -
- -

Publishing messages

-

- Publishing messages 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, the topic is essentially a password, so pick something that's not easily guessable. -

-

- Here's an example showing how to publish a message using a POST request (via curl -d): -

- - curl -d "Backup successful 😀" ntfy.sh/mytopic - -

- There are more features related to publishing messages: You can set a - notification priority, a title, - and tag messages. - Here's an example using some of them together: -

- - curl \
-   -H "Title: Unauthorized access detected" \
-   -H "Priority: urgent" \
-   -H "Tags: warning,skull" \
-   -d "Remote access to $(hostname) detected. Act right away." \
-   ntfy.sh/mytopic -
-

- Here's what that looks like in the Android app: -

-
- -
Urgent notification with pop-over
-
- -

Subscribe to a topic

-

- You can create and subscribe to a topic either using your phone, - in this web UI, or in your own app by subscribing via the API. -

- -

Subscribe from your phone

-

- Simply get the app and start publishing messages. To learn more about the app, - check out the documentation. -

-

- - - -

-

- Here's a video showing the app in action: -

-
- -
Sending push notifications to your Android phone
-
- -

Subscribe via web app

-

- Subscribe to topics in the web app and receive messages as desktop notification. - It is available at ntfy.sh/app. -

-
- -
ntfy web app, available at ntfy.sh/app
-
- -

Subscribe using the API

-

- There's a super simple API that you can use to integrate your own app. You can consume - a JSON stream, - an SSE/EventSource stream, - a plain text stream, - or via WebSockets. -

-

- Here's an example for JSON. The connection stays open, so you can retrieve messages as they come in: -

- - $ curl -s ntfy.sh/mytopic/json
- {"id":"SLiKI64DOt","time":1635528757,"event":"open","topic":"mytopic"}
- {"id":"hwQ2YpKdmg","time":1635528741,"event":"message","topic":"mytopic","message":"Hi!"}
- {"id":"DGUDShMCsc","time":1635528787,"event":"keepalive","topic":"mytopic"}
- ... -
-

- Here's a short video demonstrating it in action: -

-
- -
Subscribing to the JSON stream with curl
-
- -

Check out the docs!

-

- ntfy has so many more features and you can learn about all of them in the documentation - (I tried my very best to make it the best docs ever 😉, not sure if I succeeded, hehe). -

-
- -
Check out the documentation
-
- -

100% open source & forever free

-

- 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 - free and open. - You can read more in the FAQs and in the privacy policy. -

- -
Made with ❤️ by Philipp C. Heckel
-
- - - - diff --git a/web/public/index.html b/web/public/index.html index 02ee2700..dfec1666 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/web/public/static/css/home.css b/web/public/static/css/home.css deleted file mode 100644 index feeaa7ee..00000000 --- a/web/public/static/css/home.css +++ /dev/null @@ -1,280 +0,0 @@ -/* general styling */ - -html, body { - font-family: 'Roboto', sans-serif; - font-weight: 400; - font-size: 1.1em; - color: #444; - margin: 0; - padding: 0; -} - -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; -} - -a:hover { - text-decoration: none; - color: #317f6f; -} - -h1 { - margin-top: 35px; - margin-bottom: 30px; - font-size: 2.5em; - word-wrap: break-word; /* For very long topics */ - padding-right: 40px; /* For the X on the detail page */ - font-weight: 300; - color: #666; -} - -h2 { - margin-top: 30px; - margin-bottom: 5px; - font-size: 1.8em; - font-weight: 300; - color: #333; -} - -h3 { - margin-top: 25px; - margin-bottom: 5px; - font-size: 1.3em; - font-weight: 300; - color: #333; -} - -p { - margin-top: 10px; - margin-bottom: 20px; - line-height: 160%; - font-weight: 400; -} - -p.smallMarginBottom { - margin-bottom: 10px; -} - -b { - font-weight: 500; -} - -tt { - background: #eee; - padding: 2px 7px; - border-radius: 3px; -} - -code { - display: block; - background: #eee; - font-family: monospace; - padding: 20px; - border-radius: 3px; - margin-top: 10px; - margin-bottom: 20px; - overflow-x: auto; - white-space: nowrap; -} - -/* Main page */ - -#main { - max-width: 900px; - margin: 0 auto 50px auto; - padding: 0 10px; -} - -#error { - color: darkred; - font-style: italic; -} - -#ironicCenterTagDontFreakOut { - color: #666; -} - -/* Anchors */ - -.anchor .anchorLink { - color: #ccc; - text-decoration: none; - padding: 0 5px; - visibility: hidden; -} - -.anchor:hover .anchorLink { - visibility: visible; -} - -.anchor .anchorLink:hover { - color: #338574; - visibility: visible; -} - -/* Figures */ - -figure { - text-align: center; -} - -figure img, figure video { - filter: drop-shadow(3px 3px 3px #ccc); - border-radius: 7px; - max-width: 100%; -} - -figure video { - width: 100%; - max-height: 450px; -} - -figcaption { - text-align: center; - font-style: italic; - padding-top: 10px; -} - -/* Screenshots */ - -#screenshots { - text-align: center; -} - -#screenshots img { - height: 190px; - margin: 3px; - border-radius: 5px; - filter: drop-shadow(2px 2px 2px #ddd); -} - -#screenshots .nowrap { - white-space: nowrap; -} - -/* Lightbox; thanks to https://yossiabramov.com/blog/vanilla-js-lightbox */ - -.lightbox { - opacity: 0; - visibility: hidden; - position: fixed; - left:0; - right: 0; - top: 0; - bottom: 0; - z-index: -1; - display: flex; - align-items: center; - justify-content: center; - transition: all 0.15s ease-in; -} - -.lightbox.show { - background-color: rgba(0,0,0, 0.75); - opacity: 1; - visibility: visible; - z-index: 1000; -} - -.lightbox img { - max-width: 90%; - max-height: 90%; - filter: drop-shadow(5px 5px 10px #222); - border-radius: 5px; -} - -.lightbox .close-lightbox { - cursor: pointer; - position: absolute; - top: 30px; - right: 30px; - width: 20px; - height: 20px; -} - -.lightbox .close-lightbox::after, -.lightbox .close-lightbox::before { - content: ''; - width: 3px; - height: 20px; - background-color: #ddd; - position: absolute; - border-radius: 5px; - transform: rotate(45deg); -} - -.lightbox .close-lightbox::before { - transform: rotate(-45deg); -} - -.lightbox .close-lightbox:hover::after, -.lightbox .close-lightbox:hover::before { - background-color: #fff; -} - -/* Header */ - -#header { - background: #338574; - height: 130px; -} - -#header #headerBox { - max-width: 900px; - margin: 0 auto; - padding: 0 10px; -} - -#header #logo { - margin-top: 23px; - float: left; -} - -#header #name { - float: left; - color: white; - font-size: 2.6em; - font-weight: 300; - margin: 35px 0 0 20px; -} - -#header ol { - list-style-type: none; - float: right; - margin-top: 80px; -} - -#header ol li { - display: inline-block; - margin: 0 10px; - font-weight: 400; -} - -#header ol li a, nav ol li a:visited { - color: white; - text-decoration: none; -} - -#header ol li a:hover { - text-decoration: underline; -} - -li { - padding: 4px 0; - margin: 4px 0; - font-size: 0.9em; -} - - -/* Hide top menu SMALL SCREEN */ -@media only screen and (max-width: 780px) { - #header ol { - display: none; - } -} diff --git a/web/public/static/img/favicon.ico b/web/public/static/images/favicon.ico similarity index 100% rename from web/public/static/img/favicon.ico rename to web/public/static/images/favicon.ico diff --git a/web/public/static/img/ntfy.png b/web/public/static/images/ntfy.png similarity index 100% rename from web/public/static/img/ntfy.png rename to web/public/static/images/ntfy.png diff --git a/web/public/static/img/android-video-overview.mp4 b/web/public/static/img/android-video-overview.mp4 deleted file mode 100644 index cf295099..00000000 Binary files a/web/public/static/img/android-video-overview.mp4 and /dev/null differ diff --git a/web/public/static/img/android-video-subscribe-api.mp4 b/web/public/static/img/android-video-subscribe-api.mp4 deleted file mode 100644 index d73e5c6e..00000000 Binary files a/web/public/static/img/android-video-subscribe-api.mp4 and /dev/null differ diff --git a/web/public/static/img/badge-appstore.png b/web/public/static/img/badge-appstore.png deleted file mode 100644 index 0b4ce1c0..00000000 Binary files a/web/public/static/img/badge-appstore.png and /dev/null differ diff --git a/web/public/static/img/badge-fdroid.png b/web/public/static/img/badge-fdroid.png deleted file mode 100644 index 9464d38a..00000000 Binary files a/web/public/static/img/badge-fdroid.png and /dev/null differ diff --git a/web/public/static/img/badge-googleplay.png b/web/public/static/img/badge-googleplay.png deleted file mode 100644 index 36036d8b..00000000 Binary files a/web/public/static/img/badge-googleplay.png and /dev/null differ diff --git a/web/public/static/img/screenshot-curl.png b/web/public/static/img/screenshot-curl.png deleted file mode 100644 index 535d0830..00000000 Binary files a/web/public/static/img/screenshot-curl.png and /dev/null differ diff --git a/web/public/static/img/screenshot-docs.png b/web/public/static/img/screenshot-docs.png deleted file mode 100644 index 4345ded4..00000000 Binary files a/web/public/static/img/screenshot-docs.png and /dev/null differ diff --git a/web/public/static/img/screenshot-phone-add.jpg b/web/public/static/img/screenshot-phone-add.jpg deleted file mode 100644 index f728ec99..00000000 Binary files a/web/public/static/img/screenshot-phone-add.jpg and /dev/null differ diff --git a/web/public/static/img/screenshot-phone-detail.jpg b/web/public/static/img/screenshot-phone-detail.jpg deleted file mode 100644 index 2cd3b2fe..00000000 Binary files a/web/public/static/img/screenshot-phone-detail.jpg and /dev/null differ diff --git a/web/public/static/img/screenshot-phone-main.jpg b/web/public/static/img/screenshot-phone-main.jpg deleted file mode 100644 index 5caeee14..00000000 Binary files a/web/public/static/img/screenshot-phone-main.jpg and /dev/null differ diff --git a/web/public/static/img/screenshot-phone-notification.jpg b/web/public/static/img/screenshot-phone-notification.jpg deleted file mode 100644 index 7924c6fd..00000000 Binary files a/web/public/static/img/screenshot-phone-notification.jpg and /dev/null differ diff --git a/web/public/static/img/screenshot-phone-popover.png b/web/public/static/img/screenshot-phone-popover.png deleted file mode 100644 index 31d15152..00000000 Binary files a/web/public/static/img/screenshot-phone-popover.png and /dev/null differ diff --git a/web/public/static/img/screenshot-web-detail.png b/web/public/static/img/screenshot-web-detail.png deleted file mode 100644 index 5b32aa22..00000000 Binary files a/web/public/static/img/screenshot-web-detail.png and /dev/null differ diff --git a/web/public/static/js/home.js b/web/public/static/js/home.js deleted file mode 100644 index 80b14055..00000000 --- a/web/public/static/js/home.js +++ /dev/null @@ -1,84 +0,0 @@ - -/* All the things */ - -let currentUrl = window.location.hostname; -if (window.location.port) { - currentUrl += ':' + window.location.port -} - -/* Screenshots */ -const lightbox = document.getElementById("lightbox"); - -const showScreenshotOverlay = (e, el, index) => { - lightbox.classList.add('show'); - document.addEventListener('keydown', nextScreenshotKeyboardListener); - return showScreenshot(e, index); -}; - -const showScreenshot = (e, index) => { - const actualIndex = resolveScreenshotIndex(index); - lightbox.innerHTML = '
' + screenshots[actualIndex].innerHTML; - lightbox.querySelector('img').onclick = (e) => { return showScreenshot(e,actualIndex+1); }; - currentScreenshotIndex = actualIndex; - e.stopPropagation(); - return false; -}; - -const nextScreenshot = (e) => { - return showScreenshot(e, currentScreenshotIndex+1); -}; - -const previousScreenshot = (e) => { - return showScreenshot(e, currentScreenshotIndex-1); -}; - -const resolveScreenshotIndex = (index) => { - if (index < 0) { - return screenshots.length - 1; - } else if (index > screenshots.length - 1) { - return 0; - } - return index; -}; - -const hideScreenshotOverlay = (e) => { - lightbox.classList.remove('show'); - document.removeEventListener('keydown', nextScreenshotKeyboardListener); -}; - -const nextScreenshotKeyboardListener = (e) => { - switch (e.keyCode) { - case 37: - previousScreenshot(e); - break; - case 39: - nextScreenshot(e); - break; - } -}; - -let currentScreenshotIndex = 0; -const screenshots = [...document.querySelectorAll("#screenshots a")]; -screenshots.forEach((el, index) => { - el.onclick = (e) => { return showScreenshotOverlay(e, el, index); }; -}); - -lightbox.onclick = hideScreenshotOverlay; - -// Add anchor links -document.querySelectorAll('.anchor').forEach((el) => { - if (el.hasAttribute('id')) { - const id = el.getAttribute('id'); - const anchor = document.createElement('a'); - anchor.innerHTML = `#`; - el.appendChild(anchor); - } -}); - -// Change ntfy.sh url and protocol to match self-hosted one -document.querySelectorAll('.ntfyUrl').forEach((el) => { - el.innerHTML = currentUrl; -}); -document.querySelectorAll('.ntfyProtocol').forEach((el) => { - el.innerHTML = window.location.protocol + "//"; -});