59 Commits

Author SHA1 Message Date
AppleTheGolden
951a33fae9
Add Sentry integration 2021-01-27 14:38:18 +01:00
Geometrically
ec3c31a106
Move descriptions to database, switch to SHA-512 hashes, fix declining invites not working, allow user deletion, fix broken permission checks for many things, security fixes 2021-01-14 10:08:38 -07:00
Geometrically
a40b9f4054
Fix clippy error (?) 2021-01-01 09:13:27 -07:00
Geometrically
b8d2ef1eb5
Fix SQLX errors 2020-12-31 19:09:23 -07:00
Geometrically
0efeffeaa3
Bump ratelimit to 200 RPM, allow specified IPs to have lax ratelimit restrictions, and allow wildcard for CORS 2020-12-31 18:54:58 -07:00
Geometrically
fd33ff81c9
Fix description cache 2020-12-29 21:49:01 -07:00
Geometrically
f0b73fd696
Change index interval, add slug to search documents (#110)
* Change index interval, add slug to search documents

* Allow the removal of '@' for slug get

* Fix

* Remove name and rename side type

* Run prepare
2020-12-13 18:10:58 -07:00
Geometrically
df5684a9f8
Fix access controls (#109)
* Fix access controls

* Remove CF indexing, fix some stuff
2020-12-02 10:24:20 -07:00
Aeledfyr
b3f724c799
Hotfix: fix version delete permissions and CORS allowed methods (#107) 2020-11-30 10:45:59 -07:00
Geometrically
a7be6504a2
Fix hash (#106)
* More mod info

* Downloading mods

* Run prepare

* User editing + icon editing

* Finish

* Some fixes

* Fix clippy errors

* Fix hash lookup

* Run prepare

* Run formatter
2020-11-29 14:27:40 -07:00
Geometrically
1da5357df6
More mod info (#104)
* More mod info

* Downloading mods

* Run prepare

* User editing + icon editing

* Finish

* Some fixes

* Fix clippy errors
2020-11-27 10:57:04 -07:00
Aeledfyr
92e1847c59
Hotfix: route new moderation routes (#103) 2020-11-15 20:47:45 -07:00
Aeledfyr
c8e58a1e5b
Fix indexing, upgrade MeiliSearch sdk (#100)
* Hotfixes for indexing

* Handles missing INDEX_CACHE_PATH environment variable
* Exits on startup if environment variables are missing. The flag
  --allow-missing-vars disables this, but that is generally a bad
  idea, since most environment variables are required (and the ones
  that aren't should be marked as such).
* Disables the query loggers

* Upgrade meilisearch-sdk to 0.4.0 for MeiliSearch 0.16 support

* Fix swap of Forge and Fabric labeling
2020-11-05 08:38:03 -07:00
Aeledfyr
d477874535
Optimize and fix some bugs in indexing (#98)
* Improve curseforge and local indexing

This should make curseforge indexing more efficient, and reuses
some of the normal local indexing for the queued indexing of
recently created mods.

* Unify impls for single and multiple routes for mods and versions

This uses the same backend for the single and multiple query
routes so that they no longer return inconsistent information.

* Cache valid curseforge mod ids to reduce request load

This caches the ids of minecraft mods and reuses them on indexing
to reduce the amount of unused addons that are returned.
2020-11-03 17:55:50 -07:00
Aeledfyr
a4ba6d1444
Game Version types, indexing, and bugfixes (#91)
* Add types to game_versions, allow filtering by version type

- Fixes an issue with version numbers in the initial mod indexing
  queue
- Modifies the /api/v1/categories/game_versions route to take an
  optional query parameter `type` to filter the listed game versions
- Creating tags is now idempotent
- Creating game_versions now requires a JSON body that specifies
  the version type

* Implement automatic indexing of new Minecraft versions

It's currently set to run every 6 hours and isn't configurable; we
could add config for it, but it doesn't seem likely to be rate
limited or have issues with frequency.
2020-10-28 09:11:49 -07:00
Geometrically
ef28459b61
Rate limiting + version fixes (#90)
* Rate limiting + version fixes

* Move patch to proper place

* More fixes

* Fix commit hash pin
2020-10-25 13:51:07 -07:00
Geometrically
1ff8c908b8
Add way to fetch team members (#89)
* Add way to fetch team members, fix files not being returned with version route

* Make it compile

* Fixes

* Use default error handling
2020-10-21 12:30:35 -07:00
Geometrically
c886e7949e
Support for using a master key (#83)
* Support for using a master key

* Expand scope of PR, add wrapper struct, add files to intitial versions/mods

* Change changelog path, run formatter

* Split file changes into different PR

* Formatting, rename main variable

Co-authored-by: Aeledfyr <aeledfyr@gmail.com>
2020-10-19 14:23:05 -07:00
Geometrically
e0b972f6d6
Add S3 File Host (#81)
* Add S3 File Host

* Fix tests, set default ACL level to public

* Refactor

* Fix merge conflicts

* Env fixes

* Run formatter

* Remove extra allocations
2020-10-18 13:26:13 -07:00
Aeledfyr
25daa9f2da
Update actix-web to 3.0, update deps (#82) 2020-10-18 10:50:37 -07:00
Geometrically
2719ae5df2
Add API routes to request multiple of an item (#70)
* Change header name

* Add default bio value

* Remove default

* Make name null

* Run prepare

* Add new API Routes for requesting multiple of an item

* Run formatter

* Simplify get mods query

* Run prepare

* Refactor to use one query for most routes, change version create route to have mod_id in data

* More fixes
2020-10-05 14:25:32 -07:00
Aeledfyr
c4fb7b7928
General cleanup: fix some bugs, some refactoring (#65)
* Merged mod file upload in version creation, mod creation and
  version file add to one function;  This makes sure that they are
  consistent
* Made some fields on `User` optional: `github_id`, `avatar_url`, `bio`.
    * We may not want to publicly show the `github_id` to everyone
      with access to the API
    * If we allow non-github users, some of those fields would be
      invalid; some oauth providers may not have avatars or bios
* Made CORS origins should configurable
* Made `--reconfigure-indices` and `--reset-indices` exit after
  completion instead of starting the server
2020-09-30 22:07:52 -07:00
Jai A
2e514735ec User retrieval routes 2020-09-28 22:30:13 -07:00
Jai A
3d32c30d2d Authenticate protected routes 2020-09-28 21:05:42 -07:00
Jai A
34075738ea Basic GitHub integration 2020-09-26 22:49:16 -07:00
Geometrically
88c0b8a8f0
Search fixes (#62) 2020-09-12 18:16:05 -07:00
Geometrically
b99f45874f
Add more info to search route (#60)
* Add more info to search route:

* Run formatter
2020-09-06 08:19:53 -07:00
Geometrically
0dfa378e38
Add modrinth.com to CORS (#59)
Co-authored-by: Redblueflame <redblueflame1@gmail.Com>
2020-09-02 08:24:42 -07:00
Redblueflame
38b7d9724e
feat(migration): Added automatic migration (#54) 2020-08-28 08:48:01 -07:00
Geometrically
2b1ed49e9a
Update Meilisearch SDK (#53)
* Update Meilisearch SDK

* Run Formatter

* Fixes
2020-08-27 17:53:40 -07:00
Geometrically
017cf9e464
Make CORS work (#52)
* Make CORS work

* Add use statement

* Add to TOML
2020-08-27 08:47:18 -07:00
Aeledfyr
781f0c843e
Implement more database methods and basic API routes (#50)
* feat: Implement more database methods & add mod and version routes

* feat: Implement deleting mods/versions & implement categories

* feat: Implement routes for categories, game versions & loaders

* feat: Reorganize API routes in a (hopefully) usable way
2020-08-12 12:54:03 -07:00
Geometrically
e2bf474332
Version Creation (#47)
* Creation Stuff

* Make it work

* Response structs + Mod ID validation

* Run code formatter

* Push local changes

* Finish up version creation - fix comments, impl file creation

* fix: Add sqlx prepare data

Co-authored-by: Aeledfyr <aeledfyr@gmail.com>
2020-08-12 11:05:49 -07:00
Aeledfyr
8e798dde48
feat(search): Faceted search based on mod host (curse/modrinth) (#48)
This also adds a commandline argument library (gumdrop) for dealing
with indices - reseting, reconfiguring, and skipping them. I don't
know which library is best for this case, but gumdrop has shorter
compile times and many fewer dependencies than clap, which is why
I chose it.
2020-07-31 18:18:23 -07:00
Aeledfyr
c05ae6e94c
fix(postgres): Fix sqlx's misinterpretation of Ids, update sqlx (#46) 2020-07-30 20:45:22 -07:00
Aeledfyr
ff28ea8fa8
Refactor Meilisearch, update to latest SDK, and implement faceted search (#44)
* feat(indexing): Reindex curseforge & local database at an interval

* fix(indexing): Use strings for meilisearch primary key

Fixes #17 by prefixing curseforge ids with "curse-" and local ids
with "local-".

* feat(indexing): Add newly created mods to the index more quickly

* feat(indexing): Implement faceted search, update to meilisearch master

Fixes #9, but only uses faceted search for categories.  It should
be reasonably simple to add support for versions, but it may not
be as useful due to the large number of versions and the large
number of supported versions for each mod.

* feat(indexing): Allow skipping initial indexing

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2020-07-27 16:54:10 -07:00
AppleTheGolden
ee69653a83
Switch to Postgres (#39)
* WIP Switch to Postgres

* feat(postgres): more work on porting to postgres, now compiles

* feat(docker-compose): Changed the docker-compose.yml file to use postgres.

* Update docker, documentation, gh actions...

* Remove bson dependency

* Remove bson import

* feat: move mock filehost to trait rather than cargo feature

* feat(postgres): transactions for mod creation, multipart refactor

* fix: Add Cargo.lock so that sqlx functions

* Update sqlx offline build data

* fix: Use SQLX_OFFLINE to force sqlx into offline mode for CI

* Default release channels

* feat(postgres): refactor database models to fit postgres models

* fix: Fix sqlx prepare, fix double allocation in indexing

* Add dockerfile (#40)

Co-authored-by: Charalampos Fanoulis <charalampos.fanoulis@gmail.com>

Co-authored-by: Aeledfyr <aeledfyr@gmail.com>
Co-authored-by: redblueflame <contact@redblueflame.com>
Co-authored-by: Jai A <jai.a@tuta.io>
Co-authored-by: Valentin Ricard <redblueflame1@gmail.Com>
Co-authored-by: Charalampos Fanoulis <charalampos.fanoulis@gmail.com>
2020-07-23 22:46:33 +02:00
Aeledfyr
95339a8338
Create a mock file host for dev, Fix mod creation route (#38)
* fix(mod-creation): fix actix server data & mod creation route

* feat(file-host): implement mock file hosting

This implements a mock file hosting system backed by the system's
filesystem.  It mirrors the API of the backblaze integration, but
puts the files directly on disk in the path specified by the
MOCK_FILE_PATH environment variable (defaults to /tmp/modrinth).

The mock file hosting is enabled by default using cargo features
to allow people to work on modrinth without access to a valid
backblaze account and setup.  To enable backblaze, specify the
cargo feature "backblaze" when running, ex. `cargo run --features
backblaze`.

* feat(file-hosting): implement basic backblaze API error handling

* fix(mod-creation): fix extension parsing, use base62 ids for paths
fix(file-hosting): reduce unnecessary allocations

* fix: fix auth with docker mongodb

* fix: fix failing checks

* fix: remove testing files
2020-07-16 21:06:58 -07:00
Geometrically
39b1435725
Mod Creation (#34)
* Inital creation stuff

* File Reader

* Upload bodies

* Major rework:

* Finish Multiple Files

* Proper Error Handling

* Switch to database models

* Run formatter

* Make dependencies dependent on Versions over mods

* Fixes

* Fix clippy

* Run lint one last time

* Update src/models/mods.rs

Co-authored-by: AppleTheGolden <scotsbox@protonmail.com>

Co-authored-by: AppleTheGolden <scotsbox@protonmail.com>
2020-07-16 10:16:35 -07:00
Aeledfyr
6ff7fa74e2
Improve error handling (#33)
* refactor: improve error handling

* fix: specify bind address instead of port

* fix: remove temporary testing file

* fix(errors): change error names to snake_case

* refactor(errors): split indexing error types, remove unused errors

* feat: add env variable checking at program start

This just checks whether the enviroment variables exist and can
parse to the given type and gives a warning if they can't. This
should prevent cases where the program fails at runtime due to
checking an environment variable that doesn't exist.
2020-07-03 10:44:39 -07:00
Geometrically
91305262f1
Add Backblaze Driver (#32)
* Backblaze Driver

* Update action to work with new tests

* Fix minor issues

* Run Formatter + Switch to reqwest json parser
2020-07-02 14:00:04 +02:00
Valentin Ricard
7a6ecd86c6
Rewrite the app (#23)
* chore: Removed everything not needed, and added base for rewrite
feat(error_handling): Added 404 general cache
feat(index): Added informations about the app in the / route.

* feat(indexing): Brought back the indexing, with conditions to make it easier

* fix: Fixed build error with a forgotten call

* feat: Add Docker development enviroment (#19)

* ci: add a *lot* of new actions

* fix: rename linting action

* fix: invalid yaml begone(?)

* ci: Added cache to speed up build times

* fix(ci): 🦀ed the yaml errors

* fix(ci): fixed a missing hyphen

* ci: Added matrix of rust versions, and changed way to install rust toolchain

* fix(ci): Added names to build with the matrix so it's easier to find the source of the problem

* style(ci): Added eof lines

* refactor: Finished moving the search.rs file to a separate module.

* Search Endpoint

* refactor: Moved around functions and struct for a better understanding of what it does.

* chore: Change env default settings to resolve conversation

* refactor: Removed #[use_macros]
fix: Fixed meilisearch address from env

* chore: Added email to Aeledfyr

* fix: Brought back the dotenv variables

* style: Ran `cargo fmt`

Co-authored-by: Charalampos Fanoulis <charalampos.fanoulis@gmail.com>
Co-authored-by: Jai A <jai.a@tuta.io>
2020-06-30 19:23:52 +02:00
Jai A
23503dc439 Base creation page 2020-06-22 21:04:17 -07:00
Jai A
906196bac3 Staging Test 2020-06-20 18:19:19 -07:00
Jai A
a47634bf49 Static content serving from non-root routes 2020-06-02 20:59:20 -07:00
Jai A
e03e58323b Cleanup + Database code 2020-06-02 12:03:45 -07:00
Jai A
d54500bad5 Sort Types 2020-05-30 16:53:56 -07:00
Jai A
b75a4667c2 Migrate to MongoDB 2020-05-28 13:28:58 -07:00
AppleTheGolden
91274267e5
Run rustfmt on everything 2020-05-27 20:51:28 +02:00
Jai A
1291f792ab Curseforge Indexer 2020-05-21 22:38:39 -07:00