Commit Graph

1462 Commits

Author SHA1 Message Date
sua yoo
4347fcdba5
feat: Show collection created date (#2302)
- Shows collection created date in detail view (if present)
- Adds `black` formatter to vscode extension recommendations

---------

Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
2025-01-14 11:22:00 -05:00
Tessa Walsh
cbcf087a48
Add last crawl and subscription status indicators to org list (#2273)
Fixes #2260 

- Adds `lastCrawlFinished` to Organization model, updated after crawls
are added/deleted and with an idempotent migration to backfill existing
orgs
- Adds Last Crawl column to end of admin orgs list table
- Adds subscription icon next to existing status icon in orgs list
- Adds "lastCrawlFinished", "subscriptionStatus", and "subscriptionPlan"
sort options to orgs list backend endpoint in anticipation of future
sorting/filtering of orgs list

---------

Co-authored-by: emma <hi@emma.cafe>
Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
2025-01-14 10:57:06 -05:00
Emma Segal-Grossman
04e9127d35
Remove ANALYTICS_NAMESPACE, as it's only usable at build time (#2293)
Replaces `ANALYTICS_NAMESPACE` with setting `window.btrixEvent` via
`inject_extra` config

---------

Co-authored-by: sua yoo <sua@suayoo.com>
2025-01-13 20:13:30 -08:00
Ilya Kreymer
12f358b826
Merge pull request #2271 from webrecorder/public-collections-feature
feat: Public collections, includes:
- feat: Public org profile page #2172
- feat: Collection thumbnails, start page, and public view updates #2209
- feat: Track collection events #2256
2025-01-13 19:32:45 -08:00
Ilya Kreymer
bab5345ad5 version: bump to 1.14.0-beta.0 for public collections! 2025-01-13 19:29:54 -08:00
Henry Wilkinson
56a634e593
ui: Public Collections UI Nitpicks (#2287)
- Removes share link from the dialogue footer
- Removes stickied collection navigation, replaces with improved
viewport-based scaling!
- Adds a max-width for the collection description in the logged in view.
- Moves the markdown editor buttons to below the editor
- Controls are now In-line with how we handle dialogue options
elsewhere, fixes a minor responsive design issue.
- Minor copy changes

---------

Co-authored-by: emma <hi@emma.cafe>
Co-authored-by: sua yoo <sua@webrecorder.org>
2025-01-13 15:15:49 -08:00
Tessa Walsh
d8655d3bc6
Use id for thumbnail size error detail 2025-01-13 15:15:49 -08:00
Tessa Walsh
be9ff04ee8
Make more explicit error message for large thumbnails 2025-01-13 15:15:49 -08:00
sua yoo
0c81a2f89e
chore: Refactor page headers (#2282)
- Refactors all page headers to use new `pageHeader`
- Removes border under org name/title in the org dashboard
2025-01-13 15:15:49 -08:00
sua yoo
b36ed9f730
feat: Track collection events (#2256)
- Renames `inject_analytics` to `inject_extra` and updates docs
- Manually tracks page views to enable passing custom props
- Tracks copying collection share link and downloading a public
collection

---------

Co-authored-by: emma <hi@emma.cafe>
2025-01-13 15:15:49 -08:00
Tessa Walsh
eb88e9f90c
Add missing os import 2025-01-13 15:15:48 -08:00
sua yoo
093b114479
feat: Collection thumbnails, start page, and public view updates (#2209)
- Allows user to choose collection replay home page and collection
thumbnail (resolves
https://github.com/webrecorder/browsertrix/issues/2182)
- Displays collection thumbnails on org dashboard and public page
- Enables downloading public collection (resolves
https://github.com/webrecorder/browsertrix/issues/2233)
- Adds caption as "Summary" to metadata dialog
- Moves description editor to "About" tab

---------

Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
2025-01-13 15:15:48 -08:00
Tessa Walsh
a031fab313
Backend work for public collections (#2198)
Fixes #2182 

This rather large PR adds the rest of what should be needed for public
collections work in the frontend.

New API endpoints include:

- Public collections endpoints: GET, streaming download
- Paginated list of URLs in collection with snapshot (page) info for
each
- Collection endpoint to set home URL
- Collection endpoint to upload thumbnail as stream
- DELETE endpoint to remove collection thumbnail

Changes to existing API endpoints include:

- Paginating public collection list results
- Several `pages` endpoints that previously only supported `/crawls/` in
their path, e.g. `/orgs/{oid}/crawls/all/pages/reAdd`, now support
`/uploads/` and `/all-crawls/` namespaces as well. This is necessitated
by adding pages for uploads to the database (see below). For
`/orgs/{oid}/namespace/all/pages/reAdd`, `crawls` or `uploads` will
serve as a filter to only affect crawls of that given type. Other
endpoints are more liberal at this point, and will perform the same
action regardless of the namespace used in the route (we'll likely want
to change this in a follow-up to be more consistent).
- `/orgs/{oid}/namespace/all/pages/reAdd` now kicks off a background job
rather than doing all of the computation in an asyncio task in the
backend container. The background job additionally updates collection
date ranges, page/size counts, and tags for each collection in the org
after pages have been (re)added.

Other big changes:

- New uploads will now have their pages read into the database!
Collection page counts now also include uploads
- A migration was added to start a background job for each org that will
add the pages for previously-uploaded WACZ files to the database and
update collections accordingly
- Adds a new `ImageFile` subclass of `BaseFile` for thumbnails that we
can use for other user-uploaded image files moving forward, with
separate output models for authenticated and public endpoints
2025-01-13 15:15:48 -08:00
sua yoo
f60a99cc26
feat: Make collection public (#2208) 2025-01-13 15:15:48 -08:00
sua yoo
6e48f957f9
feat: Public org profile page (#2172)
- Enables creating a public org profile page with description and
website at `/profile/<org slug>`
- Updates current "Overview" page to be "Dashboard", found under
`/dashboard`
- Organizes org "General" settings tab by "General", "Profile", and
"Developer Tools"
- Adds sign up banner to log in page for consistent CTA banners
- Updates copy and docs to support changes
- Allows user to set collection to private, public, or unlisted
- Adds route for public collection page with basic page layout
- Refactors copy button to abstract clipboard functionality
---------

Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
Co-authored-by: emma <hi@emma.cafe>
2025-01-13 15:15:48 -08:00
Tessa Walsh
190bdeb868
Add public API endpoint for public collections (#2174)
Fixes #1051 

If org with provided slug doesn't exist or no public collections exist
for that org, return same 404 response with a detail of
"public_profile_not_found" to prevent people from using public endpoint
to determine whether an org exists.

Endpoint is `GET /api/public-collections/<org-slug>` (no auth needed) to
avoid collisions with existing org and collection endpoints.
2025-01-13 15:15:48 -08:00
Tessa Walsh
42ebfd303d
Make changes to collections to support publicly listed collections (#2164)
Fixes #2158 

- Adds `Organization.listPublicCollections` field and API endpoint to
update it
- Replaces `Collection.isPublic` boolean with `Collection.access`
(values: `private`, `unlisted`, `public`) and add database migration
- Update frontend to use `Collection.access` instead of `isPublic`,
otherwise not changing current behavior

---------

Co-authored-by: sua yoo <sua@suayoo.com>
2025-01-13 15:15:47 -08:00
Emma Segal-Grossman
19c1d28349
Fix language selector using locale instead of lang (#2294)
Also fixes a shoelace menu-item bug where checkbox menu items would have
their checked state flipped on click, regardless of `checked` value.

~~Deploying to dev to test if this fixes language switching...~~ Yep!
Seems to fix the issues.
2025-01-13 15:01:57 -05:00
Ilya Kreymer
a21b2ff0df version: bump to 1.13.2 2025-01-08 22:58:33 -08:00
Ilya Kreymer
85e400d31a
Translations update from Hosted Weblate (#2254) (#2292)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for

[Browsertrix/Browsertrix](https://hosted.weblate.org/projects/browsertrix/browsertrix/).



Current translation status:

![Weblate translation

status](https://hosted.weblate.org/widget/browsertrix/browsertrix/horizontal-auto.svg)

---------

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Emma Segal-Grossman <emma@webrecorder.org>
Co-authored-by: Carole Gagné <carole.gagne@banq.qc.ca>
Co-authored-by: Bricaud Frédéric <frederic.bricaud@banq.qc.ca>
Co-authored-by: Webrecorder Dev <dev@webrecorder.org>
Co-authored-by: weblate <weblate@users.noreply.github.com>
2025-01-08 22:56:17 -08:00
sua yoo
6a5e070ffc
fix: Allow deleting workflows without any crawls (#2285)
- Uses crawl count to determine whether workflow can be deleted instead
of last crawl ID
- Display delete confirmation dialog when trying to delete a workflow
2025-01-08 16:02:53 -08:00
sua yoo
1260aec976
fix: Crawler proxy selection fixes (#2280)
- Hides proxy form control if there are no proxy servers available
- Fixes org default proxy value not being saved
2025-01-08 16:02:09 -08:00
Emma Segal-Grossman
d6189eee9a
Add fuse-backed org search to superadmin org list (#2277)
Closes #2276 

Adds a simple search bar to the superadmin interface that allows users
to search for orgs by org name, id, users (names and emails), and
subscriptions (subscription id and plan id).

[Extended search](https://www.fusejs.io/examples.html#extended-search)
is enabled, so exact search terms like `=stripe:sub_xxxxxxx` can be used
to find a specific org directly. [See the
docs](https://www.fusejs.io/examples.html#extended-search) for what
operators are available.

<img width="897" alt="Screenshot 2025-01-07 at 1 59 27 PM"
src="https://github.com/user-attachments/assets/56c22fd0-5a61-4665-b904-d4534079158a"
/>
<img width="894" alt="Screenshot 2025-01-07 at 1 59 39 PM"
src="https://github.com/user-attachments/assets/2a9fcee7-bcd0-4959-854c-e43daddbe7cf"
/>
2025-01-07 14:58:33 -05:00
sua yoo
3b6f63f030
deps: Upgrade to Node 22 (#2274)
- Upgrades build to use Node 22
- Adds version matrix to GH workflow to test compatibility with 20
2025-01-07 11:58:23 -08:00
sua yoo
71a83bb2e4
fix: Update superadmin orgs list after create (#2278)
Fixes newly created org not showing in list
2025-01-07 11:12:11 -08:00
Emma Segal-Grossman
cf1d97ab68
Use types from ReplayWebPage (#2265)
- Updates
[moduleResolution](https://www.typescriptlang.org/tsconfig/#moduleResolution)
to `bundler`, like RWP and most other bundled packages
- Adds `replaywebpage` as a dependency
- Fixes issues from changing moduleResolution (mostly just file
extension updates for shoelace components)

Resolves the issue initially reported in
https://github.com/webrecorder/replayweb.page/issues/376
2024-12-23 16:38:37 -05:00
Tessa Walsh
589819682e
Optionally delay replica deletion (#2252)
Fixes #2170

The number of days to delay file replication deletion by is configurable
in the Helm chart with `replica_deletion_delay_days` (set by default to
7 days in `values.yaml` to encourage good practice, though we could
change this).

When `replica_deletion_delay_days` is set to an int above 0, when a
delete replica job would otherwise be started as a Kubernetes Job,
a CronJob is created instead with a cron schedule set to run yearly,
starting x days from the current moment. This cronjob is then deleted by
the operator after the job successfully completes. If a failed
background job is retried, it is re-run immediately as a Job rather
than being scheduled out into the future again.

---------
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2024-12-19 18:50:28 -08:00
Ilya Kreymer
2060ee78b4
Support Presigning for use with custom domain (#2249)
If access_endpoint_url is provided:
- Use virtual host addressing style, so presigned URLs are of the form
`https://bucket.s3-host.example.com/path/` instead of
`https://s3-host.example.com/bucket/path/`
- Allow for replacing `https://bucket.s3-host.example.com/path/` ->
`https://my-custom-domain.example.com/path/`, where
`https://my-custom-domain.example.com/path/` is the access_endpoint_url
- Remove old `use_access_for_presign` which is no longer used
- Fixes #2248
- docs: update deployment docs storages section to mention custom storages, access_endpoint_url

---------

Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
2024-12-19 18:41:47 -08:00
Ilya Kreymer
8e375335cd
Related crawljob filtering by role (#2262)
add filtering by role to related crawljobs query:
- for regular crawls (role 'job'), only count other regular crawls
- for qa runs (role 'qa-job') only count other qa jobs
- ensures that concurrent crawl limits apply separately to regular
crawls and qa runs
- fixes #2261
2024-12-19 17:20:15 -08:00
Ilya Kreymer
60d07762be version: bump to 1.13.1 2024-12-19 12:01:47 -08:00
Ilya Kreymer
147096c972
Additional translations (Weblate->Main )(#2255)
Merge more Spanish translations updates to main for 1.13 release

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Clara Itzel <missclaraitzel@gmail.com>
Co-authored-by: Lorena Ramírez-López <lorena@webrecorder.org>
Co-authored-by: Webrecorder Dev <dev@webrecorder.org>
Co-authored-by: weblate <weblate@users.noreply.github.com>
2024-12-17 15:51:43 -08:00
sua yoo
9597cb1062
chore: Prevent blocking connected callback (#2244)
Moves language initialization to `willUpdate` to prevent blocking
connected callback and attaching listeners
2024-12-17 09:29:51 -08:00
sua yoo
02eeaca245
test: Update Playwright E2E test settings (#2247)
- Moves E2E test user to dedicated env variables
- Fixes playwright test redirect issue

---------

Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
2024-12-16 17:36:21 -08:00
Ilya Kreymer
daae82191f
add missing toast id: (#2245)
- follow up to #2236, add a toast for account settings localization
formatting
2024-12-16 17:05:49 -05:00
Ilya Kreymer
02c4381694
fix rendering org list if org.created is null: (#2243)
- org.created may be null (for backwards compatibility before it was
set)
- fix frontend type to match backend
- update format.date() to accept null, return empty string
2024-12-13 21:11:26 -08:00
Ilya Kreymer
cf60c43df2
version: bump to 1.13.0! (#2242) 2024-12-13 20:32:38 -08:00
Ilya Kreymer
c27758a0f6
quickfix: update test_api.py to match all locales enabled by default (#2241) 2024-12-13 20:30:06 -08:00
Ilya Kreymer
74ae3b0f8d
Add new locales (#2240)
- By default, all locales are enabled to make it easy for local deployments to test new locales
- Adds DE, FR, PT locales to make way for translation in Weblate
2024-12-13 19:59:09 -08:00
Emma Segal-Grossman
b650762a45
Allow configuring available languages from helm chart (#2230)
Closes #2223 

- [x] Adds `localesAvailable` to `/api/settings` endpoint, and uses that
list if available, rather than the full list of translated locales, to
determine which options to display to users
- [x] ~~Uses the user's browser locales, filtered to the current
language setting, for formatting numbers, dates, and durations~~
- [x] Adds & persists checkbox for "use same language for formatting
dates and numbers" in user settings
- [x] Replaces uses of `sl-format-bytes` with `localize.bytes(...)`, and
`sl-format-date` with replacement `btrix-format-date` that properly
handles fallback locales
- [x] Caches all number/duration/datetime formatters by a combined key
consisting of app language, browser language, browser setting, and
formatter options so that all formatters can be reused if needed
(previously any formatter with non-default options would be recreated
every render)
- [x] Splits out ordinal formatting from number formatter, as it didn't
make much sense in some non-English locales
- [x] Adds a little demo of date/time/duration/number formatting so you
can see what effect your language settings have
  


https://github.com/user-attachments/assets/724858cb-b140-4d72-a38d-83f602c71bc7

---------

Signed-off-by: emma <hi@emma.cafe>
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2024-12-13 22:31:26 -05:00
Emma Segal-Grossman
46aab91ef5
Adds optional IDs to toasts to replace rather than add to toast stack (#2236)
This has been bugging me for a while — any type of repetitive action
that shows a toast will quickly cause a big stack of toasts to build up.
This fixes that by allowing different categories of toasts to exist,
where each category can only have one active toast. _Different_
categories of toast can coexist just fine, but toasts with the same `id`
will replace any existing toast with that same `id`.

It's been a pet peeve for a while, and it should make any sort of "power
user" use of Browsertrix a lot nicer :)

I've gone over all the existing toasts and applied what feel like decent
differentiations, but I'm not set on any of them — open to suggestions!


https://github.com/user-attachments/assets/dbe39141-9e56-427d-b702-124c45ef2b9a

---------

Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2024-12-13 15:27:01 -05:00
Ilya Kreymer
3e6788b2c1
analytics path in dev server (#2231)
quick follow-up to #2226:
- rename script _plausible.js -> analytics.js to be more generic
- devserver: serve empty /analytics.js from webpack dev server

---------

Co-authored-by: emma <hi@emma.cafe>
2024-12-12 15:06:03 -05:00
Ilya Kreymer
db39333ef4
Send subscription cancelation email (#2234)
Adds sending a cancellation email when a subscription is cancelled.
- The email may also include an option survey optional survey URL, if
configured in helm chart `survey_url` setting.
- Cancellation e-mail configured in `sub_cancel` e-mail template
- E-mails are sent to all org admins.
- Also adds `trialing_canceled` subscription state to differentiate from
a default `trialing` which will automatically rollover into `active`.
- The email is sent when: a new cancellation date is added for an
`active` subscription, or a `trialing` subscription is changed to to
`trialing_canceled`. (A subscription can be canceled/uncanceled several
times before actual date, and e-mail is sent every time it is canceled.)
- The 'You have X days left of your trial' is also always displayed when
state is in trialing_canceled.

Fixes #2229
---------

Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
2024-12-12 11:52:38 -08:00
Emma Segal-Grossman
a65ca49ddd
Plausible analytics (#2226)
Closes #2222 

Adds a runtime script that gets set to either inject the plausible
script tags, or do nothing, that runs at initialization of the frontend
container.
2024-12-10 16:30:22 -08:00
sua yoo
541298eb48
fix: Prevent submitting invalid regex with keyboard enter (#2228)
Fixes https://github.com/webrecorder/browsertrix/issues/2227
2024-12-10 00:00:09 -08:00
Tessa Walsh
b7604ee61d
Add superuser endpoint to get user emails with org info (#2211)
Fixes #2203

---------

Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
2024-12-09 16:38:01 -08:00
Ilya Kreymer
b041baf5df
Changes to support weblate workflow (#2210)
This PR syncs the weblate branch back to main, and adds:
- New Spanish translations contributed in weblate!
- New GH action which reformats weblate commits with `localize:extract`,
ensuring strings are not changed, and also runs `localize:build` to
extract templates (as tested in PR: #2207)
- Reformats existing XLIFF files to match `localize:extract`, including
adding self-closing tags.
- Update on generated templates
- Prettier: disable alpha sorting XML attributes to hopefully minimize
conflcits
- Strings: change some strings that use `&` to be wrapped in html`` to
ensure proper unencoding, or just switch to 'and' where that's not
possible.

---------

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Webrecorder Dev <dev@webrecorder.org>
Co-authored-by: Kamborio <Kamborio15@users.noreply.hosted.weblate.org>
Co-authored-by: Clara Itzel <missclaraitzel@gmail.com>
Co-authored-by: weblate <weblate@users.noreply.github.com>
Co-authored-by: emma <hi@emma.cafe>
Co-authored-by: sua yoo <sua@webrecorder.org>
2024-12-09 15:16:47 -08:00
Ilya Kreymer
b741de0232
tweak the 'stop crawl' confirmation message to be more accurate (#2215)
More accurate description of what happens when the crawl is stopped
(reported by @dcgomes, revised by @emma-sg)
2024-12-07 13:16:09 -08:00
Emma Segal-Grossman
69f21b2a79
Add linguist-generated attribute to generated files (#2221)
Just some best practices [as outlined
here](https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github).
Should help make code reviews a little nicer.
2024-12-07 01:27:50 -05:00
Emma Segal-Grossman
a35c311571
Redirect previous crawl paths to new paths under their workflow (#2214)
Closes #2213 

This ended up being a bit of a variety PR, but primarily this fixes
issues around archived item pages for crawls at URL locations we no
longer support — specifically, crawls, which now live at
`/orgs/{oid}/workflows/{workflow_id}/crawl/{crawl_id}`, rather than
`/orgs/{oid}/items/crawl/{crawl_id}`, including the QA pages at
sub-paths of these. Attempting to view a crawl at the old (unsupported)
URL will now redirect you to the correct URL!

Other changes include:
- Updated links in various parts of the app — nothing should link to the
old URL pattern anymore for crawls!
- Improved `APIRouter` and `ViewState` typing
- A couple extra `APIRouter` tests
- An addition to the route definition for crawls at
`/orgs/{oid}/items/crawl/{crawl_id}` that allows for redirections from
QA review page URLs, rather than 404 errors — this was the actual
reported problem!
- Caching in CI for playwright tests
- `needsLogin` conversion from the deprecated `LiteElement` to
`BtrixElement`, along with all the components that use it


---------

Co-authored-by: emma-sg <emma-sg@users.noreply.github.com>
2024-12-06 16:06:59 -08:00
sua yoo
9736297c49
fix: More accurate rounded days in subscription end message (#2193)
Resolves https://github.com/webrecorder/browsertrix/issues/2192

## Changes

- Displays more accurate subscription/trial end message when
subscription ends between 1-2 days
- Shows timezone for end date

---------
Co-authored-by: SuaYoo <SuaYoo@users.noreply.github.com>
2024-12-05 14:22:27 -08:00