2020-08-21 22:30:41 +08:00
# Hangar - Papers upcoming Plugin Repository
2020-07-08 23:19:41 +08:00
2021-04-06 03:25:17 +08:00
This is the repository for Hangar, a plugin repository used for Paper plugins and similar software.
2020-07-29 02:49:32 +08:00
2022-03-19 01:56:22 +08:00
Hangar is loosely based off of [Ore ](https://github.com/SpongePowered/Ore ), created by the Sponge project,
2021-04-06 03:25:17 +08:00
but rebuilt from the ground up using the Spring Boot Framework in Java for the backend and nuxt (and vuetify) for the frontend (which is partially server rendered).
2022-04-02 01:21:35 +08:00
We would like to thank all Ore contributors. Without them, this project would never have been possible.
2020-07-29 02:49:32 +08:00
2021-06-30 04:16:33 +08:00
There may or may not be a staging instance running at https://hangar.benndorf.dev
2020-07-29 02:49:32 +08:00
It may or may not allow you to log in, please don't create too much of a mess so that I don't always need to nuke the DB when I want to use it.
2021-03-13 00:35:32 +08:00
## Contributing
2021-04-01 12:02:11 +08:00
The project consists out of 4 parts
2022-03-19 01:56:22 +08:00
* Frontend (written in Vue vite-ssr via [vitesse ](https://github.com/antfu/vitesse ))
2021-04-01 12:02:11 +08:00
* Backend (Spring Boot)
* Database (PostgreSQL)
2022-04-02 01:21:35 +08:00
* User Management ([HangarAuth]; optional, see below)
2021-03-13 00:35:32 +08:00
2021-04-01 12:02:11 +08:00
There are two different environments that can be developed in, one using a fake user (aka without [HangarAuth]), or with [HangarAuth].
Most of the time you won't need to run Hangar with [HangarAuth] unless you are working with a feature that requires multiple user interactions.
2021-12-19 17:46:08 +08:00
## Fake User environment (recommended, easy, no [HangarAuth])
2021-04-06 03:25:17 +08:00
2021-03-13 00:35:32 +08:00
Fork the project and pull it in your IDE.
### Prerequisites
2021-04-01 12:02:11 +08:00
* Docker is required in order to run the PostgreSQL database.
2022-03-19 01:56:22 +08:00
* Java 17 or higher.
2021-04-01 12:02:11 +08:00
* [Yarn]
2021-03-13 00:35:32 +08:00
### Setting up
2022-04-02 01:21:35 +08:00
To get the project running locally, you need to follow a few steps:
1. To get the dummy database up and running, move to the docker folder `cd docker` then run `docker-compose -f dev-db.yml up -d` (`-d` as an optional parameter to run the containers in the background).
Alternatively, if you are using IntelliJ you can press the green arrow in the `docker/dev-db.yml` file.
2021-04-06 03:25:17 +08:00
2. Run the Spring Boot application. You can do it in the CLI with `mvn spring-boot:run` or if you're using IntelliJ, it's included in the run configurations.
2022-03-19 01:56:22 +08:00
3. Move to the `frontend` directory: `cd ../frontend` . In that directory, run `pnpm install` . This will install all the needed Node modules.
5. After the installation, run `pnpm run dev` in the frontend directory to initiate the build and launch. Changes you do to the frontend will be reloaded automatically.
2021-04-06 03:25:17 +08:00
6. After that browse to http://localhost:3000 and if all went well, Hangar should be up and running.
2021-03-13 00:35:32 +08:00
2021-04-01 12:02:11 +08:00
### Notes
* The Spring Boot configuration file that is used by this environment is located at `Hangar/src/main/resources/application.yml`
* The fake user settings are located in the application.yml file under `fake-user` .
2021-12-19 17:46:08 +08:00
## Hangar Auth (not recommended, complicated, requires like 6 more docker containers)
2021-04-01 12:02:11 +08:00
Fork this project and fork/clone [HangarAuth]. Ensure they are sibling directories in your file system.
```
Projects/
Hangar/
...
HangarAuth/
...
```
### Prerequisites
* Docker is required for all parts of this environment except the frontend
* [Yarn]
### Setting up
To get both Hangar and HangarAuth running locally:
2021-12-20 07:26:46 +08:00
1. Setup HangarAuth
1. See [HangarAuth README ](https://github.com/HangarMC/HangarAuth/blob/master/README.md )
2. Start HangarAuth's docker services
3. Create HangarAuth's hydra client
2022-04-02 01:21:35 +08:00
2. Move to Hangar's frontend directory `Hangar/frontend` . In that directory, run `pnpm install` followed by `pnpm run dev` .
2022-03-19 01:56:22 +08:00
3. Set up the hangar client in hydra (see [HangarAuth README ](https://github.com/HangarMC/HangarAuth/blob/master/README.md ))
2021-12-20 07:26:46 +08:00
4. Navigate to http://localhost:3000 and login.
2021-04-01 12:02:11 +08:00
2021-03-13 00:35:32 +08:00
2021-04-01 12:02:11 +08:00
### Notes
* If using IntelliJ, you can view logs from each service in the Services tab (ALT+8).
* The Spring Boot configuration file that is used by this environment is located at `Hangar/docker/hangar/application.yml`
* This setup requires that the Hangar and [HangarAuth] projects be sibling directories.
* To rebuild changes to Hangar, just rebuild in IntelliJ `CTRL+F9` .
* To rebuild HangarAuth, run `docker-compose up -d --build` in `Hangar/docker` .
2020-09-02 06:00:51 +08:00
2020-07-29 02:49:32 +08:00
## Deployment
2021-04-01 12:02:11 +08:00
Deployment happens via Docker, checkout the stack in the docker folder. The Spring Boot configuration file used for deployment can be found at
`docker/deployment/hangar-backend/application.yml` .
2020-07-29 02:49:32 +08:00
2021-12-23 20:12:08 +08:00
## Translations [![Crowdin](https://badges.crowdin.net/e/b13e6a1c05002365ee9031712112bd63/localized.svg)](https://hangar.crowdin.com/hangar)
2021-12-20 18:13:57 +08:00
2022-03-19 01:56:22 +08:00
Hangar uses Crowdin for translations. The easiest way to help to translate is sign up to Crowdin at https://hangar.crowdin.com/hangar,
joining the project and just add new translations or comment on or up/down-vote existing translations.
2021-12-23 20:12:08 +08:00
You can learn more about navigating the Crowdin UI here: https://support.crowdin.com/online-editor/
2021-12-20 18:13:57 +08:00
2021-12-23 20:12:08 +08:00
Getting translations locally (mostly for developers, requires crowdin cli, ran in root folder):
2021-12-20 18:13:57 +08:00
2021-12-21 20:06:06 +08:00
`crowdin pull --skip-untranslated-strings -b master -T <PAT>`
2021-12-20 18:13:57 +08:00
2021-12-23 02:10:51 +08:00
You might want to set the env var `TRANSLATION_MODE` to true, in order to get warnings about untranslated strings.
2020-07-29 02:49:32 +08:00
## Contributing
2020-08-30 20:50:48 +08:00
There is a bunch of stuff to do, some of that is noted in the [**Roadmap Project** ](https://github.com/PaperMC/Hangar/projects/1 ).
2021-10-17 03:49:03 +08:00
Your best bet is joining #development on the [Hangar Discord ](https://discord.gg/zvrAEbvJ4a ) and just discussing with us.
2020-08-30 20:50:48 +08:00
All contributions are very welcome, we will not be able to finish this alone!
2020-07-29 02:49:32 +08:00
2022-06-05 16:48:09 +08:00
Updating the frontend dependencies can be done best by running `npx npm-check -u` and going thru the changelogs. Notice that package.json might contain some hints of which deps are broken.
2021-04-10 14:27:27 +08:00
## License
2020-07-29 02:49:32 +08:00
Most of the frontend is a fork of Ore, licensed under MIT [here ](https://github.com/SpongePowered/Ore/blob/staging/LICENSE.txt ).
2021-04-10 14:27:27 +08:00
The rest is new code (but created in reference of Ore) and is licensed under the MIT license too.
2021-03-15 23:48:48 +08:00
2021-04-01 12:02:11 +08:00
[Yarn]: https://yarnpkg.com/
2021-12-19 17:46:08 +08:00
[HangarAuth]: https://github.com/HangarMC/HangarAuth