Skip to content

Commit

Permalink
Merge Dev stuff onto master. (#374)
Browse files Browse the repository at this point in the history
* Update dependency io.sentry:sentry-spring-boot-starter-jakarta to v7.15.0

* Bump SQL

* Start with v5

* Fix everything except Guild stuff I ain't fixing 1,7k lines of code rn gang.

* Starts

* Continues work on the silly async stuff for backend.

* Continues work on the silly async stuff for backend.

* ASYNC DONE LETS GO

* Revert "Svelte 5"

This reverts commit b1bd4f0.

* Reapply "Svelte 5"

This reverts commit e19eb10.

* V5 should be done now.

* Bump version

* Bump version

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
DxsSucuk and renovate[bot] authored Nov 1, 2024
1 parent b1bd4f0 commit a6b5a56
Show file tree
Hide file tree
Showing 14 changed files with 1,773 additions and 1,361 deletions.
6 changes: 3 additions & 3 deletions Backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>de.presti.ree6</groupId>
<artifactId>Webinterface-Backend</artifactId>
<version>4.0.17</version>
<version>5.0.0</version>
<name>Webinterface-Backend</name>
<description>The Backend for the Webinterface</description>

Expand Down Expand Up @@ -68,7 +68,7 @@
<dependency>
<groupId>de.ree6</groupId>
<artifactId>Ree6-SQL</artifactId>
<version>da620ec7a5</version>
<version>3.0.0</version>
</dependency>

<!-- Discord -->
Expand All @@ -88,7 +88,7 @@
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter-jakarta</artifactId>
<version>7.14.0</version>
<version>7.15.0</version>
</dependency>

<!-- Utilities -->
Expand Down
43 changes: 22 additions & 21 deletions Backend/src/main/java/de/presti/ree6/backend/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Server(String[] args) {
instance = this;

String tempVersion = getInstance().getClass().getPackage().getImplementationVersion();
backendVersion = tempVersion == null ? "4.0.11" : tempVersion;
backendVersion = tempVersion == null ? "5.0.0" : tempVersion;
load(args);
}

Expand Down Expand Up @@ -178,32 +178,33 @@ public void load(String[] args) {
Runtime.getRuntime().addShutdownHook(new Thread(this::onShutdown));

ThreadUtil.createNewThread(x -> {
List<Recording> recordings = SQLSession.getSqlConnector().getSqlWorker().getEntityList(new Recording(), "FROM Recording", null);

if (recordings != null && !recordings.isEmpty()) {
for (Recording recording : recordings) {
if (recording.getCreation() < System.currentTimeMillis() - Duration.ofDays(1).toMillis()) {
SQLSession.getSqlConnector().getSqlWorker().deleteEntity(recording);
SQLSession.getSqlConnector().getSqlWorker().getEntityList(new Recording(), "FROM Recording", null).subscribe(recordings -> {
if (recordings != null && !recordings.isEmpty()) {
for (Recording recording : recordings) {
if (recording.getCreation() < System.currentTimeMillis() - Duration.ofDays(1).toMillis()) {
SQLSession.getSqlConnector().getSqlWorker().deleteEntity(recording).block();
}
}
}
}
});

List<TwitchIntegration> twitchIntegrations = SQLSession.getSqlConnector().getSqlWorker().getEntityList(new TwitchIntegration(), "FROM TwitchIntegration", null);
twitchIntegrations.forEach(twitchIntegration -> {
if (twitchIntegration.getLastUpdated().getTime() + (twitchIntegration.getExpiresIn() * 1000L) - Duration.ofMinutes(10).toMillis() <= System.currentTimeMillis()) {
Optional<OAuth2Credential> cred = twitchIdentityProvider.refreshCredential(CustomOAuth2Util.convertToOriginal(twitchIntegration));
SQLSession.getSqlConnector().getSqlWorker().getEntityList(new TwitchIntegration(), "FROM TwitchIntegration", null).subscribe(twitchIntegrations -> {
twitchIntegrations.forEach(twitchIntegration -> {
if (twitchIntegration.getLastUpdated().getTime() + (twitchIntegration.getExpiresIn() * 1000L) - Duration.ofMinutes(10).toMillis() <= System.currentTimeMillis()) {
Optional<OAuth2Credential> cred = twitchIdentityProvider.refreshCredential(CustomOAuth2Util.convertToOriginal(twitchIntegration));

credentialManager.getCredentials().removeIf(credential -> {
if (credential instanceof CustomOAuth2Credential customOAuth2CredentialLocal) {
return customOAuth2CredentialLocal.getDiscordId() == twitchIntegration.getUserId();
}
return false;
});
credentialManager.getCredentials().removeIf(credential -> {
if (credential instanceof CustomOAuth2Credential customOAuth2CredentialLocal) {
return customOAuth2CredentialLocal.getDiscordId() == twitchIntegration.getUserId();
}
return false;
});

cred.ifPresent(oAuth2Credential -> credentialManager.addCredential("twitch", CustomOAuth2Util.convert(twitchIntegration.getUserId(), oAuth2Credential)));
}
cred.ifPresent(oAuth2Credential -> credentialManager.addCredential("twitch", CustomOAuth2Util.convert(twitchIntegration.getUserId(), oAuth2Credential)));
}
});
credentialManager.save();
});
credentialManager.save();
}, throwable -> log.error("Failed running Data clear Thread", throwable), Duration.ofMinutes(5), true, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WebConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) {
log.info("Setting up CORS");
String allowedDomain = Data.getAllowedDomains();
log.info("Allowed Domain: " + allowedDomain);
log.info("Allowed Domain: {}", allowedDomain);
registry.addMapping("/**").allowedOriginPatterns(allowedDomain);
}
}
Loading

0 comments on commit a6b5a56

Please sign in to comment.