109 Commits

Author SHA1 Message Date
Geometrically
5c8ffe961e
Fix local indexing (#78) 2020-10-16 11:21:07 -07:00
Aeledfyr
7983e82b60
Fix some issues with search and mod creation (#77) 2020-10-16 10:04:38 -07:00
Geometrically
77d35b61a9
Fix indexing (#76) 2020-10-15 09:56:41 -07:00
Geometrically
285a97aaf8
Creation fix (#74)
* Lots of little fixes

* Change + Add TODOs back that were incomplete

* Fix migrations

* Run prepare

* Minor fixes

* Fix formatting

* SQLX Prepare

* Add status to creation query
2020-10-14 20:43:40 -07:00
Geometrically
ad29f2477e
Lots of little fixes (#73)
* Lots of little fixes

* Change + Add TODOs back that were incomplete

* Fix migrations

* Run prepare

* Minor fixes

* Fix formatting

* SQLX Prepare
2020-10-14 13:19:38 -07:00
Aeledfyr
1072d1306b
Make indexing date format consistent (#72) 2020-10-12 14:08:43 -07:00
Geometrically
b8eda40937
Fix date format (#71) 2020-10-11 11:35:50 -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
Geometrically
68ee2bdcdc
Fix another GitHub OAuth Bug, allow users to register with null names. (#69)
* Change header name

* Add default bio value

* Remove default

* Make name null

* Run prepare
2020-10-03 16:31:10 -07:00
Geometrically
da654fdff5
Add default bio value, to fix GitHub integration errors (#68)
* Change header name

* Add default bio value

* Remove default
2020-10-03 12:11:36 -07:00
Geometrically
d7f9d5a66f
Change header name (#67) 2020-10-02 15:55:47 -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
Geometrically
43a791db65
Merge pull request #64 from modrinth/auth-fix
Make scopes safe for browser
2020-09-29 12:56:58 -07:00
Jai A
217311211a
Remove org read scope 2020-09-29 11:55:12 -07:00
Jai A
ca55890ad2
Make scopes safe for browser 2020-09-29 11:46:11 -07:00
Geometrically
d6ecf5b8a9
Merge pull request #63 from modrinth/ghauth
GitHub Authentication
2020-09-29 11:27:56 -07:00
Jai A
e52edde11f Run prepare scripts 2020-09-29 07:36:28 -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
05235f8385 Implement users in API 2020-09-28 10:48:15 -07:00
Jai A
cd28a75c86 Authentication workflow complete, add database link 2020-09-27 22:49:38 -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
e8bbc117e1
Allow for API user to change the amount of mods responded with in search (#61)
* Add more info to search route:

* Run formatter

* Allow for API user to change the amount of mods responded with in search

* Refactor SearchResults

* Fix searchresults usage
2020-09-07 11:44:21 -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
3da0c07bcd
fix: Fixed ssl error with the docker container. (#58) 2020-08-29 20:24:15 +02:00
Redblueflame
2196b53075
Switched base container for the docker build (#57) 2020-08-29 07:56:50 -07:00
Redblueflame
a8340f37bb
Update Dockerfile (#56)
* Update Dockerfile

* Update Dockerfile
2020-08-28 12:03:00 -07:00
Redblueflame
7b1710ee63
Update Dockerfile (#55) 2020-08-28 20:24:43 +02: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
AppleTheGolden
7e2f1c9a8b
Update rust version in dockerfile (#49) 2020-08-02 09:48:02 -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
Charalampos Fanoulis
7914e89212
fix: quote the numbers on the github label (#43) 2020-07-23 23:26:53 +02:00
Valentin Ricard
558ff90e27
fix/ci: Fix build matrix (#42)
* ci: Test #1

* ci: Test #2

* ci: Fix an unrelated issue

* ci: Restore the branch filter
2020-07-23 23:18:36 +02: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
b1d3e258bd
fix(indexing): chunk adding documents to indexing server (#36)
This should prevent adding too many mods and going over
meilisearch's request size limit by attempting to add all mods in
one request.
2020-07-15 15:01:49 -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
Aeledfyr
6d16b68f11
Create schema for the API (#28)
* feat(schema): add basic structs for schema

* feat(schema): implement base62 id parsing

* docs(schema): add documentation for schema structs
fix(schema): prevent integer overflow in base62 decoding

* refactor(schema): move ids into submodules, reexport from ids mod

* feat(schema): add random generation of base62 ids
style: run rustfmt
2020-07-01 22:24:42 +02:00
Charalampos Fanoulis
f22e4f1cc7
feat: Add label syncing. (#30)
* ci: Add label syncing

* ci: add more label sprinkles
2020-07-01 11:32:23 -07:00
MulverineX
2851d12357
readme edits (#29)
* Update README.md

* Update README.md
2020-07-01 08:43:44 +02:00