Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DxsSucuk authored Feb 12, 2024
2 parents d1438dc + 05712f7 commit bfcaf79
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 307 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
distribution: 'temurin'
java-version: '17'
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**Backend/pom.xml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected].0
uses: docker/[email protected].1
with:
images: ree6/backend

Expand Down
18 changes: 9 additions & 9 deletions Backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

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

Expand All @@ -37,22 +37,22 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<scope>test</scope>
</dependency>

Expand All @@ -61,14 +61,14 @@
<dependency>
<groupId>de.ree6</groupId>
<artifactId>Ree6-SQL</artifactId>
<version>e70b54ea3f</version>
<version>6911247157</version>
</dependency>

<!-- Discord -->
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-beta.19</version>
<version>5.0.0-beta.20</version>
<exclusions>
<exclusion>
<groupId>club.minnced</groupId>
Expand All @@ -81,7 +81,7 @@
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter</artifactId>
<version>7.1.0</version>
<version>7.3.0</version>
</dependency>

<!-- Utilities -->
Expand Down
9 changes: 7 additions & 2 deletions Backend/src/main/java/de/presti/ree6/backend/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package de.presti.ree6.backend;

import de.presti.ree6.backend.utils.data.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@Slf4j
@EnableWebMvc
@Configuration
public class WebConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOriginPatterns(Data.getAllowedDomains());
log.info("Setting up CORS");
String allowedDomain = Data.getAllowedDomains();
log.info("Allowed Domain: " + allowedDomain);
registry.addMapping("/**").allowedOriginPatterns(allowedDomain);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.dv8tion.jda.api.entities.channel.attribute.IWebhookContainer;
import net.dv8tion.jda.api.entities.channel.concrete.Category;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel;

@Getter
@Setter
Expand All @@ -26,6 +27,13 @@ public class ChannelContainer {
String name;
ChannelType type;

public ChannelContainer(StandardGuildMessageChannel guildChannel) {
this.id = guildChannel.getIdLong();
this.guildId = guildChannel.getGuild().getIdLong();
this.name = guildChannel.getName();
this.type = guildChannel.getType();
}

public ChannelContainer(GuildChannel guildChannel) {
this.id = guildChannel.getIdLong();
this.guildId = guildChannel.getGuild().getIdLong();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel;

@Getter
Expand All @@ -28,7 +29,16 @@ public RecordContainer(Recording recording) {
///this.data = Base64.encodeBase64String(recording.getRecording());
this.creationTime = String.valueOf(recording.getCreation());
this.guildId = recording.getGuildId();
this.voiceChannel = new ChannelContainer(BotWorker.getShardManager().getChannelById(StandardGuildMessageChannel.class, recording.getVoiceId()));
this.creator = new UserContainer(BotWorker.getShardManager().retrieveUserById(recording.getCreatorId()).complete());

Guild guild = BotWorker.getShardManager().getGuildById(recording.getGuildId());

if (guild != null) {
StandardGuildMessageChannel channel = guild.getChannelById(StandardGuildMessageChannel.class, recording.getVoiceId());

if (channel != null) {
this.voiceChannel = new ChannelContainer(channel);
}
}
}
}
Loading

0 comments on commit bfcaf79

Please sign in to comment.