Compare commits

..

No commits in common. "e70714f25746c76974e957f16b0051daca306792" and "809e045c0b44dc49390a6a55452f89d1c3f1f663" have entirely different histories.

2 changed files with 2 additions and 22 deletions

View file

@ -1,11 +1,6 @@
# rwws - RealWeather Web Server
RealWeather Web Server is a web server that proxies requests to APIs that are used by [RealWeather](/Minecon724/RealWeather)
Good if you want to share your API key, but don't want to give it away, for example if you pay for it and want to resell \
Also reduces load on the services that are "scraped" (only if many users share the same instance) \
Or if you want to better firewall your server \
Just use it
This contacts APIs instead of the servers because we scrape some, and we don't want to draw attention
### Usage
See `RUNNING.md`[^1]
@ -15,4 +10,4 @@ See `PROTOCOL.md`
---
[^1]: This is the default Quarkus readme that I wish was available online because it's so nice
[^1]: This is the default Quarkus readme that I wish was available online

View file

@ -1,35 +1,20 @@
package eu.m724;
import eu.m724.orm.Token;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.StartupEvent;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import jakarta.transaction.Transactional;
import java.security.SecureRandom;
import java.util.Base64;
@Singleton
public class Startup {
@Inject
LaunchMode launchMode;
@Transactional
public void loadUsers(@Observes StartupEvent ignoredEvent) {
GlobalAccessLimits.initialize();
Token.deleteAll();
byte[] adminKey = new byte[18];
System.out.printf("Launch mode: %s\n", launchMode.toString());
if (launchMode == LaunchMode.NORMAL) {
System.out.println("Admin token is random");
new SecureRandom().nextBytes(adminKey);
} else {
// I don't know, but let it be
System.out.println("\n IF THIS IS RUNNING IN PRODUCTION, stop this program now and ask for help.\n");
}
Token token = new Token();
token.accessLimits = GlobalAccessLimits.kilo;