Commit graph

792 commits

Author SHA1 Message Date
Pēteris Caune
7836da6448
Update settings.py to allow subpath in SITE_ROOT
If SITE_ROOT contains a subpath
(e.g., "http://example.org/healthchecks"), settings.py now adjusts
FORCE_SCRIPT_NAME and STATIC_URL.

Also, hc.lib.urls.absolute_reverse() now recognizes subpath in
SITE_ROOT, and makes sure it does not show up twice in the
generated URLs.

cc: #1091
2024-12-04 10:37:52 +02:00
Pēteris Caune
22268c1484
Move absolute URL construction to hc.lib.urls.absolute_reverse()
absolute_reverse() works the same as django.urls.reverse()
except it generates absolute URLs (starting with http[s]://)
2024-12-03 17:24:27 +02:00
Pēteris Caune
4a618cd7e9
Fix elf -> self 2024-12-02 11:32:53 +02:00
Jacek Kowalski
8485c758eb
Fix Trello integration (token regexp too specific) (#1094)
* Fix Trello configuration failing with HTTP 400

* Add additional tests regarding Trello token
2024-12-02 11:31:02 +02:00
Pēteris Caune
cb7e53677d
Increase ntfy.sh topic max length to 64 2024-11-25 11:16:15 +02:00
Pēteris Caune
62b10be5fe
Implement "no matching checks" message when searching/filtering
(instead of showing a table with a header row and no data rows)
2024-11-15 12:11:18 +02:00
Pēteris Caune
5ecea08e48
Fix type annotation 2024-11-14 14:28:47 +02:00
Pēteris Caune
b328c8739f
Reduce the number of Check.get_status() calls 2024-11-14 13:33:21 +02:00
Pēteris Caune
7c8d43414f
Implement filtering by status on the server side 2024-11-14 12:27:31 +02:00
Pēteris Caune
79da9e9f4f
Fix auto-fixable ruff warnings
(`ruff check --fix`)
2024-11-07 15:15:58 +02:00
Pēteris Caune
e048ec4c48
Fix "class Foo(object):" -> "class Foo:"
In Python 3 these are equivalent, and shorter is better.
2024-10-29 17:57:50 +02:00
Pēteris Caune
374f034bf9
Update check's status text to show how long it has been running
In check's details page, we have a "Current Status" section.
It shows an icon, a status text, and a table with downtime
statistics. When the check has received a start signal, the icon
also has an animated progress indicator under it.

With this change, the status text will also indicate the running
state and the elapsed time. Example:

"Currently running, started 3 minutes ago".
2024-10-23 14:14:44 +03:00
Pēteris Caune
d574fa65fc
Update _refresh_last_active_date to also refresh user session
Fixes: #1063
2024-10-10 15:41:00 +03:00
Pēteris Caune
e49b5f8fbd
Remove LINE Notify onboarding form
LINE Notify is shutting down on Apr 1, 2025:
https://notify-bot.line.me/closing-announce

I'm removing the onboarding form so people don't set up new
integrations that will stop working in 5 months.

The code for sending LINE Notify notifications still exists,
and the existing integrations will continue to work (until LINE
Notify stops working).
2024-10-08 09:13:03 +03:00
Pēteris Caune
fd96cc794b
Remove unused bits 2024-10-04 17:34:30 +03:00
Pēteris Caune
a463daa775
Update Webhook transport to close db connection before network IO
Webhook requests can take 20+ seconds. During that time we hold
on to a database connection. With this commit, the Webhook transport
closes its DB connection before making a curl call.

With psycopg2 this does not have much effect. But with
psycopg 3 & connection pooling we will be able to use more
sendalerts workers than we have database connections. While one
worker is busy making a slow curl call, another worker can
grab its freed up connection and do some work.

Django's test runner is not happy with connections closed
mid-test, so I patched out close_old_connections() in affected tests.
2024-08-31 19:18:17 +03:00
Pēteris Caune
027fcc1097
Simplify and eliminate assert 2024-08-20 14:39:11 +03:00
Pēteris Caune
0a4f038987
Simplify and eliminate assert 2024-08-20 14:13:58 +03:00
Pēteris Caune
b27ffe07a6
Update email_form to use more precise type annotation 2024-08-20 13:58:52 +03:00
Pēteris Caune
001ba8b69b
Fix type warnings 2024-08-20 11:06:55 +03:00
Pēteris Caune
5e051bfc30
Fix AJAX views to better handle user logging out
Rather than redirecting to login page, return HTTP 403 Forbidden
2024-08-20 10:57:36 +03:00
Pēteris Caune
cda744d0c1
Implement search by slug in the checks list
cc: #1048
2024-08-15 14:17:28 +03:00
Pēteris Caune
3fbba0c2f0
Update timezone dropdowns to show frequently used timezones at the top 2024-08-13 13:57:52 +03:00
Pēteris Caune
b859a71920
Rename "sign in" to "log in"
I like "sign in" better, but users from time
to time confuse "sign in" and "sign up" forms. To reduce
confusion potential, I'm renaming "sign in" to "log in".
2024-08-12 15:09:58 +03:00
Pēteris Caune
aa2bd8cf66
Fix a testcase not correctly using sample values 2024-07-29 10:36:29 +03:00
Pēteris Caune
e83f60cc0b
Implement Implement MS Teams Workflows integration
We already have a MS Teams integration but MS Teams is discontinuing
the incoming webhook feature used by this integration:

https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/

MS Teams now recommends to use Workflows to post messages
via webhook. MS Teams does not provide backwards compatibility or
an upgrade path for existing integrations.

This commit adds a new "msteamsw" integration which uses MS Teams
Workflows to post notifications. It also updates the instructions
and illustrations in the "Add MS Teams Integration" page.

cc: #1024
2024-07-17 13:35:17 +03:00
Pēteris Caune
70c5be5c4b
Fix type warning 2024-07-11 17:45:51 +03:00
Pēteris Caune
1b695c6970
Improve performance of loading ping body previews
Defer loading body_raw, instead load its first 150 bytes
as "body_raw_preview". This reduces both network I/O to database,
and disk I/O on the database host if the database contains large
request bodies.

cc: #1023
2024-07-11 17:38:25 +03:00
Pēteris Caune
3e5080d9eb
Remove Ping.body field 2024-07-11 16:34:18 +03:00
Pēteris Caune
997154e3b0
Remove usages of Ping.body 2024-07-11 16:17:21 +03:00
Pēteris Caune
7ef18cd706
Fix type warning and upgrade django-stubs-ext 2024-05-27 15:59:18 +03:00
Pēteris Caune
d56105e670
Update Slack integration to use channel name as the integration name
Fixes: #1003
2024-05-27 15:54:30 +03:00
Pēteris Caune
5202938b9c
Update log entry template to show body before UA 2024-05-10 16:09:13 +03:00
Pēteris Caune
c940239757
Improve type hints in the pygmentize management command 2024-05-01 11:34:39 +03:00
Pēteris Caune
4e108073ac
Add handling for Discord "max num of webhooks reached" OAuth response 2024-04-22 10:50:51 +03:00
Pēteris Caune
bd64fab619
Fix hc.front.views.docs_search to handle AND/OR/NOT as query strings 2024-04-18 15:36:48 +03:00
Pēteris Caune
7c7a103632
Improve type hints 2024-04-15 15:41:10 +03:00
Pēteris Caune
28fdfd1362
Change Channel.notify() signature to take Flip object as an argument
... and pass it to Transport.notify_flip().

This allows us to pass flip-specific information (the flip timestamp,
the new status) to transport classes.
2024-04-12 13:54:16 +03:00
Pēteris Caune
b3bd21a408
Fix the sorting of events with identical timestamps
If timestamps are equal, put flips chronologically after pings.
We are showing events in reverse chronological order (newer
events at the top), so the flips will now display
*above* the pings that caused them.
2024-04-10 14:50:31 +03:00
Pēteris Caune
9bb5656d40
Implement dynamic favicon in the projects overview page
cc: #971
2024-04-10 14:36:42 +03:00
Pēteris Caune
27c065230a
Switch back to using integer timestamps in the log page
The live-updating code still needs float timestamps, but
we only need them for the most recent event (so we know
the lower threshold for fetching new events). We now send
the float timestamp separately:

* in the `/log/` view, we put it in HTML content, in a <script> tag
* in the `/log_events/` view we put it in response header

The main benefit of this is smaller response sizes for the
`/log/` and `/log_events/` views.
2024-04-09 14:24:43 +03:00
Pēteris Caune
d7948d9939
Show status changes (flips) in check's log page
Fixes: #447
2024-04-09 12:39:42 +03:00
Pēteris Caune
17b7947bed
Add SITE_NAME setting override in test_details 2024-03-26 17:33:13 +02:00
Pēteris Caune
430d9ad955
Add testcases for favicons 2024-03-26 17:28:58 +02:00
Pēteris Caune
b5364651ee
Increase the event limit in the details page from 20 to 30 2024-03-21 14:52:46 +02:00
Pēteris Caune
9c5ee74c20
Improve tests 2024-03-21 14:34:50 +02:00
Pēteris Caune
b9e788b9c6
Change log_events response content type from JSON to HTML 2024-03-21 13:21:09 +02:00
Pēteris Caune
3026162a85
Fix date bounds check in log_events
log_events was using Check.created as the lower bound.
If a check has many pings, we need to use the oldest
visible ping's date as the lower bound, otherwise
we may return notifications older than the oldest visible
ping.
2024-03-21 11:37:46 +02:00
Pēteris Caune
855fac0973
Implement filtering by event type in the Log page
Fixes: #873
2024-03-21 11:04:45 +02:00
Pēteris Caune
df6895ed1f
Fix regression in log auto-updating code
Also switch back to using integers for the slider min and max
values, and for the hc.front.forms.LogFilterForm.
2024-03-19 19:11:46 +02:00