* Refactor and fix `AuthorizeSiteAccess` plug shared link case handling
* Make plug module name more consistent
* Add moduledoc
* Add regression test for shared link auth case
* Adjust failing case test to account for different response
* Further restrict accepted input and configuration
* Extend plug-specific tests
* Tag EE-only test properly
* Remove one DB roundtrip from AuthorizeSiteAccess
* Improve naming slightly
* Filter shared link by site ID on query level already
---------
Co-authored-by: Uku Taht <uku.taht@gmail.com>
Building Dockerfile seems to be failing now with the following error:
```
Dockerfile:72
--------------------
70 | && if [ "$MIX_ENV" = "ce" ]; then apk add --no-cache certbot; fi
71 |
72 | >>> COPY --from=buildcontainer --chmod=a+rX /app/_build/${MIX_ENV}/rel/plausible /app
73 | COPY --chmod=755 ./rel/docker-entrypoint.sh /entrypoint.sh
74 |
--------------------
ERROR: failed to solve: invalid chmod parameter: 'a+rX'. it should be octal string and between 0 and 07777
```
Link: https://github.com/plausible/analytics/actions/runs/10898788870/job/30242872415
Not sure _why_ given this line hasn't changed in ages, but perhaps
something to do with buildx changes. If preview deploy succeeds in this,
it should fix the issue.
* Remove support for legacy user sessions
* Implement revoking all sessions for a given user
* Revoke all user sessions on password reset
* Add tests for revoking all user sessions on password reset
* Reload page when dashboard API request fails with 404
* Revert "Reload page when dashboard API request fails with 404"
This reverts commit 77d1a1035658915f9afe538afc5fb9a3da0ec905.
* Update to the copy
Update to the copy to include a note about billable pageviews. hopefully it doesn't make the copy too long...
* Don't show tooltip on small/mobile screens
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Drop event explicitly on session lock timeout
* Make session `user_id` more random in tests to avoid excess locking
* Improve testability to event ingestion
* Test lock timeout in ingestion
* APIv2: Make imports_skip_reason flag not appear when imports not requested
* Update lib/plausible/stats/query_result.ex
Co-authored-by: hq1 <hq@mtod.org>
---------
Co-authored-by: hq1 <hq@mtod.org>
`persist_session/1` is used in `populate_native_stats/1` test helper
to merge session data. It sometimes gets `:ok` instead of the actual
session data so that tests randomly fail with:
```
** (BadMapError) expected a map, got: :ok
code: populate_stats(site, [build(:pageview)])
stacktrace:
(elixir 1.17.1) lib/map.ex:486: Map.take/2
(plausible 0.0.1) lib/plausible/clickhouse_event_v2.ex:92: Plausible.ClickhouseEventV2.merge_session/2
(plausible 0.0.1) test/support/test_utils.ex:188: anonymous fn/2 in Plausible.TestUtils.populate_native_stats/1
(elixir 1.17.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
(plausible 0.0.1) test/support/test_utils.ex:184: Plausible.TestUtils.populate_native_stats/1
(plausible 0.0.1) test/support/test_utils.ex:179: Plausible.TestUtils.populate_stats/1
test/workers/send_site_setup_emails_test.exs:46: (test)
```
Offset-based pagination is used to make sure Looker integration
is able to work as efficiently as possible. To know how many
requests users need to do `include.total_rows` option was added.
* On the dashboard, allow Metrics (aka column configurations) to
* specify width they need
* specify if they are sortable
* Default sort order for breakdown endpoints is hardcoded on the dashboard (needed to show what column the report is sorted by)
* Unifies Google Keywords modal with other breakdowns
* query.date_range is now in UTC instead of user timezone
This simplifies things down the line and fixes several bugs where
query.date_range is cast to naivedatetime for ecto purposes
Many places still remain broken:
- comparison queries
- `to_date_range` calls
* Make default_for_date_range not care about time zones
* Make timezone parameter mandatory for to_date_range
* Simplify utc_date_range, update legacy query builder
* Fix more cases where query date range is needed
* query.date_range -> query.utc_time_range
* Query.date_range/1 function
* ensure_include_imported update
* Clean up send_email_report
* auto https
* changelog
* enable auto-tls only when http_port is 80
* make erlang ssl less verbose
* simplify config
* simplify config
* fix ce_dev typo
* fix another typo
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Safeguard session queries relying on `sign` from faulty old session entries
* Comment updated metric
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
* Apply safeguards to `bounce_rate` metric only
* Add note to bounce rate definition in SQL fragments as well
* Add test for graceful bounce rate handling in breakdown
* Make user_id more unique
* Add a note to the test
* Move regression test to APIv2 tests
---------
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
* fix deciding whether a filter operation is freeChoice
* fix displaying loading spinner when loading combobox options
* extract lastLoadTimestamp into a separate context
* prettier
* order migrations
* migrate in 'streaks'
* cleanup
* docs
* tests
* add comment
* changelog
* continue
* run migrations tests in ci
* add pending_streams cmd
* fix ci
* add docs
* fix test
* simplify test
* only test v2+
* fix test
* return async: true
* cleanup
* add 'no pending migration'
* drop migrate/0 and pending_migrations/0
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* remove ch timeouts from ce
* just infinity
* make timeout configurable
* quadruple
* add test
* improve test
* fix test filtering in ci
* just don't compile the test in ee
* fix test in ee
* maybe this would work
* rm test
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Rename matches/does_not_match filters internally
These have never been exposed to the frontend/user directly, only via
APIv1 filtering syntax. As such we are free to rename these without
breaking things
* Rename function arguments for consistency, simplify
* Add support for `match`/`not_match` operators for query apiv2
These match the string against a regular expression, as defined in
https://github.com/google/re2/wiki/Syntax
* not_match -> match_not
* does_not_contain -> contains_not
Note that for backwards compatibility:
- Browser handles does_not_contain in URL
- Backend will handle does_not_contain in queries for a day where we will remove it for better autocompletion
* not_matches_wildcard -> matches_wildcard_not
* prettier
* match -> matches
* Fix and test fix for matches_wildcard against prop when prop is missing
* Custom properties support for matches/matches_not
* Restore contains_not
* Test contains and contains_not behavior for custom properties
* Replace native tooltips with simplified, generic component
* Make tooltip a button?
* Revert "Make tooltip a button?"
This reverts commit adacc560f9.
Previous migration took forever on prod, likely because Map lookups are linear time in complexity.
`transform/3` helps achieve the same functionality with the help of a hash table and updated
WHERE clause allows skipping most rows which dont need updating
Co-authored-by: Uku Taht <Uku.taht@gmail.com>
* Dont include imports for time:hour and time:minute dimensions
Also include more information about import warnings in query results
* Update lib/plausible/stats/query_result.ex
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
* Revert patch
* Imported disabled graph notice (#4522)
* add explicit skip_imported_reason for unsupported interval
* stop returning information about imports from main_graph
* return warning about interval in Stats API Timeseries
* display warning bubble about interval too short for imported data
* update changelog
* improve styling of the exclamation circle icon
* return tuple from timeseries instead of map
* rename variable
* Update CHANGELOG.md
---------
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
After refactor, it turned out that when the _legacy_ session times out,
the conn is halted but no body is sent. This results in 500 error (`Plug.Conn.NotSentError`).
This PR fixes it by redirecting to login page.