236 Commits

Author SHA1 Message Date
aecsocket
bcc36362be Expose utilities for setting up the database (#4657)
* Expose utilities for setting up the database

* Expose migrator directly

* Make some test utils publicly accessible

* expose migrator

* more test fixture utils

* more test fixture utils

* more test fixture utils

* fix

* fix lint
2025-10-30 10:10:25 +00:00
aecsocket
ab886a5ea8 Fix CORS (#4610) 2025-10-24 18:27:44 +00:00
aecsocket
03b0eba695 Add utoipa Swagger UI support (#4602)
* Add utoipa Swagger UI support

* remove unused code

* remove unused code

* consistency with trailing slash
2025-10-24 14:44:50 +00:00
aecsocket
707ff2146b Update appropriate rows when removing a user (#4597)
* Update appropriate rows when removing a user

* Update sqlx cache

* Delete rows from payouts_values_notifications instead of make ghost user
2025-10-24 14:19:53 +00:00
François-Xavier Talbot
f375913c62 Adjust some values in tax-related tasks (#4598)
* Adjust some values for tax processing

* chore: query cache, clippy, fmt
2025-10-21 15:55:54 +00:00
François-Xavier Talbot
977de0e18a Fix MaxMind (#4595)
* add maxmind to app data

* add back maxmind account id check
2025-10-21 00:24:47 +02:00
François-Xavier Talbot
c379e4b173 admin/credit: don't credit unprovisioned subscriptions (#4594)
* Remove pointless sorting

* Filter subscriptions by labrinth's provisioned state
2025-10-20 20:31:20 +00:00
François-Xavier Talbot
eeed4e572d Credit subscriptions (#4575)
* Implement subscription crediting

* chore: query cache, clippy, fmt

* Improve code, improve query for next open charge

* chore: query cache, clippy, fmt

* Move server ID copy button up

* Node + region crediting

* Make it less ugly

* chore: query cache, clippy, fmt

* Bugfixes

* Fix lint

* Adjust migration

* Adjust migration

* Remove billing change

* Move DEFAULT_CREDIT_EMAIL_MESSAGE to utils.ts

* Lint

* Merge

* bump clickhouse, disable validation

* tombi fmt

* Update cargo lock
2025-10-20 17:35:44 +00:00
François-Xavier Talbot
79502a19d6 bump clickhouse, disable validation (#4593)
* bump clickhouse, disable validation

* tombi fmt
2025-10-20 17:30:28 +00:00
François-Xavier Talbot
3dbfd69bdd Fix clickhouse (#4592) 2025-10-20 19:07:23 +02:00
aecsocket
24bec6baba Fix MaxMind (#4590) 2025-10-20 15:58:31 +00:00
François-Xavier Talbot
8a30b7978d Support ctoken_ in PATCH subscription (#4578) 2025-10-20 10:03:20 +00:00
François-Xavier Talbot
4b17eb5d35 Gotenberg/PDF gen implementation (#4574)
* Gotenberg/PDF gen implementation

* Security, PDF type enum, propagate client

* chore: query cache, clippy, fmt

* clippy fixes + tombi

* Update env example, add GOTENBERG_CALLBACK_URL

* Remove test code

* Fix .env, docker-compose

* Update purpose of payment

* Add internal networking guards to gotenberg webhooks

* Fix error

* Fix lint
2025-10-19 23:56:26 +00:00
François-Xavier Talbot
7796273529 Clearer error on TIN mismatch (#4579)
* Clearer error on TIN mismatch

* Remove ctoken code (how did that end up there)

* polish: frontend for TIN/SSN mismatch

* fix: lint

* polish: only banner + change text

* fix: logic

* fix: lint

---------

Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
2025-10-19 21:03:21 +00:00
Michael H.
752f68124c fix: sync debian version with rust image 2025-10-19 18:11:41 +02:00
aecsocket
fa7d1d7942 Use new MaxMind env vars on Labrinth (#4573)
* Bring in modrinth-maxmind

* integrate modrinth-maxmind into labrinth

* Fix CI
2025-10-18 18:38:19 +00:00
François-Xavier Talbot
5db5bf4c4c Changes to handling of refunds in Anrok (#4556)
* Use negations, track transaction version/accounting time, use original charge accounting time in refunds

* query cache

* chore: query cache, clippy, fmt

* Fix tax drift calculation

* Fix migration

* Increase update_tax_transactions rate
2025-10-17 15:57:36 +00:00
Josiah Glosson
b23d3e674f Update Rust & Java dependencies (#4540)
* Update Java dependencies

* Baselint lint fixes

* Update Rust version

* Update actix-files 0.6.6 -> 0.6.8

* Update actix-http 3.11.0 -> 3.11.2

* Update actix-rt 2.10.0 -> 2.11.0

* Update async_zip 0.0.17 -> 0.0.18

* Update async-compression 0.4.27 -> 0.4.32

* Update async-trait 0.1.88 -> 0.1.89

* Update async-tungstenite 0.30.0 -> 0.31.0

* Update const_format 0.2.34 -> 0.2.35

* Update bitflags 2.9.1 -> 2.9.4

* Update bytemuck 1.23.1 -> 1.24.0

* Update typed-path 0.11.0 -> 0.12.0

* Update chrono 0.4.41 -> 0.4.42

* Update cidre 0.11.2 -> 0.11.3

* Update clap 4.5.43 -> 4.5.48

* Update data-url 0.3.1 -> 0.3.2

* Update discord-rich-presence 0.2.5 -> 1.0.0

* Update enumset 1.1.7 -> 1.1.10

* Update flate2 1.1.2 -> 1.1.4

* Update hyper 1.6.0 -> 1.7.0

* Update hyper-util 0.1.16 -> 0.1.17

* Update iana-time-zone 0.1.63 -> 0.1.64

* Update image 0.25.6 -> 0.25.8

* Update indexmap 2.10.0 -> 2.11.4

* Update json-patch 4.0.0 -> 4.1.0

* Update meilisearch-sdk 0.29.1 -> 0.30.0

* Update clickhouse 0.13.3 -> 0.14.0

* Fix some prettier things

* Update lettre 0.11.18 -> 0.11.19

* Update phf 0.12.1 -> 0.13.1

* Update png 0.17.16 -> 0.18.0

* Update quick-xml 0.38.1 -> 0.38.3

* Update redis 0.32.4 -> 0.32.7

* Update regex 1.11.1 -> 1.11.3

* Update reqwest 0.12.22 -> 0.12.23

* Update rust_decimal 1.37.2 -> 1.38.0

* Update rust-s3 0.35.1 -> 0.37.0

* Update serde 1.0.219 -> 1.0.228

* Update serde_bytes 0.11.17 -> 0.11.19

* Update serde_json 1.0.142 -> 1.0.145

* Update serde_with 3.14.0 -> 3.15.0

* Update sentry 0.42.0 -> 0.45.0 and sentry-actix 0.42.0 -> 0.45.0

* Update spdx 0.10.9 -> 0.12.0

* Update sysinfo 0.36.1 -> 0.37.2

* Update tauri 2.7.0 -> 2.8.5

* Update tauri-build 2.3.1 -> 2.4.1

* Update tauri-plugin-deep-link 2.4.1 -> 2.4.3

* Update tauri-plugin-dialog 2.3.2 -> 2.4.0

* Update tauri-plugin-http 2.5.1 -> 2.5.2

* Update tauri-plugin-opener 2.4.0 -> 2.5.0

* Update tauri-plugin-os 2.3.0 -> 2.3.1

* Update tauri-plugin-single-instance 2.3.2 -> 2.3.4

* Update tempfile 3.20.0 -> 3.23.0

* Update thiserror 2.0.12 -> 2.0.17

* Update tracing-subscriber 0.3.19 -> 0.3.20

* Update url 2.5.4 -> 2.5.7

* Update uuid 1.17.0 -> 1.18.1

* Update webp 0.3.0 -> 0.3.1

* Update whoami 1.6.0 -> 1.6.1

* Note that windows and windows-core can't be updated yet

* Update zbus 5.9.0 -> 5.11.0

* Update zip 4.3.0 -> 6.0.0

* Fix build

* Enforce rustls crypto provider

* Refresh Cargo.lock

* Update transitive dependencies

* Bump Gradle usage to Java 17

* Use ubuntu-latest consistently across workflows

* Fix lint

* Fix lint in Rust

* Update native-dialog 0.9.0 -> 0.9.2

* Update regex 1.11.3 -> 1.12.2

* Update reqwest 0.12.23 -> 0.12.24

* Update rust_decimal 1.38.0 -> 1.39.0

* Remaining lock-only updates

* chore: move TLS impl of some other dependencies to aws-lc-rs

The AWS bloatware "virus" expands by sheer force of widespread adoption
by the ecosystem... 🫣

* chore(fmt): run Tombi

---------

Co-authored-by: Alejandro González <me@alegon.dev>
2025-10-15 20:45:47 +00:00
Alejandro González
6dbd1e5236 fix(labrinth): make orgs with a single user and only approved projects visible to non-logged-in people (#4557)
I made a typo on PR https://github.com/modrinth/code/pull/4426 by making
the corresponding SQL query filter by projects with an unexisting
`public` status, instead of `approved`. During my testing, I used the
`archived` status, so I didn't notice it back then.
2025-10-15 18:16:44 +00:00
aecsocket
4cd8ccd319 Taplo and typos in CI, TOML cleanup (#4510)
* Taplo and typos in CI

* Clean up Cargo.toml files

* Fix CI

* Fix CI

* Run typos in CI

* Loosen typos a bit

* Fix typos

* Fix taplo

* Switch to Tombi

* Fix Tombi errors

* Remove unused typos config

* Tombi fmt

* Remove extraneous cargo fmt

* fix typos
2025-10-12 20:18:38 +00:00
François-Xavier Talbot
2a61916d1e Mark charges from stripe customers with no address as unresolvable (#4521) 2025-10-11 18:24:21 +00:00
aecsocket
e66b131a5d See available funds history and withdrawls in user payout history (#4537)
* Add GET /v3/payouts/history

* V3 backwards compat

* Sqlx prepare

* Include user ID in GET /v3/payout
2025-10-11 10:51:38 +00:00
François-Xavier Talbot
0c66fa3f12 Custom Emails (#4526)
* Dynamic email template

* Set lower cache expiry for templates

* Custom email route

* Fix subject line on custom emails

* chore: query cache, clippy, fmt

* Bugfixes

* Key-based caching on custom emails

* Sequentially process emails prone to causing cache stampede

* Fill variables in dynamic body + subject line

* Update apps/labrinth/src/queue/email/templates.rs

Co-authored-by: aecsocket <aecsocket@tutanota.com>
Signed-off-by: François-Xavier Talbot <108630700+fetchfern@users.noreply.github.com>

* Update apps/labrinth/src/queue/email/templates.rs

Co-authored-by: aecsocket <aecsocket@tutanota.com>
Signed-off-by: François-Xavier Talbot <108630700+fetchfern@users.noreply.github.com>

---------

Signed-off-by: François-Xavier Talbot <108630700+fetchfern@users.noreply.github.com>
Co-authored-by: aecsocket <aecsocket@tutanota.com>
2025-10-10 16:30:38 +00:00
aecsocket
aec49cff7c Include both analytics v1 and v2 in tree (#4527)
* Include both analytics v1 and v2 in tree

* fix sqlx cache

* fix tests
2025-10-10 14:58:19 +00:00
Prospector
e9735bd9ba Revert "Analytics backend V2 (#4408)" (#4524)
This reverts commit 6919c8dea9.
2025-10-08 19:01:32 +00:00
Alejandro González
15a7815ec3 perf(Dockerfile): improve Docker cache mounts usage (#4507)
As described in
https://hackmd.io/jgkoQ24YRW6i0xWd73S64A#Using-Docker-cache-mounts,
cache mounts need to be used with a fairly specific syntax for caching
of previously build Rust artifacts to be as effective as it can be.
2025-10-08 16:03:15 +00:00
aecsocket
6919c8dea9 Analytics backend V2 (#4408)
* start with analytics v2

* the big ass SQL query™

* downloads and views analytics working

* Implement analytics bucketing API

* allow filtering by monetization

* Use a new format for project metrics and bucketing

* revenue API works

* Add country data to analytics API

* Add checks for number of slices and time slice resolution

* work on docs

* wip: fix tests and add docs

* Fix tests

* Fix tests

* Uncomment crates

* feat: frontend CLAUDE.md (#4433)

* Slight tweaks to time slicing logic

* More tweaks

* Fix error messages

* Fix sqlx cache

---------

Co-authored-by: Calum H. <contact@cal.engineer>
2025-10-07 22:01:10 +00:00
François-Xavier Talbot
9589e23118 Link customer ID to Anrok transaction (#4509)
* Mark transactions with unresolvable addresses as unresolved

* Add customer_name + customer_id to anrok transactions

* Increase rate of Anrok syn

* Remove timer from update_tax_transactions

* chore: query cache, clippy, fmt
2025-10-06 16:06:57 +00:00
aecsocket
e303655727 Fix using a private serde_with re-export (#4489) 2025-10-04 18:10:42 +00:00
Alejandro González
ab6e9dd5d7 fix(app-lib, labrinth): stricter mrpack file path validation (#4482)
* fix(app-lib, labrinth): stricter mrpack file path validation

* chore: run `cargo fmt`

* tweak: reject reserved Windows device names in mrpacks too
2025-10-04 10:35:30 +00:00
François-Xavier Talbot
a13647b9e2 Negate refund amount (#4481) 2025-10-03 23:29:22 +00:00
aecsocket
2af7ecc077 Fix affiliate PUT API (#4456)
* Fix affiliate PUT API

* PR fixes

* wip: merge affiliate code endpoints
2025-10-03 14:24:15 +00:00
François-Xavier Talbot
bea0ba017c Fix interactive payments in non-USD currencies (#4476)
* Use price's currency rather than inferred stripe currency in PaymentIntent

* Correctly convert to stripe::Currency

* Include original currency code in error message
2025-10-03 13:26:06 +00:00
Emma Alexia
f874856452 Fix user deletion with new notifications_deliveries table for real (#4473)
Maybe this will work? I dunno but users are still saying they're getting errors deleting accs. In theory it shouldn't matter if the transaction all gets committed at the same time, though, right? I can't really test this so I would like someone to tell me whether this will actually make a difference.

Co-authored-by: François-X. T <fetch@ferrous.ch>
2025-10-03 13:03:02 +00:00
aecsocket
b96c5cd5ab Improve error logging and observability (#4443)
* Replace actix tracing with custom error tracing

* Fix logging

* wip: JSON logging

* Use LABRINTH_FORMAT to change to JSON output

* sqlx fix?

* CI fix

* Add tracing span info to HTTP requests

* Merge Result and Option error wrapping

* Add http.authorized to tracing
2025-10-03 13:02:20 +00:00
François-Xavier Talbot
7e84659249 Cleanup + fixes to index_billing/index_subscriptions (#4457)
* Parse refunds

* Cleanup index subscriptions/index billing

* chore: query cache, clippy, fmt
2025-10-03 13:01:52 +00:00
François-Xavier Talbot
9315af9b20 Only skip attaching payment method when using ctoken (#4460) 2025-09-30 18:41:17 -07:00
François-Xavier Talbot
beb1bdb31f Skip synchronizing transactions to Anrok if missing payment intent ID (#4446)
* Skip succeeded txns with no payment platform ID

* chore: query cache, clippy, fmt
2025-09-30 14:36:41 +00:00
Alejandro González
895b040ad7 fix(labrinth): hide hidden orgs from user profiles (#4452)
This is a follow-up to PR #4426. I initially didn't consider the
organizations an user belongs to as worth hiding, but given that user
profiles can be public, I suppose there technically is a way to exploit
them for SEO abuse. Overall, it also seems more consistent to hide them
here too.
2025-09-30 14:30:44 +00:00
François-Xavier Talbot
54747aa628 Tweaks and fixes to background tasks (#4447)
* adjustments

* chore: query cache, clippy, fmt
2025-09-30 11:43:59 +00:00
Emma Alexia
324ad65d7c Fix user deletion with new notification_deliveries table (#4437) 2025-09-29 18:04:22 +00:00
Josiah Glosson
a538b99c18 Reworked app update flow (#3960)
* Make theseus capable of logging messages from the `log` crate

* Move update checking entirely into JS and open a modal if an update is available

* Fix formatjs on Windows and run formatjs

* Add in the buttons and body

* Fix lint

* Show update size in modal

* Fix update not being rechecked if the update modal was directly dismissed

* Slight UI tweaks

* Fix lint

* Implement skipping the update

* Implement the Update Now button

* Implement updating at next exit

* Turn download progress into an error bar on failure

* Restore 5 minute update check instead of 30 seconds

* Fix PendingUpdateData being seen as a unit struct

* Fix lint

* Make CI also lint updater code

* feat: create AppearingProgressBar component

* feat: polish update available modal

* feat: add error handling

* Open changelog with tauri-plugin-opener

* Run intl:extract

* Update completion toasts (#3978)

* Use single LAUNCHER_USER_AGENT constant for all user agents

* Fix build on Mac

* Request the update size with HEAD instead of GET

* UI tweaks

* lint

* Fix lint

* fix: hide modal header & add "Hide update reminder" button w/ tooltip

* Run intl:extract

* fix: lint issues

* fix: merge issues

* notifications.js no longer exists

* Add metered network checking

* Add a timeout to macOS is_network_metered

* Fix tauri.conf.json

* vibe debugging

* Set a dispatch queue

* Have a popup that asks you if you'd like to disable automatic file downloads if you're on a metered network

* Move UpdateModal to modal package

* Fix lint

* Add a toggle for automatic downloads

* Fix type

Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Signed-off-by: Josiah Glosson <soujournme@gmail.com>

* Redo updating UI and experience

* lint

* fix unlistener issue

* remove unneeded translation keys

* Fix expose issue

* temp disable cranelift, tweak some messages

* change version back

* Clean up App.vue

* move toast to top right

* update reload icon

* Fixed the bug!!!!!!!!!!!!

* improve messages

* intl:extract

* Add liquid glass icon file

* not you!

* use dependency injection

* lint on apple icon

* Fix imports, move download size to button

* change update check back to 5 mins

* lint + move to providers

* intl:extract

---------

Signed-off-by: Cal H. <hendersoncal117@gmail.com>
Signed-off-by: Josiah Glosson <soujournme@gmail.com>
Co-authored-by: Calum <calum@modrinth.com>
Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: Cal H. <hendersoncal117@gmail.com>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
2025-09-29 15:28:31 +00:00
François-Xavier Talbot
b4eba5a0d5 Tax fixes (#4435)
* Only update the PaymentMethod ID if not using placeholder ID

* comment

* Create Anrok transactions for all charges

* Fix comment

* Prefer using payment method's address rather than customer address

* chore: query cache, clippy, fmt

* Retrieve stripe address from PM

* chore: query cache, clippy, fmt

* fmt

* bring back the query cache

* Better address retrieval for updating tax amounts, always update tax_last_updated

* chore: query cache, clippy, fmt

* Don't set PM in ctoken interactive session for new PIs
2025-09-28 21:13:48 +00:00
aecsocket
f466470d06 Hard caps on creating projects/orgs/collections (#4430)
* implement backend limits on project creation

* implement collection, org creation hard caps

* Fix limit api

* Fix clippy

* Fix limits

* Update sqlx queries

* Address PR comments on user limit structure

* sqlx prepare and clippy

* fix test maybe
2025-09-28 10:01:00 +00:00
François-Xavier Talbot
3f55711f9e More billing fixes (#4431)
* Only update the PaymentMethod ID if not using placeholder ID

* comment

* Create Anrok transactions for all charges

* Fix comment

* Prefer using payment method's address rather than customer address

* chore: query cache, clippy, fmt

* Retrieve stripe address from PM

* chore: query cache, clippy, fmt

* fmt

* bring back the query cache
2025-09-27 22:37:30 +00:00
Alejandro González
bb9ce52c9d feat(labrinth): hide orgs without a purpose, re-enable organization creation (#4426)
* chore(labrinth): set `DELPHI_URL` to a valid default in `.env.local`

* feat(labrinth): make orgs not publicly visible until they meet some conditions

* Revert "Org disabled frontend (#4424)"

This reverts commit 2492b11ec0.

* changelog: update for re-enabling organization creation

* chore: run `sqlx prepare`

* chore(labrinth): tweak tests to work with new org changes

* tweak: apply @triphora's suggestion

Co-authored-by: Emma Alexia <emma@modrinth.com>
Signed-off-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>

* tweak: document `is_visible_organization` relationship with `Project#is_searchable`

---------

Signed-off-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Co-authored-by: Emma Alexia <emma@modrinth.com>
2025-09-26 15:42:53 +00:00
François-Xavier Talbot
14af3d0763 Billing fixes (#4422)
* Only update the PaymentMethod ID if not using placeholder ID

* comment

* Create Anrok transactions for all charges

* Fix comment

* Prefer using payment method's address rather than customer address

* chore: query cache, clippy, fmt
2025-09-26 15:39:47 +00:00
François-Xavier Talbot
4228a193e9 Charge tax on products (#4361)
* Initial Anrok integration

* Query cache, fmt, clippy

* Fmt

* Use payment intent function in edit_subscription

* Attach Anrok client, use payments in index_billing

* Integrate Anrok with refunds

* Bug fixes

* More bugfixes

* Fix resubscriptions

* Medal promotion bugfixes

* Use stripe metadata constants everywhere

* Pre-fill values in products_tax_identifiers

* Cleanup billing route module

* Cleanup

* Email notification for tax charge

* Don't charge tax on users which haven't been notified of tax change

* Fix taxnotification.amount templates

* Update .env.docker-compose

* Update .env.local

* Clippy

* Fmt

* Query cache

* Periodically update tax amount on upcoming charges

* Fix queries

* Skip indexing tax amount on charges if no charges to process

* chore: query cache, clippy, fmt

* Fix a lot of things

* Remove test code

* chore: query cache, clippy, fmt

* Fix money formatting

* Fix conflicts

* Extra documentation, handle tax association properly

* Track loss in tax drift

* chore: query cache, clippy, fmt

* Add subscription.id variable

* chore: query cache, clippy, fmt

* chore: query cache, clippy, fmt
2025-09-25 11:29:29 +00:00
François-Xavier Talbot
47020f34b6 Tax compliance adjustments (#4414)
* tax compliance adjustments

* chore: query cache, clippy, fmt
2025-09-25 11:02:33 +00:00
François-Xavier Talbot
e6edf07eae Fill variables for subject line (#4415) 2025-09-24 10:52:43 +00:00