mirror of
https://github.com/modrinth/code.git
synced 2026-08-26 09:34:50 +00:00
* Begin external projects moderator database frontend * add copy link button * begin project page permissions settings * MEL database backend routes * include filename in external files * wip: when uploading a version file, fetch its overrides as a list * wip: override license checks * improve FileHost ref counting * file host read capability * scan files when inserting version file * add dependency sha1 field * clean up version files * wip: attributions * update s3 file host * attribution scanning basic works * works * insert attribution info after resolving * add routes * remove dep sha1 stuff * prepr * wip: override file sources * add files_missing_attributions to versions * return extended version info + attributed at/by * hook up frontend to backend (mostly) * expose version date published * withholding version visibility * frontend work * prepr * use api-client for img upload * moar frontend * prepr * Add schema to attribution resolution and Flame project results * sqlx prepare * changes * remove feature flag, fix optional proof images * fix schema * fmt * fix deletion and file fetch * prepare * fix admonition * update frontend stuff to new schema * prepr * attribution on dependencies * fixes * sqlx prepare * fixes * routes * fix routes * Version grandfathering * prepare * wip: bulk routes * pushing what i've got rn * include link in NoPermission * change hash insert to bulk route * query flame even if entry in MEL * delete file with weird name * Prioritise putting override files in existing groups even with ExternalLicense * fix how hex bytes are handled in route * feat: coolbot moderation changes (#6215) * Update moderator checklist * move permissions stage order * Updated nagContext.versions to v3, added nag for permissions * Update permissions.vue default messages * prepr --------- Co-authored-by: coolbot100s <76798835+coolbot100s@users.noreply.github.com> * QA * prepr * should group by project * return attribution resolution correctly * updated by moderator info * Track what moderator reviewed an attribution moderation status * default deser FMA field * new version page * clean up fetching + add a couple missing features * qa items * prepr * provide moderation package stuff with DI * format? * don't redact moderated_at * move supplementary resources * Reorganize moderation messages. * Quick replies for external content permissions. * prepare * QA * allow exempting projects * Ignore Flame projects which 404 * fix ci * fix cross project attribution stuff * Fix permission error * change what files get cscanned * add more logging * QA Jun 22 * fix * idempotency * Expose route for rescanning * update blog link --------- Co-authored-by: aecsocket <aecsocket@tutanota.com> Co-authored-by: coolbot100s <76798835+coolbot100s@users.noreply.github.com> Co-authored-by: aecsocket <43144841+aecsocket@users.noreply.github.com>
35 lines
2.5 KiB
Markdown
35 lines
2.5 KiB
Markdown
- Use `ApiError` as the error type for API routes
|
|
- The return type of an HTTP route should not be `HttpResponse` if possible; always prefer more specific types
|
|
- Use `web::Json<T>` for JSON-encoded response
|
|
- Use `()` for no content
|
|
- Prefer `ApiError` variants:
|
|
- `ApiError::Request` instead of `ApiError::InvalidInput`
|
|
- `ApiError::Auth` instead of `ApiError::CustomAuthentication`
|
|
- `ApiError::Internal` for database errors, 3rd party service errors, anything else internal
|
|
- Use `eyre!` to construct a value for `Internal`, `Request`, and `Auth` variants
|
|
- Error messages (both for errors and exceptions) must be formatted as per the Rust API guidelines:
|
|
- lowercase message
|
|
- no trailing punctuation
|
|
- wrap code items e.g. type names in backticks
|
|
- Prefer `wrap_internal_err`, `wrap_request_err` when attaching context to an existing error (like Anyhow `context` or Eyre `wrap_err`)
|
|
- All operations should ideally have some context attached
|
|
- Database operations can have a message like `.wrap_internal_err("failed to fetch XYZ")`
|
|
- You can perform real-time queries against the databases in the Docker Compose
|
|
- `docker exec labrinth-postgres psql -c "select 1"`
|
|
- `docker exec labrinth-redis redis-cli flushall`
|
|
- `docker exec labrinth-clickhouse clickhouse-client "select 1"`
|
|
- On some machines, you may have to use `podman` instead of `docker` - check which one is available first
|
|
- Hardcoded credentials for admin:
|
|
- `Authorization: Bearer mra_admin` for default admin user
|
|
- `Authorization: Bearer mra_user` for a regular user
|
|
- `Modrinth-Admin: feedbeef` as admin key
|
|
- If some steps require you to create a project/mod or version for testing, ask the user to go into the web frontend and manually create a project/version
|
|
- When using `sqlx::query` etc. always use the macro form like `sqlx::query!` or `sqlx::query_scalar!` - never the plain function form. Avoid using `query_as!`.
|
|
- Do not run `cargo test`, even for a single specific test, unless explicitly prompted to by the user, since it takes a long time to run.
|
|
- You can force a search reindex by:
|
|
- Running `cd apps/labrinth && cargo run -p labrinth -- --run-background-task index-search` (prefer this if backend is running locally)
|
|
- Hitting the force reindex admin endpoint
|
|
- To seed the database locally: `psql postgresql://labrinth:labrinth@localhost/labrinth -f apps/labrinth/fixtures/labrinth-seed-data-202508052143.sql
|
|
`
|
|
- When writing `sqlx` queries, prefer `r#` raw strings over escaping quotes
|