mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-03 08:19:46 +00:00
Compare commits
83 Commits
sissi-1.4.
...
sissi-1.4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a327deab9 | ||
|
|
a1f0cf58b9 | ||
|
|
2e7caa80bb | ||
|
|
32e80a5b84 | ||
|
|
96a230f347 | ||
|
|
88a4d45d22 | ||
|
|
858317a7f4 | ||
|
|
b69c873efe | ||
|
|
c93be84aef | ||
|
|
a61a128236 | ||
|
|
a1b2700092 | ||
|
|
da7cc2f6a7 | ||
|
|
4cb118339f | ||
|
|
11460f1e19 | ||
|
|
c9b856b300 | ||
|
|
c513087d30 | ||
|
|
8a110215f1 | ||
|
|
90b9c3674c | ||
|
|
68771a7b26 | ||
|
|
72e7bb57e3 | ||
|
|
3e147a37d9 | ||
|
|
99dca4906a | ||
|
|
32bfefc5b2 | ||
|
|
aa135b4663 | ||
|
|
4ffb5e5640 | ||
|
|
9376ac416f | ||
|
|
7cf44c99b7 | ||
|
|
5dce059d2b | ||
|
|
da30a120d7 | ||
|
|
49875b2467 | ||
|
|
2236710086 | ||
|
|
99b266e94a | ||
|
|
974ab230ac | ||
|
|
e5239f971c | ||
|
|
23db0b7c9e | ||
|
|
8167accd34 | ||
|
|
375045f508 | ||
|
|
3f4d5510d8 | ||
|
|
ba67f65bea | ||
|
|
1b7c2263ae | ||
|
|
f065bf5244 | ||
|
|
e036fd0867 | ||
|
|
96960d77ac | ||
|
|
3894d4567e | ||
|
|
503fd2520d | ||
|
|
58d6b12a67 | ||
|
|
4128274a7d | ||
|
|
3b498c5d3f | ||
|
|
c6bdcaa84c | ||
|
|
90f3dd0ae9 | ||
|
|
cd482d640f | ||
|
|
ae2f88daa3 | ||
|
|
c13f40fd3b | ||
|
|
37147a866f | ||
|
|
9a7d0613b1 | ||
|
|
7e60447ae6 | ||
|
|
e4a899a125 | ||
|
|
ce8341e69a | ||
|
|
fa6333fa49 | ||
|
|
3393dea591 | ||
|
|
3c3bdfaed9 | ||
|
|
172e3c4190 | ||
|
|
52b86804b9 | ||
|
|
de8d9982f3 | ||
|
|
29e1b22783 | ||
|
|
5852d4837e | ||
|
|
b345fa5502 | ||
|
|
d6470e3714 | ||
|
|
b4cebe2b41 | ||
|
|
f3dd85d7d5 | ||
|
|
db318afb2b | ||
|
|
ddd710d1c2 | ||
|
|
81824db1f1 | ||
|
|
0390d7c8ca | ||
|
|
61412f434c | ||
|
|
12e69a18fb | ||
|
|
170ddd9c33 | ||
|
|
de8bbdcbee | ||
|
|
b5bf53fb6a | ||
|
|
159326dde3 | ||
|
|
7124d4e1d8 | ||
|
|
c6f20d617d | ||
|
|
7449c05462 |
4
.env
Normal file
4
.env
Normal file
@@ -0,0 +1,4 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
|
||||
ABSTRACTO_PREFIX=harbor.sheldan.dev/abstracto/
|
||||
VERSION=1.4.38
|
||||
ABSTRACTO_VERSION=1.5.23
|
||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -33,9 +33,8 @@ jobs:
|
||||
id: dotenv
|
||||
uses: falti/dotenv-action@v1.0.4
|
||||
with:
|
||||
path: ./deployment/image-packaging/src/main/docker/.env
|
||||
path: .env
|
||||
- name: Push container
|
||||
working-directory: ./deployment/image-packaging/src/main/docker
|
||||
run: docker-compose build && docker-compose push
|
||||
env:
|
||||
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
||||
|
||||
86
.github/workflows/release_manual.yaml
vendored
Normal file
86
.github/workflows/release_manual.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
name: Publishes a new version of Sissi
|
||||
on: workflow_dispatch
|
||||
permissions:
|
||||
packages: write
|
||||
contents: write
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'corretto'
|
||||
java-version: 17
|
||||
- name: Load current version
|
||||
id: version
|
||||
run: echo "version=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec | cut -d- -f1)" >> $GITHUB_ENV
|
||||
- name: Release maven packages
|
||||
uses: qcastel/github-actions-maven-release@v1.12.41
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
abstractoUser: Sheldan
|
||||
abstractoToken: ${{ secrets.ABSTRACTO_PAT }}
|
||||
with:
|
||||
git-release-bot-name: "release-bot"
|
||||
git-release-bot-email: "release-bot@sheldan.dev"
|
||||
release-branch-name: master
|
||||
maven-args: "-Dmaven.javadoc.skip=true -s settings.xml -DskipTests"
|
||||
access-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to Harbor
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: harbor.sheldan.dev
|
||||
username: ${{ secrets.HARBOR_USERNAME }}
|
||||
password: ${{ secrets.HARBOR_TOKEN }}
|
||||
- name: Update Chart version file
|
||||
uses: fjogeleit/yaml-update-action@v0.13.2
|
||||
with:
|
||||
valueFile: 'deployment/helm/sissi/Chart.yaml'
|
||||
propertyPath: 'version'
|
||||
value: ${{ env.version }}
|
||||
commitChange: false
|
||||
- name: Update value files version
|
||||
uses: fjogeleit/yaml-update-action@v0.13.2
|
||||
with:
|
||||
valueFile: 'deployment/helm/sissi/values.yaml'
|
||||
commitChange: false
|
||||
changes: |
|
||||
{
|
||||
"bot.tag": "${{ env.version }}",
|
||||
"restApi.tag": "${{ env.version }}",
|
||||
"privateRestApi.tag": "${{ env.version }}",
|
||||
"templateDeploymentData.tag": "${{ env.version }}",
|
||||
"dbConfigDeploymentData.tag": "${{ env.version }}"
|
||||
}
|
||||
- name: Update .env version
|
||||
run:
|
||||
sed -i '3s/.*/VERSION=${{ env.version }}/' .env
|
||||
- name: Load env file
|
||||
id: dotenv
|
||||
uses: falti/dotenv-action@v1.0.4
|
||||
with:
|
||||
path: .env
|
||||
- name: Build and push Docker containers
|
||||
run: docker-compose build && docker-compose push
|
||||
env:
|
||||
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
||||
VERSION: ${{ steps.dotenv.outputs.version }}
|
||||
- name: Helm package and push
|
||||
working-directory: ./deployment/helm/
|
||||
run: |-
|
||||
helm registry login -u '${{ secrets.HARBOR_USERNAME }}' -p '${{ secrets.HARBOR_TOKEN }}' harbor.sheldan.dev
|
||||
helm package sissi
|
||||
helm push sissi*.tgz oci://harbor.sheldan.dev/sissi
|
||||
- name: Fix file permissions
|
||||
run:
|
||||
sudo chmod -R ugo+rwX . # https://github.com/actions/checkout/issues/164
|
||||
- name: Commit updated versions
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
author_name: "release-bot"
|
||||
author_email: "release-bot@sheldan.dev"
|
||||
7
Tiltfile
7
Tiltfile
@@ -2,6 +2,7 @@ allow_k8s_contexts('k8s-cluster')
|
||||
|
||||
load('ext://restart_process', 'docker_build_with_restart')
|
||||
registry = 'harbor.sheldan.dev/sissi/'
|
||||
abstracto_registry = 'harbor.sheldan.dev/abstracto/'
|
||||
|
||||
local_resource(
|
||||
'sissi-java-compile',
|
||||
@@ -28,6 +29,12 @@ docker_build_with_restart(
|
||||
)
|
||||
|
||||
docker_build(registry + 'sissi-db-data', 'deployment/image-packaging/src/main/docker/db-data/')
|
||||
docker_build(registry + 'sissi-debra-rest-api', 'python/modules/debra-rest-api/', dockerfile='python/modules/debra-rest-api/docker/Dockerfile')
|
||||
update_settings(suppress_unused_image_warnings=[registry + "sissi-debra-rest-api"]) # only used in docker image building
|
||||
docker_build(registry + 'sissi-image-gen-api', 'python/modules/image-gen-api/', dockerfile='python/modules/image-gen-api/docker/Dockerfile')
|
||||
update_settings(suppress_unused_image_warnings=[registry + "sissi-image-gen-api"]) # only used in docker image building
|
||||
docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry, 'SISSI_REGISTRY_PREFIX': registry})
|
||||
docker_build(registry + 'sissi-private-rest-api', 'deployment/image-packaging/src/main/docker/private-rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry, 'SISSI_REGISTRY_PREFIX': registry})
|
||||
docker_build(registry + 'sissi-template-data', 'deployment/image-packaging/src/main/docker/template-data/')
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>executable</artifactId>
|
||||
@@ -136,6 +136,16 @@
|
||||
<artifactId>statistic-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>giveaway-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>image-generation-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sissi modules -->
|
||||
|
||||
<dependency>
|
||||
@@ -170,6 +180,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||
<artifactId>image-generation-custom</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi</groupId>
|
||||
<artifactId>sissi</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||
<artifactId>sissi-customizations</artifactId>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-custom</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>image-generation-int</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<artifactId>core-int</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||
<id>liquibase</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources/migrations</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,80 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.CommandAlternative;
|
||||
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
|
||||
import dev.sheldan.abstracto.core.command.service.CommandRegistry;
|
||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.templating.model.AttachedFile;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FileService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.imagegeneration.config.ImageGenerationFeatureConfig;
|
||||
import dev.sheldan.sissi.module.custom.imagegeneration.service.ImageGenerationService;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class OrangeSunDogeCommandAlternative implements CommandAlternative {
|
||||
|
||||
@Autowired
|
||||
private ImageGenerationService imageGenerationService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
@Autowired
|
||||
private CommandRegistry commandRegistry;
|
||||
|
||||
@Autowired
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Autowired
|
||||
private ImageGenerationFeatureConfig imageGenerationFeatureConfig;
|
||||
|
||||
private static final String DOGE_ORANGE_SUN_RESPONSE_TEMPLATE_KEY = "doge_orangeSun_response";
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute(UnParsedCommandParameter parameter, Guild guild, Message message) {
|
||||
String contentStripped = message.getContentRaw();
|
||||
String[] parameters = contentStripped.split(" ");
|
||||
return parameters.length == 1 && featureFlagService.isFeatureEnabled(imageGenerationFeatureConfig, guild.getIdLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(UnParsedCommandParameter parameter, Message message) {
|
||||
String contentStripped = message.getContentRaw();
|
||||
List<String> parameters = Arrays.asList(contentStripped.split(" "));
|
||||
String inputText = commandRegistry.getCommandName(parameters.get(0), message.getGuild().getIdLong());
|
||||
File triggeredGifFile = imageGenerationService.getOrangeSunDogeImage(inputText);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(DOGE_ORANGE_SUN_RESPONSE_TEMPLATE_KEY, new Object());
|
||||
// template support does not support binary files
|
||||
AttachedFile file = AttachedFile
|
||||
.builder()
|
||||
.file(triggeredGifFile)
|
||||
.fileName("doge.png")
|
||||
.build();
|
||||
messageToSend.getAttachedFiles().add(file);
|
||||
FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(messageToSend, message.getGuildChannel()))
|
||||
.thenAccept(unused -> fileService.safeDeleteIgnoreException(messageToSend.getAttachedFiles().get(0).getFile()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPriority() {
|
||||
return ListenerPriority.LOW;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:custom-image-generation-config.properties")
|
||||
public class CustomImageGenerationConfig {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package dev.sheldan.sissi.module.custom.imagegeneration.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.core.service.HttpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class ImageGenerationService {
|
||||
|
||||
@Value("${abstracto.feature.imagegeneration.doge.orangeSun.url}")
|
||||
private String dogeOrangeSunUrl;
|
||||
|
||||
@Autowired
|
||||
private HttpService httpService;
|
||||
|
||||
public File getOrangeSunDogeImage(String inputText) {
|
||||
try {
|
||||
return httpService.downloadFileToTempFile(dogeOrangeSunUrl.replace("{1}", inputText));
|
||||
} catch (IOException e) {
|
||||
throw new AbstractoRunTimeException(String.format("Failed to download orange doge image for url %s with error %s", inputText, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
abstracto.feature.imagegeneration.doge.orangeSun.url=http://${PRIVATE_REST_API_HOST}:${PRIVATE_REST_API_PORT}/memes/doge/orangeSun/?text={1}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||
<artifactId>sissi-customizations</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>application</artifactId>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
<modules>
|
||||
<module>moderation-custom</module>
|
||||
<module>image-generation-custom</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<artifactId>sissi-modules</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -15,6 +15,19 @@
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
<classifier>jakarta</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package dev.sheldan.sissi.module.debra.api;
|
||||
|
||||
import dev.sheldan.sissi.module.debra.model.api.*;
|
||||
import dev.sheldan.sissi.module.debra.service.DonationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static dev.sheldan.sissi.module.debra.config.DebraFeatureConfig.DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/debra")
|
||||
public class DebraDonationStatusController {
|
||||
|
||||
@Autowired
|
||||
private DonationService donationService;
|
||||
|
||||
@GetMapping(value = "/latestDonations", produces = "application/json")
|
||||
public DonationStats getLatestDonations() {
|
||||
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
|
||||
List<DonationInfo> donations = donationService.getLatestDonations(donationResponse, Integer.MAX_VALUE)
|
||||
.stream()
|
||||
.map(DonationInfo::fromDonationItemModel)
|
||||
.toList();
|
||||
return DonationStats
|
||||
.builder()
|
||||
.totalAmount(donationResponse.getPage().getCollected())
|
||||
.donations(donations)
|
||||
.build();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/highestDonations", produces = "application/json")
|
||||
public DonationStats getHighestDonations() {
|
||||
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
|
||||
List<DonationInfo> donations = donationService.getHighestDonations(donationResponse, Integer.MAX_VALUE)
|
||||
.stream()
|
||||
.map(DonationInfo::fromDonationItemModel)
|
||||
.toList();
|
||||
return DonationStats
|
||||
.builder()
|
||||
.totalAmount(donationResponse.getPage().getCollected())
|
||||
.donations(donations)
|
||||
.build();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/campaignInfo", produces = "application/json")
|
||||
public CampaignInfo getCampaignInfo() {
|
||||
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
|
||||
|
||||
Description pageObject = donationResponse.getPage();
|
||||
return CampaignInfo
|
||||
.builder()
|
||||
.collected(pageObject.getCollected())
|
||||
.collectedNet(pageObject.getCollectedNet())
|
||||
.donationCount(donationResponse.getDonationCount())
|
||||
.currency(pageObject.getCurrency())
|
||||
.percent(pageObject.getPercent())
|
||||
.displayName(pageObject.getDisplayName())
|
||||
.slug(pageObject.getSlug())
|
||||
.target(pageObject.getTarget())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package dev.sheldan.sissi.module.debra.api;
|
||||
|
||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraFeatureConfig;
|
||||
import dev.sheldan.sissi.module.debra.model.api.DonationsResponse;
|
||||
import dev.sheldan.sissi.module.debra.model.api.EndlessStreamInfo;
|
||||
import dev.sheldan.sissi.module.debra.model.database.EndlessStream;
|
||||
import dev.sheldan.sissi.module.debra.service.DonationService;
|
||||
import dev.sheldan.sissi.module.debra.service.management.EndlessStreamManagementServiceBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static dev.sheldan.sissi.module.debra.config.DebraFeatureConfig.DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/stream")
|
||||
public class EndlessStreamController {
|
||||
|
||||
@Autowired
|
||||
private EndlessStreamManagementServiceBean endlessStreamManagementServiceBean;
|
||||
|
||||
@Autowired
|
||||
private DonationService donationService;
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
@GetMapping(value = "/endlessStream/{id}", produces = "application/json")
|
||||
public EndlessStreamInfo getLatestDonations(@PathVariable("id") Long id) {
|
||||
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
EndlessStream endlessStream = endlessStreamManagementServiceBean.getEndlessStream(id);
|
||||
DonationsResponse donationInfo = donationService.getSynchronizedCachedDonationAmount(serverId);
|
||||
BigDecimal collectedAmount = donationInfo.getPage().getCollected();
|
||||
Long minuteRate = configService.getLongValueOrConfigDefault(DebraFeatureConfig.ENDLESS_STREAM_MINUTE_RATE, serverId);
|
||||
Instant endDate = endlessStream.getStartTime().plus(collectedAmount.multiply(new BigDecimal(minuteRate)).toBigInteger().longValue(), ChronoUnit.MINUTES);
|
||||
return EndlessStreamInfo
|
||||
.builder()
|
||||
.startDate(endlessStream.getStartTime())
|
||||
.endDate(endDate)
|
||||
.donationAmount(collectedAmount.longValue())
|
||||
.minuteRate(minuteRate)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package dev.sheldan.sissi.module.debra.commands;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.UtilityModuleDefinition;
|
||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraFeatureDefinition;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraSlashCommandNames;
|
||||
import dev.sheldan.sissi.module.debra.service.DonationService;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component
|
||||
public class DebraInfoButton extends AbstractConditionableCommand {
|
||||
|
||||
private static final String DEBRA_INFO_BUTTON = "debraInfoButton";
|
||||
private static final String DEBRA_INFO_BUTTON_RESPONSE_TEMPLATE_KEY = "debraInfoButton_response";
|
||||
private static final String TARGET_CHANNEL_PARAMETER_KEY = "targetChannel";
|
||||
|
||||
@Autowired
|
||||
private SlashCommandParameterService slashCommandParameterService;
|
||||
|
||||
@Autowired
|
||||
private InteractionService interactionService;
|
||||
|
||||
@Autowired
|
||||
private DonationService donationService;
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
GuildMessageChannel targetChannel = slashCommandParameterService.getCommandOption(TARGET_CHANNEL_PARAMETER_KEY, event, GuildMessageChannel.class);
|
||||
return donationService.sendDebraInfoButtonMessage(targetChannel)
|
||||
.thenCompose(unused -> interactionService.replyEmbed(DEBRA_INFO_BUTTON_RESPONSE_TEMPLATE_KEY, event))
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
HelpInfo helpInfo = HelpInfo
|
||||
.builder()
|
||||
.templated(true)
|
||||
.build();
|
||||
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.rootCommandName(DebraSlashCommandNames.DEBRA_INTERNAL)
|
||||
.commandName("debrainfobutton")
|
||||
.build();
|
||||
|
||||
Parameter targetChannelParameter = Parameter
|
||||
.builder()
|
||||
.templated(true)
|
||||
.name(TARGET_CHANNEL_PARAMETER_KEY)
|
||||
.type(GuildMessageChannel.class)
|
||||
.build();
|
||||
|
||||
|
||||
List<Parameter> parameters = Arrays.asList(targetChannelParameter);
|
||||
|
||||
return CommandConfiguration.builder()
|
||||
.name(DEBRA_INFO_BUTTON)
|
||||
.module(UtilityModuleDefinition.UTILITY)
|
||||
.templated(true)
|
||||
.slashCommandConfig(slashCommandConfig)
|
||||
.async(true)
|
||||
.slashCommandOnly(true)
|
||||
.parameters(parameters)
|
||||
.supportsEmbedException(true)
|
||||
.causesReaction(false)
|
||||
.help(helpInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return DebraFeatureDefinition.DEBRA;
|
||||
}
|
||||
}
|
||||
@@ -113,20 +113,16 @@ public class Donations extends AbstractConditionableCommand {
|
||||
|
||||
private MessageToSend getDonationMessageToSend(Long serverId, Integer top, Integer latest) {
|
||||
DonationsModel donationModel;
|
||||
try {
|
||||
DonationsResponse donationResponse = donationService.fetchCurrentDonationAmount(serverId);
|
||||
donationModel = donationConverter.convertDonationResponse(donationResponse);
|
||||
if(top != null) {
|
||||
donationModel.setDonations(donationService.getHighestDonations(donationResponse, top));
|
||||
donationModel.setType(DonationsModel.DonationType.TOP);
|
||||
} else if(latest != null) {
|
||||
donationModel.setType(DonationsModel.DonationType.LATEST);
|
||||
donationModel.setDonations(donationService.getLatestDonations(donationResponse, latest));
|
||||
} else {
|
||||
donationModel.setDonations(new ArrayList<>());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new AbstractoRunTimeException("Failed to load donation amount.", e);
|
||||
DonationsResponse donationResponse = donationService.fetchCurrentDonationAmount(serverId);
|
||||
donationModel = donationConverter.convertDonationResponse(donationResponse);
|
||||
if(top != null) {
|
||||
donationModel.setDonations(donationService.getHighestDonations(donationResponse, top));
|
||||
donationModel.setType(DonationsModel.DonationType.TOP);
|
||||
} else if(latest != null) {
|
||||
donationModel.setType(DonationsModel.DonationType.LATEST);
|
||||
donationModel.setDonations(donationService.getLatestDonations(donationResponse, latest));
|
||||
} else {
|
||||
donationModel.setDonations(new ArrayList<>());
|
||||
}
|
||||
return templateService.renderEmbedTemplate(DONATIONS_RESPONSE_TEMPLATE_KEY, donationModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package dev.sheldan.sissi.module.debra.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.ehcache.config.builders.CacheManagerBuilder;
|
||||
import org.ehcache.jsr107.Eh107Configuration;
|
||||
import org.ehcache.xml.XmlConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@EnableCaching
|
||||
public class CacheConfig {
|
||||
|
||||
@Bean
|
||||
public JCacheManagerCustomizer cacheManagerCustomizer() {
|
||||
URL myUrl = getClass().getResource("/donation-cache-config.xml");
|
||||
XmlConfiguration xmlConfig = new XmlConfiguration(myUrl);
|
||||
org.ehcache.CacheManager myCacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);
|
||||
return cm -> {
|
||||
myCacheManager.getRuntimeConfiguration().getCacheConfigurations().entrySet().forEach(cacheConfiguration -> {
|
||||
javax.cache.configuration.Configuration<?, ?> jConfiguration = Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfiguration.getValue());
|
||||
log.info("Creating custom cache: " + cacheConfiguration.getKey());
|
||||
cm.createCache(cacheConfiguration.getKey(), jConfiguration);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
public class DebraFeatureConfig implements FeatureConfig {
|
||||
|
||||
public static final String DEBRA_DONATION_NOTIFICATION_DELAY_CONFIG_KEY = "debraDonationNotificationDelayMillis";
|
||||
public static final String ENDLESS_STREAM_MINUTE_RATE = "endlessStreamMinuteRate";
|
||||
public static final String DEBRA_DONATION_API_FETCH_SIZE_KEY = "debraDonationApiFetchSize";
|
||||
public static final String DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME = "DEBRA_DONATION_NOTIFICATION_SERVER_ID";
|
||||
@Override
|
||||
@@ -26,6 +27,6 @@ public class DebraFeatureConfig implements FeatureConfig {
|
||||
|
||||
@Override
|
||||
public List<String> getRequiredSystemConfigKeys() {
|
||||
return Arrays.asList(DEBRA_DONATION_NOTIFICATION_DELAY_CONFIG_KEY, DEBRA_DONATION_API_FETCH_SIZE_KEY);
|
||||
return Arrays.asList(DEBRA_DONATION_NOTIFICATION_DELAY_CONFIG_KEY, DEBRA_DONATION_API_FETCH_SIZE_KEY, ENDLESS_STREAM_MINUTE_RATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@ package dev.sheldan.sissi.module.debra.config;
|
||||
|
||||
public class DebraSlashCommandNames {
|
||||
public static final String DEBRA = "debra";
|
||||
public static final String DEBRA_INTERNAL = "debrainternal";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package dev.sheldan.sissi.module.debra;
|
||||
package dev.sheldan.sissi.module.debra.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package dev.sheldan.sissi.module.debra.listener;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListener;
|
||||
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerModel;
|
||||
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerResult;
|
||||
import dev.sheldan.abstracto.core.service.MessageService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraFeatureDefinition;
|
||||
import dev.sheldan.sissi.module.debra.service.DonationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DebraInfoButtonClickedListener implements ButtonClickedListener {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private InteractionService interactionService;
|
||||
|
||||
private static final String DEBRA_INFO_MESSAGE_TEMPLATE_KEY = "debraInfoMessage";
|
||||
private static final String DEBRA_INFO_MESSAGE_RESPONSE_TEMPLATE_KEY = "debraInfoMessage_response";
|
||||
|
||||
@Override
|
||||
public ButtonClickedListenerResult execute(ButtonClickedListenerModel model) {
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(DEBRA_INFO_MESSAGE_TEMPLATE_KEY, new Object(), model.getServerId());
|
||||
messageService.sendMessageToSendToUser(model.getEvent().getUser(), messageToSend).thenAccept(interactionHook -> {
|
||||
log.info("Send debra info message to user {}", model.getEvent().getUser().getIdLong());
|
||||
}).exceptionally(throwable -> {
|
||||
log.error("Failed to send debra info message to user {}", model.getEvent().getUser().getIdLong(), throwable);
|
||||
return null;
|
||||
});
|
||||
MessageToSend responseMessageToSend = templateService.renderEmbedTemplate(DEBRA_INFO_MESSAGE_RESPONSE_TEMPLATE_KEY, new Object(), model.getServerId());
|
||||
FutureUtils.toSingleFutureGeneric(interactionService.sendMessageToInteraction(responseMessageToSend, model.getEvent().getInteraction().getHook()))
|
||||
.thenAccept(interactionHook -> {
|
||||
log.info("Send debra info message response to user {}", model.getEvent().getUser().getIdLong());
|
||||
}).exceptionally(throwable -> {
|
||||
log.error("Failed to send debra info message response to user {}", model.getEvent().getUser().getIdLong(), throwable);
|
||||
return null;
|
||||
});
|
||||
return ButtonClickedListenerResult.ACKNOWLEDGED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean handlesEvent(ButtonClickedListenerModel model) {
|
||||
return model.getOrigin().equals(DonationService.DEBRA_INFO_BUTTON_ORIGIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return DebraFeatureDefinition.DEBRA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPriority() {
|
||||
return ListenerPriority.MEDIUM;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class CampaignInfo {
|
||||
private BigInteger donationCount;
|
||||
private BigDecimal collected;
|
||||
private BigDecimal target;
|
||||
private String currency;
|
||||
private String slug;
|
||||
private String displayName;
|
||||
private BigDecimal collectedNet;
|
||||
private BigDecimal percent;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -10,11 +11,18 @@ import java.math.BigDecimal;
|
||||
@Setter
|
||||
@Builder
|
||||
public class Description {
|
||||
@SerializedName("collected")
|
||||
private BigDecimal collected;
|
||||
@SerializedName("target")
|
||||
private BigDecimal target;
|
||||
@SerializedName("currency")
|
||||
private String currency;
|
||||
@SerializedName("slug")
|
||||
private String slug;
|
||||
@SerializedName("displayname")
|
||||
private String displayName;
|
||||
@SerializedName("collectednet")
|
||||
private BigDecimal collectedNet;
|
||||
@SerializedName("percent")
|
||||
private BigDecimal percent;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -10,10 +11,16 @@ import java.math.BigDecimal;
|
||||
@Setter
|
||||
@Builder
|
||||
public class Donation {
|
||||
@SerializedName("amount")
|
||||
private BigDecimal amount;
|
||||
@SerializedName("currency")
|
||||
private String currency;
|
||||
@SerializedName("text")
|
||||
private String text;
|
||||
@SerializedName("anonym")
|
||||
private Integer anonym;
|
||||
@SerializedName("firstname")
|
||||
private String firstname;
|
||||
@SerializedName("lastname")
|
||||
private String lastname;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import dev.sheldan.sissi.module.debra.model.commands.DonationItemModel;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class DonationInfo {
|
||||
private String firstName;
|
||||
private BigDecimal donationAmount;
|
||||
private Boolean anonymous;
|
||||
|
||||
public static DonationInfo fromDonationItemModel(DonationItemModel donationItemModel) {
|
||||
return DonationInfo
|
||||
.builder()
|
||||
.donationAmount(donationItemModel.getDonationAmount())
|
||||
.anonymous(donationItemModel.getAnonymous())
|
||||
.firstName(donationItemModel.getFirstName())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class DonationStats {
|
||||
private List<DonationInfo> donations;
|
||||
private BigDecimal totalAmount;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -11,7 +12,10 @@ import java.util.List;
|
||||
@Setter
|
||||
@Builder
|
||||
public class DonationsResponse {
|
||||
@SerializedName("page")
|
||||
private Description page;
|
||||
@SerializedName("donation_count")
|
||||
private BigInteger donationCount;
|
||||
@SerializedName("donations")
|
||||
private List<Donation> donations;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.sissi.module.debra.model.api;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class EndlessStreamInfo {
|
||||
private Instant endDate;
|
||||
private Instant startDate;
|
||||
private Long donationAmount;
|
||||
private Long minuteRate;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.sissi.module.debra.model.commands;
|
||||
|
||||
import dev.sheldan.abstracto.core.interaction.button.ButtonPayload;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
public class DebraInfoButtonPayload implements ButtonPayload {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.sissi.module.debra.model.commands;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class DebraInfoModel {
|
||||
private String buttonId;
|
||||
}
|
||||
@@ -2,10 +2,12 @@ package dev.sheldan.sissi.module.debra.model.commands;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class DonationItemModel {
|
||||
private String firstName;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.sissi.module.debra.model.database;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Builder
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "endless_stream")
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class EndlessStream {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "start_time")
|
||||
private Instant startTime;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.sheldan.sissi.module.debra.repository;
|
||||
|
||||
import dev.sheldan.sissi.module.debra.model.database.EndlessStream;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface EndlessStreamRepository extends JpaRepository<EndlessStream, Long> {
|
||||
}
|
||||
@@ -2,28 +2,39 @@ package dev.sheldan.sissi.module.debra.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.core.interaction.ComponentPayloadService;
|
||||
import dev.sheldan.abstracto.core.interaction.ComponentService;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||
import dev.sheldan.abstracto.core.service.PostTargetService;
|
||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.sissi.module.debra.DonationAmountNotFoundException;
|
||||
import dev.sheldan.sissi.module.debra.exception.DonationAmountNotFoundException;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraPostTarget;
|
||||
import dev.sheldan.sissi.module.debra.config.DebraProperties;
|
||||
import dev.sheldan.sissi.module.debra.converter.DonationConverter;
|
||||
import dev.sheldan.sissi.module.debra.model.api.Donation;
|
||||
import dev.sheldan.sissi.module.debra.model.api.DonationsResponse;
|
||||
import dev.sheldan.sissi.module.debra.model.commands.DebraInfoButtonPayload;
|
||||
import dev.sheldan.sissi.module.debra.model.commands.DebraInfoModel;
|
||||
import dev.sheldan.sissi.module.debra.model.commands.DonationItemModel;
|
||||
import dev.sheldan.sissi.module.debra.model.commands.DonationsModel;
|
||||
import dev.sheldan.sissi.module.debra.model.listener.DonationResponseModel;
|
||||
import dev.sheldan.sissi.module.debra.model.listener.DonationNotificationModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
@@ -60,10 +71,28 @@ public class DonationService {
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private ComponentService componentService;
|
||||
|
||||
@Autowired
|
||||
private ComponentPayloadService componentPayloadService;
|
||||
|
||||
@Autowired
|
||||
private ServerManagementService serverManagementService;
|
||||
|
||||
@Autowired
|
||||
private DonationService self;
|
||||
|
||||
private static final String DEBRA_DONATION_NOTIFICATION_TEMPLATE_KEY = "debra_donation_notification";
|
||||
|
||||
private static final Pattern MESSAGE_PATTERN = Pattern.compile("(.*) hat (\\d{1,9},\\d{2}) Euro gespendet!<br \\/>Vielen Dank!<br \\/>Nachricht:<br \\/>(.*)");
|
||||
|
||||
private static final String DEBRA_INFO_BUTTON_MESSAGE_TEMPLATE_KEY = "debraInfoButton";
|
||||
public static final String DEBRA_INFO_BUTTON_ORIGIN = "DEBRA_INFO_BUTTON";
|
||||
|
||||
public DonationResponseModel parseDonationFromMessage(String message) {
|
||||
Matcher matcher = MESSAGE_PATTERN.matcher(message);
|
||||
if (matcher.find()) {
|
||||
@@ -105,23 +134,34 @@ public class DonationService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public DonationsResponse fetchCurrentDonationAmount(Long serverId) throws IOException {
|
||||
Long fetchSize = configService.getLongValueOrConfigDefault(DEBRA_DONATION_API_FETCH_SIZE_KEY, serverId);
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format(debraProperties.getDonationAPIUrl(), fetchSize))
|
||||
.get()
|
||||
.build();
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
if(!response.isSuccessful()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.error("Failed to retrieve urban dictionary definition. Response had code {} with body {}.",
|
||||
response.code(), response.body());
|
||||
}
|
||||
throw new DonationAmountNotFoundException();
|
||||
}
|
||||
Gson gson = getGson();
|
||||
public synchronized DonationsResponse getSynchronizedCachedDonationAmount(Long serverId) {
|
||||
return self.getCachedDonationAmount(serverId);
|
||||
}
|
||||
|
||||
@Cacheable(value = "donation-cache")
|
||||
public synchronized DonationsResponse getCachedDonationAmount(Long serverId) {
|
||||
return self.fetchCurrentDonationAmount(serverId);
|
||||
}
|
||||
|
||||
public DonationsResponse fetchCurrentDonationAmount(Long serverId) {
|
||||
try {
|
||||
Long fetchSize = configService.getLongValueOrConfigDefault(DEBRA_DONATION_API_FETCH_SIZE_KEY, serverId);
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format(debraProperties.getDonationAPIUrl(), fetchSize))
|
||||
.get()
|
||||
.build();
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
if(!response.isSuccessful()) {
|
||||
log.error("Failed to retrieve donation response. Response had code {} with body {} and headers {}.",
|
||||
response.code(), response.body().string(), response.headers());
|
||||
throw new DonationAmountNotFoundException();
|
||||
}
|
||||
Gson gson = getGson();
|
||||
return gson.fromJson(response.body().string(), DonationsResponse.class);
|
||||
} catch (Exception exception) {
|
||||
throw new AbstractoRunTimeException(exception);
|
||||
}
|
||||
|
||||
return gson.fromJson(response.body().string(), DonationsResponse.class);
|
||||
}
|
||||
|
||||
private Gson getGson() {
|
||||
@@ -130,7 +170,7 @@ public class DonationService {
|
||||
.create();
|
||||
}
|
||||
|
||||
private DonationsModel getDonationInfoModel(Long serverId) throws IOException {
|
||||
private DonationsModel getDonationInfoModel(Long serverId) {
|
||||
return donationConverter.convertDonationResponse(fetchCurrentDonationAmount(serverId));
|
||||
}
|
||||
|
||||
@@ -148,4 +188,26 @@ public class DonationService {
|
||||
firstMessage.addAll(secondMessage);
|
||||
return FutureUtils.toSingleFutureGeneric(firstMessage);
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> sendDebraInfoButtonMessage(GuildMessageChannel guildMessageChannel) {
|
||||
String buttonId = componentService.generateComponentId();
|
||||
DebraInfoModel model = DebraInfoModel
|
||||
.builder()
|
||||
.buttonId(buttonId)
|
||||
.build();
|
||||
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(DEBRA_INFO_BUTTON_MESSAGE_TEMPLATE_KEY, model, guildMessageChannel.getGuild().getIdLong());
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(messageToSend, guildMessageChannel)).thenAccept(unused -> {
|
||||
self.persistButtonPayload(guildMessageChannel, buttonId);
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void persistButtonPayload(GuildMessageChannel guildMessageChannel, String buttonId) {
|
||||
DebraInfoButtonPayload payload = DebraInfoButtonPayload
|
||||
.builder()
|
||||
.build();
|
||||
AServer server = serverManagementService.loadServer(guildMessageChannel.getGuild().getIdLong());
|
||||
componentPayloadService.createButtonPayload(buttonId, payload, DEBRA_INFO_BUTTON_ORIGIN, server);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.sheldan.sissi.module.debra.service.management;
|
||||
|
||||
import dev.sheldan.sissi.module.debra.model.database.EndlessStream;
|
||||
import dev.sheldan.sissi.module.debra.repository.EndlessStreamRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class EndlessStreamManagementServiceBean {
|
||||
|
||||
@Autowired
|
||||
private EndlessStreamRepository endlessStreamRepository;
|
||||
|
||||
public EndlessStream getEndlessStream(Long id) {
|
||||
return endlessStreamRepository.getReferenceById(id);
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,13 @@ abstracto.postTargets.debraDonationNotification.name=debraDonationNotification
|
||||
abstracto.postTargets.debraDonationNotification2.name=debraDonationNotification2
|
||||
|
||||
sissi.debra.websocketURL=ws://spenden.baba.fm:8765/
|
||||
sissi.debra.donationAPIUrl=https://www.altruja.de/api/page/discord-fuer-debra-2022?details=1&num=%s&ort=0
|
||||
sissi.debra.donationAPIUrl=https://www.altruja.de/api/page/discord-gg-austria-fuer-debra-2023?details=1&num=%s&ort=0
|
||||
|
||||
abstracto.systemConfigs.debraDonationNotificationDelayMillis.name=debraDonationNotificationDelayMillis
|
||||
abstracto.systemConfigs.debraDonationNotificationDelayMillis.longValue=60000
|
||||
|
||||
abstracto.systemConfigs.endlessStreamMinuteRate.name=endlessStreamMinuteRate
|
||||
abstracto.systemConfigs.endlessStreamMinuteRate.longValue=1
|
||||
|
||||
abstracto.systemConfigs.debraDonationApiFetchSize.name=debraDonationApiFetchSize
|
||||
abstracto.systemConfigs.debraDonationApiFetchSize.longValue=1000
|
||||
@@ -0,0 +1,24 @@
|
||||
<config
|
||||
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
|
||||
xmlns='http://www.ehcache.org/v3'
|
||||
xsi:schemaLocation="
|
||||
http://www.ehcache.org/v3
|
||||
http://www.ehcache.org/schema/ehcache-core-3.8-1.xsd">
|
||||
<cache uses-template="default" alias="donation-cache">
|
||||
<expiry>
|
||||
<ttl unit="seconds">120</ttl>
|
||||
</expiry>
|
||||
|
||||
<resources>
|
||||
<heap unit="entries">5</heap>
|
||||
</resources>
|
||||
</cache>
|
||||
<cache-template name="default">
|
||||
<expiry>
|
||||
<ttl unit="seconds">600</ttl>
|
||||
</expiry>
|
||||
<resources>
|
||||
<heap>50</heap>
|
||||
</resources>
|
||||
</cache-template>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<property name="utilityModule" value="(SELECT id FROM module WHERE name = 'utility')"/>
|
||||
<property name="debraFeature" value="(SELECT id FROM feature WHERE key = 'debra')"/>
|
||||
|
||||
<changeSet author="Sheldan" id="debraInfoButton-command">
|
||||
<insert tableName="command">
|
||||
<column name="name" value="debraInfoButton"/>
|
||||
<column name="module_id" valueComputed="${utilityModule}"/>
|
||||
<column name="feature_id" valueComputed="${debraFeature}"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<changeSet author="Sheldan" id="endless_stream-table">
|
||||
<createTable tableName="endless_stream">
|
||||
<column name="id" autoIncrement="true" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="start_time" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
</createTable>
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS endless_stream_update_trigger ON endless_stream;
|
||||
CREATE TRIGGER endless_stream_update_trigger BEFORE UPDATE ON endless_stream FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||
</sql>
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS endless_stream_insert_trigger ON endless_stream;
|
||||
CREATE TRIGGER endless_stream_insert_trigger BEFORE INSERT ON endless_stream FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="endless_stream.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -7,4 +7,6 @@
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="1.3.6/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.4.21/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.4.29/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<artifactId>sissi-modules</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<artifactId>sissi-modules</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>sissi-modules</artifactId>
|
||||
<groupId>dev.sheldan.sissi.application</groupId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,24 +1,5 @@
|
||||
apiVersion: v2
|
||||
name: sissi
|
||||
description: A Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.4.21
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.4.21"
|
||||
version: 1.4.38
|
||||
|
||||
@@ -84,6 +84,10 @@ spec:
|
||||
secretKeyRef:
|
||||
name: api-keys
|
||||
key: twitchSecret
|
||||
- name: PRIVATE_REST_API_HOST
|
||||
value: "{{ .Values.privateRestApi.service.name }}.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
- name: PRIVATE_REST_API_PORT
|
||||
value: "{{ .Values.privateRestApi.service.targetPort }}"
|
||||
{{- range $key, $value := .Values.bot.propertyConfig }}
|
||||
- name: {{ $key | quote }}
|
||||
value: {{ $value | quote}}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{{- if .Values.privateRestApi.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "sissi.fullname" . }}-private-rest-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: private-rest-api
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.privateRestApi.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: private-rest-api
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "sissi.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.privateRestApi.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-private-rest-api
|
||||
securityContext:
|
||||
{{- toYaml .Values.privateRestApi.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.privateRestApi.repository }}/{{ .Values.privateRestApi.image }}:{{ .Values.privateRestApi.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.privateRestApi.pullPolicy }}
|
||||
env:
|
||||
- name: SISSI_HOST
|
||||
value: "{{ include "sissi.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
- name: SISSI_PORT
|
||||
value: "{{ .Values.service.port }}"
|
||||
ports:
|
||||
- name: {{ .Values.privateRestApi.service.name }}
|
||||
containerPort: {{ .Values.privateRestApi.service.port }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.privateRestApi.service.port }}
|
||||
initialDelaySeconds: {{ $.Values.privateRestApi.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.privateRestApi.livenessProbe.periodSeconds }}
|
||||
failureThreshold: {{ $.Values.privateRestApi.livenessProbe.failureThreshold }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.privateRestApi.service.port }}
|
||||
initialDelaySeconds: {{ $.Values.privateRestApi.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.privateRestApi.readinessProbe.periodSeconds }}
|
||||
failureThreshold: {{ $.Values.privateRestApi.readinessProbe.failureThreshold }}
|
||||
resources:
|
||||
{{- toYaml .Values.privateRestApi.resources | nindent 12 }}
|
||||
{{- with .Values.privateRestApi.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.privateRestApi.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.privateRestApi.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.privateRestApi.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.privateRestApi.service.name }}
|
||||
spec:
|
||||
selector:
|
||||
app: private-rest-api
|
||||
ports:
|
||||
- port: {{ .Values.privateRestApi.service.targetPort }}
|
||||
targetPort: {{ .Values.privateRestApi.service.port }}
|
||||
{{- end }}
|
||||
70
deployment/helm/sissi/templates/rest-api-deployment.yaml
Normal file
70
deployment/helm/sissi/templates/rest-api-deployment.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
{{- if .Values.restApi.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "sissi.fullname" . }}-rest-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: rest-api
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.restApi.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: rest-api
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "sissi.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.restApi.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-rest-api
|
||||
securityContext:
|
||||
{{- toYaml .Values.restApi.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.restApi.repository }}/{{ .Values.restApi.image }}:{{ .Values.restApi.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.restApi.pullPolicy }}
|
||||
env:
|
||||
- name: SISSI_HOST
|
||||
value: "{{ include "sissi.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local"
|
||||
- name: SISSI_PORT
|
||||
value: "{{ .Values.service.port }}"
|
||||
ports:
|
||||
- name: {{ .Values.restApi.service.name }}
|
||||
containerPort: {{ .Values.restApi.service.port }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.restApi.service.port }}
|
||||
initialDelaySeconds: {{ $.Values.restApi.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.restApi.livenessProbe.periodSeconds }}
|
||||
failureThreshold: {{ $.Values.restApi.livenessProbe.failureThreshold }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.restApi.service.port }}
|
||||
initialDelaySeconds: {{ $.Values.restApi.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.restApi.readinessProbe.periodSeconds }}
|
||||
failureThreshold: {{ $.Values.restApi.readinessProbe.failureThreshold }}
|
||||
resources:
|
||||
{{- toYaml .Values.restApi.resources | nindent 12 }}
|
||||
{{- with .Values.restApi.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.restApi.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.restApi.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
45
deployment/helm/sissi/templates/rest-api-ingress.yaml
Normal file
45
deployment/helm/sissi/templates/rest-api-ingress.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
{{- if .Values.restApi.enabled -}}
|
||||
{{- $servicePort := .Values.restApi.service.port -}}
|
||||
{{- $serviceName := .Values.restApi.service.name -}}
|
||||
{{- $ingressPath := .Values.restApi.ingress.path -}}
|
||||
{{- $ingressPathType := .Values.restApi.ingress.pathType -}}
|
||||
{{- $extraPaths := .Values.restApi.ingress.extraPaths -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress-rest-api
|
||||
labels:
|
||||
{{- with .Values.restApi.ingress.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.restApi.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ tpl $value $ | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
{{- with .Values.restApi.ingress.tls }}
|
||||
tls:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.restApi.ingress.hosts }}
|
||||
{{- range .Values.restApi.ingress.hosts }}
|
||||
- host: {{ tpl . $ }}
|
||||
http:
|
||||
paths:
|
||||
{{- with $extraPaths }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
- path: {{ $ingressPath }}
|
||||
pathType: {{ $ingressPathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $serviceName }}
|
||||
port:
|
||||
number: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
12
deployment/helm/sissi/templates/rest-api-service.yaml
Normal file
12
deployment/helm/sissi/templates/rest-api-service.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.restApi.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.restApi.service.name }}
|
||||
spec:
|
||||
selector:
|
||||
app: rest-api
|
||||
ports:
|
||||
- port: {{ .Values.restApi.service.targetPort }}
|
||||
targetPort: {{ .Values.restApi.service.port }}
|
||||
{{- end }}
|
||||
@@ -6,9 +6,9 @@ replicaCount: 1
|
||||
|
||||
bot:
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: IfNotPresent
|
||||
pullPolicy: Always
|
||||
image: sissi-bot
|
||||
tag: 1.4.21
|
||||
tag: 1.4.38
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 5
|
||||
@@ -20,31 +20,106 @@ bot:
|
||||
propertyConfig:
|
||||
hikariPoolSize: 10
|
||||
|
||||
restApi:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: Always
|
||||
image: sissi-rest-api
|
||||
tag: 1.4.38
|
||||
podAnnotations: {}
|
||||
podSecurityContext: {}
|
||||
securityContext: {}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
failureThreshold: 3
|
||||
service:
|
||||
port: 8080
|
||||
targetPort: 80
|
||||
name: rest-api
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
requests:
|
||||
cpu:
|
||||
memory:
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
labels: {}
|
||||
path: /
|
||||
|
||||
pathType: Prefix
|
||||
|
||||
hosts:
|
||||
extraPaths: []
|
||||
tls: []
|
||||
|
||||
privateRestApi:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: Always
|
||||
image: sissi-private-rest-api
|
||||
tag: 1.4.38
|
||||
podAnnotations: {}
|
||||
podSecurityContext: {}
|
||||
securityContext: {}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
failureThreshold: 3
|
||||
service:
|
||||
port: 8080
|
||||
targetPort: 80
|
||||
name: private-restapi # must be less than 16 chars
|
||||
resources:
|
||||
limits:
|
||||
cpu:
|
||||
memory:
|
||||
requests:
|
||||
cpu:
|
||||
memory:
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
|
||||
templateDeployment:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-template-deployment
|
||||
tag: 1.5.12
|
||||
tag: 1.5.23
|
||||
|
||||
templateDeploymentData:
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: Always
|
||||
image: sissi-template-data
|
||||
tag: 1.4.21
|
||||
tag: 1.4.38
|
||||
|
||||
dbConfigDeployment:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-db-deployment
|
||||
tag: 1.5.12
|
||||
tag: 1.5.23
|
||||
|
||||
dbConfigDeploymentData:
|
||||
repository: harbor.sheldan.dev/sissi
|
||||
pullPolicy: Always
|
||||
image: sissi-db-data
|
||||
tag: 1.4.21
|
||||
tag: 1.4.38
|
||||
|
||||
dbCredentials:
|
||||
host:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
|
||||
VERSION=1.4.21
|
||||
@@ -8,6 +8,8 @@
|
||||
{ "zip": "statistic", "file": "statistic-changeLog.xml"},
|
||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
||||
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
||||
{ "zip": "giveaway", "file": "giveaway-changeLog.xml"},
|
||||
{ "zip": "image-generation", "file": "imageGeneration-changeLog.xml"},
|
||||
{ "zip": "meetup", "file": "meetup-changeLog.xml"},
|
||||
{ "zip": "rss-news", "file": "rssNews-changeLog.xml"},
|
||||
{ "zip": "debra", "file": "debra-changeLog.xml"},
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: sissi
|
||||
image: ${REGISTRY_PREFIX}sissi-bot:${VERSION:-latest}
|
||||
db-data:
|
||||
build:
|
||||
context: db-data
|
||||
image: ${REGISTRY_PREFIX}sissi-db-data:${VERSION:-latest}
|
||||
template-data:
|
||||
build:
|
||||
context: template-data
|
||||
image: ${REGISTRY_PREFIX}sissi-template-data:${VERSION:-latest}
|
||||
@@ -0,0 +1,11 @@
|
||||
ARG REGISTRY_PREFIX
|
||||
ARG SISSI_REGISTRY_PREFIX
|
||||
ARG VERSION
|
||||
ARG ABSTRACTO_VERSION
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api-image-gen:${ABSTRACTO_VERSION:-latest} AS image-gen-api
|
||||
|
||||
FROM ${SISSI_REGISTRY_PREFIX}sissi-image-gen-api:${VERSION:-latest} AS sissi-image-gen-api
|
||||
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest} AS running-image
|
||||
COPY --from=image-gen-api /python /python
|
||||
COPY --from=sissi-image-gen-api /python /python
|
||||
@@ -0,0 +1,9 @@
|
||||
ARG REGISTRY_PREFIX
|
||||
ARG SISSI_REGISTRY_PREFIX
|
||||
ARG VERSION
|
||||
ARG ABSTRACTO_VERSION
|
||||
FROM ${SISSI_REGISTRY_PREFIX}sissi-debra-rest-api:${VERSION:-latest} AS debra-api
|
||||
|
||||
|
||||
FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest}
|
||||
COPY --from=debra-api /python /python
|
||||
@@ -1,13 +1,17 @@
|
||||
{
|
||||
"template_artifacts": [
|
||||
"core","starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "remind", "suggestion", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch",
|
||||
"core","starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "remind",
|
||||
"suggestion", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"image-generation",
|
||||
"quotes", "meetup", "debra", "rss-news",
|
||||
"moderation-custom",
|
||||
"moderation-custom", "image-generation-custom",
|
||||
"moderation-template-overrides", "experience-template-overrides", "logging-template-overrides"
|
||||
],
|
||||
"translation_artifacts": [
|
||||
"core",
|
||||
"starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "suggestion", "remind", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch",
|
||||
"starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices",
|
||||
"suggestion", "remind", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
||||
"image-generation",
|
||||
"quotes", "meetup", "debra", "rss-news",
|
||||
"moderation-custom",
|
||||
"moderation-translation-overrides", "experience-translation-overrides", "logging-translation-overrides"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi</groupId>
|
||||
<artifactId>sissi</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
43
docker-compose.yml
Normal file
43
docker-compose.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
bot-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/sissi
|
||||
image: ${REGISTRY_PREFIX}sissi-bot:${VERSION:-latest}
|
||||
debra-rest-api:
|
||||
build:
|
||||
context: python/modules/debra-rest-api
|
||||
dockerfile: docker/Dockerfile
|
||||
image: ${REGISTRY_PREFIX}sissi-debra-rest-api:${VERSION:-latest}
|
||||
image-gen-api:
|
||||
build:
|
||||
context: python/modules/image-gen-api
|
||||
dockerfile: docker/Dockerfile
|
||||
image: ${REGISTRY_PREFIX}sissi-image-gen-api:${VERSION:-latest}
|
||||
rest-api-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/rest-api
|
||||
args:
|
||||
SISSI_REGISTRY_PREFIX: ${REGISTRY_PREFIX}
|
||||
REGISTRY_PREFIX: ${ABSTRACTO_PREFIX}
|
||||
VERSION: ${VERSION}
|
||||
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
|
||||
image: ${REGISTRY_PREFIX}sissi-rest-api:${VERSION:-latest}
|
||||
private-rest-api-packaging:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/private-rest-api
|
||||
args:
|
||||
REGISTRY_PREFIX: ${ABSTRACTO_PREFIX}
|
||||
SISSI_REGISTRY_PREFIX: ${REGISTRY_PREFIX}
|
||||
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
|
||||
VERSION: ${VERSION}
|
||||
image: ${REGISTRY_PREFIX}sissi-private-rest-api:${VERSION:-latest}
|
||||
db-data:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/db-data
|
||||
image: ${REGISTRY_PREFIX}sissi-db-data:${VERSION:-latest}
|
||||
template-data:
|
||||
build:
|
||||
context: deployment/image-packaging/src/main/docker/template-data
|
||||
image: ${REGISTRY_PREFIX}sissi-template-data:${VERSION:-latest}
|
||||
28
pom.xml
28
pom.xml
@@ -13,15 +13,13 @@
|
||||
<groupId>dev.sheldan.sissi</groupId>
|
||||
<artifactId>sissi</artifactId>
|
||||
<name>Sissi</name>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<!-- edit in release.yml as well -->
|
||||
<!-- when releasing a new bot version, update the .env as well-->
|
||||
<abstracto.version>1.5.12</abstracto.version>
|
||||
<abstracto.templates.version>1.4.23</abstracto.templates.version>
|
||||
<abstracto.version>1.5.23</abstracto.version>
|
||||
<abstracto.templates.version>1.4.31</abstracto.templates.version>
|
||||
<apache-jena.version>4.9.0</apache-jena.version>
|
||||
<rssreader.version>3.5.0</rssreader.version>
|
||||
</properties>
|
||||
@@ -39,8 +37,15 @@
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/*</url>
|
||||
<id>github-abstracto</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/abstracto*</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>github-sissi</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/Sissi*</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
@@ -50,16 +55,17 @@
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<id>github-sissi</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/Sheldan/Sissi</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<scm>
|
||||
<url>https://maven.pkg.github.com/Sheldan/Sissi</url>
|
||||
<developerConnection>scm:git:git@github.com:Sheldan/Sissi.git</developerConnection>
|
||||
<tag>sissi-1.4.21</tag>
|
||||
<connection>scm:git:${project.scm.url}</connection>
|
||||
<developerConnection>scm:git:${project.scm.url}</developerConnection>
|
||||
<url>https://github.com/Sheldan/Sissi.git</url>
|
||||
<tag>sissi-1.4.42</tag>
|
||||
</scm>
|
||||
|
||||
</project>
|
||||
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
3
python/modules/debra-rest-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
283
python/modules/debra-rest-api/python/endpoints/debra.py
Normal file
283
python/modules/debra-rest-api/python/endpoints/debra.py
Normal file
@@ -0,0 +1,283 @@
|
||||
from flask import request, render_template
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import requests
|
||||
import os
|
||||
import json
|
||||
import logging
|
||||
import uuid
|
||||
from __main__ import app
|
||||
from utils import flask_utils
|
||||
from datetime import timezone, datetime
|
||||
import pytz
|
||||
|
||||
|
||||
sissi_host = os.getenv('SISSI_HOST')
|
||||
sissi_port = os.getenv('SISSI_PORT')
|
||||
latest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/latestDonations'
|
||||
highest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/highestDonations'
|
||||
campaign_info_url = f'http://{sissi_host}:{sissi_port}/debra/campaignInfo'
|
||||
endless_stream_info_url = f'http://{sissi_host}:{sissi_port}/stream/endlessStream'
|
||||
|
||||
|
||||
class DonationImageGenerationParameters:
|
||||
validation_message = ''
|
||||
validation_value = ''
|
||||
validated = None
|
||||
|
||||
def __init__(self, font_name, font_size, canvas_width, canvas_height, donation_count, r, g, b):
|
||||
self.font_name = font_name
|
||||
self.font_size = font_size
|
||||
self.canvas_width = canvas_width
|
||||
self.canvas_height = canvas_height
|
||||
self.donation_count = donation_count
|
||||
self.color = (r, g, b)
|
||||
|
||||
def validate(self):
|
||||
self.validated = True
|
||||
if self.font_name not in DonationImageGenerationConstants.allowed_fonts:
|
||||
self.validated = False
|
||||
self.validation_message = f'Font must be one of ' + ','.join(DonationImageGenerationConstants.allowed_fonts)
|
||||
self.validation_value = self.font_name
|
||||
|
||||
if self.font_size > DonationImageGenerationConstants.font_range[1] or self.font_size < DonationImageGenerationConstants.font_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Font size must be between {DonationImageGenerationConstants.font_range[0]} and {DonationImageGenerationConstants.font_range[1]}'
|
||||
self.validation_value = self.font_size
|
||||
|
||||
if self.canvas_height > DonationImageGenerationConstants.canvas_height_range[1] or self.canvas_height < DonationImageGenerationConstants.canvas_height_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Canvas height must be between {DonationImageGenerationConstants.canvas_height_range[0]} and {DonationImageGenerationConstants.canvas_height_range[1]}'
|
||||
self.validation_value = self.canvas_height
|
||||
|
||||
if self.canvas_width > DonationImageGenerationConstants.canvas_width_range[1] or self.canvas_width < DonationImageGenerationConstants.canvas_width_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Canvas width must be between {DonationImageGenerationConstants.canvas_width_range[0]} and {DonationImageGenerationConstants.color_range[1]}'
|
||||
self.validation_value = self.canvas_width
|
||||
|
||||
if self.donation_count > DonationImageGenerationConstants.donation_count_range[1] or self.donation_count < DonationImageGenerationConstants.donation_count_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Donation count must be between {DonationImageGenerationConstants.donation_count_range[0]} and {DonationImageGenerationConstants.donation_count_range[1]}'
|
||||
self.validation_value = self.donation_count
|
||||
|
||||
if self.color[0] > DonationImageGenerationConstants.color_range[1] or self.color[0] < DonationImageGenerationConstants.color_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Red must be between {DonationImageGenerationConstants.color_range[0]} and {DonationImageGenerationConstants.color_range[1]} inclusively'
|
||||
self.validation_value = self.color[0]
|
||||
|
||||
if self.color[1] > DonationImageGenerationConstants.color_range[1] or self.color[1] < DonationImageGenerationConstants.color_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Green must be between {DonationImageGenerationConstants.color_range[0]} and {DonationImageGenerationConstants.color_range[1]} inclusively'
|
||||
self.validation_value = self.color[1]
|
||||
|
||||
if self.color[2] > DonationImageGenerationConstants.color_range[1] or self.color[2] < DonationImageGenerationConstants.color_range[0]:
|
||||
self.validated = False
|
||||
self.validation_message = f'Blue must be between {DonationImageGenerationConstants.color_range[0]} and {DonationImageGenerationConstants.color_range[1]} inclusively'
|
||||
self.validation_value = self.color[2]
|
||||
|
||||
|
||||
@app.route('/debra/latestDonations')
|
||||
def latest_donations():
|
||||
donation_stats = requests.get(latest_donations_url)
|
||||
logging.info(f'returning latest donations')
|
||||
return donation_stats.text
|
||||
|
||||
|
||||
@app.route('/debra/highestDonations')
|
||||
def highest_donations():
|
||||
donation_stats = requests.get(highest_donations_url)
|
||||
logging.info(f'returning highest donations')
|
||||
return donation_stats.text
|
||||
|
||||
|
||||
@app.route('/debra/campaignInfo')
|
||||
def campaign_info_route():
|
||||
donation_stats = requests.get(campaign_info_url)
|
||||
logging.info(f'returning campaign info')
|
||||
return donation_stats.text
|
||||
|
||||
|
||||
@app.route('/debra/image/help')
|
||||
def show_image_generation_help():
|
||||
|
||||
def make_param(parameters_obj, name, default, values):
|
||||
parameters_obj[name] = {
|
||||
'default': default,
|
||||
'values': values
|
||||
}
|
||||
parameters = {}
|
||||
make_param(parameters, 'font', DonationImageGenerationConstants.font_default, DonationImageGenerationConstants.allowed_fonts)
|
||||
make_param(parameters, 'fontSize', DonationImageGenerationConstants.font_size_default, DonationImageGenerationConstants.font_range)
|
||||
make_param(parameters, 'canvasWidth', DonationImageGenerationConstants.canvas_width_default, DonationImageGenerationConstants.canvas_width_range)
|
||||
make_param(parameters, 'canvasHeight', DonationImageGenerationConstants.canvas_height_default, DonationImageGenerationConstants.canvas_height_range)
|
||||
make_param(parameters, 'donationCount', DonationImageGenerationConstants.donation_count_default, DonationImageGenerationConstants.donation_count_range)
|
||||
make_param(parameters, 'r', DonationImageGenerationConstants.r_default, DonationImageGenerationConstants.color_range)
|
||||
make_param(parameters, 'g', DonationImageGenerationConstants.g_default, DonationImageGenerationConstants.color_range)
|
||||
make_param(parameters, 'b', DonationImageGenerationConstants.b_default, DonationImageGenerationConstants.color_range)
|
||||
info_object = {
|
||||
'parameters': parameters
|
||||
}
|
||||
return json.dumps(info_object)
|
||||
|
||||
|
||||
@app.route('/debra/image/info')
|
||||
def total_donations_image():
|
||||
campaign_info = json.loads(requests.get(campaign_info_url).text)
|
||||
logging.info(f'rendering campaign info')
|
||||
parameters = parse_image_parameters()
|
||||
if not parameters.validated:
|
||||
return parameters.validation_message, 400
|
||||
img = Image.new('RGBA', (parameters.canvas_width, parameters.canvas_height), (255, 0, 0, 0))
|
||||
d1 = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(f'{parameters.font_name}.ttf', parameters.font_size)
|
||||
d1.text((0, 0), f"{campaign_info['collected']}/{campaign_info['target']}€", fill=parameters.color, font=font)
|
||||
return flask_utils.serve_pil_image(img)
|
||||
|
||||
|
||||
@app.route('/debra/image/endlessStream/end')
|
||||
def endless_stream_image():
|
||||
stream_id = int(request.args.get('streamId', type=int))
|
||||
endless_stream_info = json.loads(requests.get(f'{endless_stream_info_url}/{stream_id}').text)
|
||||
logging.info(f'rendering endless stream end image')
|
||||
parameters = parse_image_parameters()
|
||||
if not parameters.validated:
|
||||
return parameters.validation_message, 400
|
||||
img = Image.new('RGBA', (parameters.canvas_width, parameters.canvas_height), (255, 0, 0, 0))
|
||||
d1 = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(f'{parameters.font_name}.ttf', parameters.font_size)
|
||||
end_time = datetime.strptime(endless_stream_info['endDate'], "%Y-%m-%dT%H:%M:%S%z")
|
||||
tz = pytz.timezone('Europe/Vienna')
|
||||
end_time_formatted = end_time.astimezone(tz).strftime('%d.%m %H:%M')
|
||||
d1.text((0, 0), f"{end_time_formatted}", fill=parameters.color, font=font)
|
||||
return flask_utils.serve_pil_image(img)
|
||||
|
||||
|
||||
@app.route('/debra/image/endlessStream/end/html')
|
||||
def endless_stream_html():
|
||||
refresh_interval = int(request.args.get('refreshInterval', 30, type=int))
|
||||
random_bit = str(uuid.uuid4())
|
||||
parameters_query = request.query_string.decode()
|
||||
return render_template('image_refresh_wrapper.html', imagePath=f'/debra/image/endlessStream/end?{parameters_query}&{random_bit}', refreshInterval=refresh_interval)
|
||||
|
||||
|
||||
@app.route('/debra/image/endlessStream/remaining')
|
||||
def endless_stream_remaining():
|
||||
stream_id = int(request.args.get('streamId', type=int))
|
||||
endless_stream_info = json.loads(requests.get(f'{endless_stream_info_url}/{stream_id}').text)
|
||||
logging.info(f'rendering endless stream remaining image')
|
||||
parameters = parse_image_parameters()
|
||||
if not parameters.validated:
|
||||
return parameters.validation_message, 400
|
||||
img = Image.new('RGBA', (parameters.canvas_width, parameters.canvas_height), (255, 0, 0, 0))
|
||||
d1 = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(f'{parameters.font_name}.ttf', parameters.font_size)
|
||||
end_time = datetime.strptime(endless_stream_info['endDate'], "%Y-%m-%dT%H:%M:%S%z").replace(tzinfo=pytz.utc)
|
||||
current_time = datetime.now(timezone.utc)
|
||||
remaining_time = end_time - current_time
|
||||
total_seconds = remaining_time.total_seconds()
|
||||
remaining_time_formatted = f'{int(total_seconds // 3600):02d}:{int((total_seconds % 3600) // 60):02d}:{int(total_seconds % 60):02d}'
|
||||
d1.text((0, 0), f"{remaining_time_formatted}", fill=parameters.color, font=font)
|
||||
return flask_utils.serve_pil_image(img)
|
||||
|
||||
|
||||
@app.route('/debra/image/endlessStream/remaining/html')
|
||||
def endless_stream_remaining_html():
|
||||
refresh_interval = int(request.args.get('refreshInterval', 30, type=int))
|
||||
random_bit = str(uuid.uuid4())
|
||||
parameters_query = request.query_string.decode()
|
||||
return render_template('image_refresh_wrapper.html', imagePath=f'/debra/image/endlessStream/remaining?{parameters_query}&{random_bit}', refreshInterval=refresh_interval)
|
||||
|
||||
|
||||
@app.route('/debra/image/latestDonations')
|
||||
def latest_donation_image():
|
||||
donation_stats = json.loads(requests.get(latest_donations_url).text)
|
||||
logging.info(f'rendering latest donations')
|
||||
parameters = parse_image_parameters()
|
||||
if not parameters.validated:
|
||||
return parameters.validation_message, 400
|
||||
return rendering_donation_image(donation_stats, parameters)
|
||||
|
||||
|
||||
@app.route('/debra/image/highestDonations')
|
||||
def highest_donation_image():
|
||||
donation_stats = json.loads(requests.get(highest_donations_url).text)
|
||||
logging.info(f'rendering highest donations')
|
||||
parameters = parse_image_parameters()
|
||||
if not parameters.validated:
|
||||
return parameters.validation_message, 400
|
||||
return rendering_donation_image(donation_stats, parameters)
|
||||
|
||||
|
||||
@app.route('/debra/image/highestDonations/html')
|
||||
def highest_donations_image_html_wrapper():
|
||||
refresh_interval = int(request.args.get('refreshInterval', 30, type=int))
|
||||
random_bit = str(uuid.uuid4())
|
||||
parameters_query = request.query_string.decode()
|
||||
return render_template('image_refresh_wrapper.html', imagePath=f'/debra/image/highestDonations?{parameters_query}&{random_bit}', refreshInterval=refresh_interval)
|
||||
|
||||
|
||||
@app.route('/debra/image/latestDonations/html')
|
||||
def latest_donations_image_html_wrapper():
|
||||
refresh_interval = int(request.args.get('refreshInterval', 30, type=int))
|
||||
random_bit = str(uuid.uuid4())
|
||||
parameters_query = request.query_string.decode()
|
||||
return render_template('image_refresh_wrapper.html', imagePath=f'/debra/image/latestDonations?{parameters_query}&{random_bit}', refreshInterval=refresh_interval)
|
||||
|
||||
|
||||
@app.route('/debra/image/info/html')
|
||||
def total_donations_image_html_wrapper():
|
||||
refresh_interval = int(request.args.get('refreshInterval', 30, type=int))
|
||||
random_bit = str(uuid.uuid4())
|
||||
parameters_query = request.query_string.decode()
|
||||
return render_template('image_refresh_wrapper.html', imagePath=f'/debra/image/info?{parameters_query}&{random_bit}', refreshInterval=refresh_interval)
|
||||
|
||||
|
||||
def rendering_donation_image(donation_stats, parameters):
|
||||
img = Image.new('RGBA', (parameters.canvas_width, parameters.canvas_height), (255, 0, 0, 0))
|
||||
d1 = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(f'{parameters.font_name}.ttf', parameters.font_size)
|
||||
donations_to_draw = donation_stats['donations'][:parameters.donation_count]
|
||||
height = parameters.font_size
|
||||
it = 0
|
||||
for donation in donations_to_draw:
|
||||
name = donation['firstName'] if not donation['anonymous'] else 'anonym'
|
||||
d1.text((0, height * it), f"{donation['donationAmount']}€ von {name}", fill=parameters.color, font=font)
|
||||
it += 1
|
||||
return flask_utils.serve_pil_image(img)
|
||||
|
||||
|
||||
def parse_image_parameters() -> DonationImageGenerationParameters:
|
||||
font = request.args.get('font', DonationImageGenerationConstants.font_default, type=str)
|
||||
font_size = int(request.args.get('fontSize', DonationImageGenerationConstants.font_size_default, type=int))
|
||||
canvas_width = int(request.args.get('canvasWidth', DonationImageGenerationConstants.canvas_width_default, type=int))
|
||||
canvas_height = int(request.args.get('canvasHeight', DonationImageGenerationConstants.canvas_height_default, type=int))
|
||||
donation_count = int(request.args.get('donationCount', DonationImageGenerationConstants.donation_count_default, type=int))
|
||||
r = int(request.args.get('r', DonationImageGenerationConstants.r_default, type=int))
|
||||
g = int(request.args.get('g', DonationImageGenerationConstants.g_default, type=int))
|
||||
b = int(request.args.get('b', DonationImageGenerationConstants.b_default, type=int))
|
||||
parameters = DonationImageGenerationParameters(font, font_size, canvas_width, canvas_height, donation_count, r, g, b)
|
||||
parameters.validate()
|
||||
return parameters
|
||||
|
||||
|
||||
class DonationImageGenerationConstants:
|
||||
allowed_fonts = ['Andale_Mono', 'Courier_New', 'Impact', 'Trebuchet_MS_Italic',
|
||||
'Arial', 'Courier_New_Bold', 'Times_New_Roman', 'Verdana',
|
||||
'Arial_Black', 'Courier_New_Bold_Italic', 'Times_New_Roman_Bold', 'Verdana_Bold',
|
||||
'Arial_Bold', 'Courier_New_Italic', 'Times_New_Roman_Bold_Italic', 'Verdana_Bold_Italic',
|
||||
'Arial_Bold_Italic', 'Georgia', 'Times_New_Roman_Italic', 'Verdana_Italic',
|
||||
'Arial_Italic', 'Georgia_Bold', 'Trebuchet_MS',
|
||||
'Comic_Sans_MS', 'Georgia_Bold_Italic', 'Trebuchet_MS_Bold',
|
||||
'Comic_Sans_MS_Bold', 'Georgia_Italic', 'Trebuchet_MS_Bold_Italic']
|
||||
font_range = (2, 150)
|
||||
canvas_width_range = (1, 2500)
|
||||
canvas_height_range = (1, 2500)
|
||||
donation_count_range = (1, 25)
|
||||
color_range = (0, 255)
|
||||
font_default = 'Arial'
|
||||
font_size_default = 40
|
||||
canvas_width_default = 1024
|
||||
canvas_height_default = 300
|
||||
donation_count_default = 5
|
||||
r_default = 0
|
||||
g_default = 0
|
||||
b_default = 0
|
||||
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="{{ refreshInterval }}">
|
||||
</head>
|
||||
<body>
|
||||
<img src="{{ imagePath }}">
|
||||
</body>
|
||||
</html>
|
||||
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
3
python/modules/image-gen-api/docker/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.19.0
|
||||
ADD resources/ /python/resources
|
||||
ADD python /python
|
||||
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
24
python/modules/image-gen-api/python/endpoints/doge.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __main__ import app
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from flask import request
|
||||
import logging
|
||||
|
||||
from utils import flask_utils
|
||||
|
||||
@app.route('/memes/doge/orangeSun/')
|
||||
def doge_orange_sun():
|
||||
text = request.args.get('text')
|
||||
if text is None:
|
||||
return 'no text', 400
|
||||
logging.info(f'Rendering doge orange sun.')
|
||||
with Image.open('resources/img/semf_template.jpg') as im:
|
||||
d1 = ImageDraw.Draw(im)
|
||||
text_box_size = (300, 240)
|
||||
W, H = text_box_size
|
||||
font = ImageFont.truetype(f'Impact.ttf', 60)
|
||||
_, _, w, h = d1.textbbox((0, 0), text, font=font)
|
||||
d1.text(((W-w)/2 + 320, (H-h)/2 + 120), text, font=font, fill=(255, 255, 255))
|
||||
return flask_utils.serve_pil_image(im)
|
||||
|
||||
|
||||
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
BIN
python/modules/image-gen-api/resources/img/semf_template.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
28
settings.xml
28
settings.xml
@@ -16,8 +16,15 @@
|
||||
<url>https://repo1.maven.org/maven2</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/*</url>
|
||||
<id>github-abstracto</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/abstracto*</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>github-sissi</id>
|
||||
<url>https://maven.pkg.github.com/Sheldan/Sissi*</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
@@ -28,9 +35,20 @@
|
||||
|
||||
<servers>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>${env.user}</username>
|
||||
<password>${env.token}</password>
|
||||
<id>github-abstracto</id>
|
||||
<username>${env.abstractoUser}</username>
|
||||
<password>${env.abstractoToken}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>github-sissi</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Authorization</name>
|
||||
<value>Bearer ${env.GITHUB_TOKEN}</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi</groupId>
|
||||
<artifactId>sissi</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>image-generation-customization-templates</artifactId>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<finalName>image-generation-custom-templates-${project.version}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>zip</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>sissi-templates</artifactId>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>moderation-customization-templates</module>
|
||||
<module>image-generation-customization-templates</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>module-templates</artifactId>
|
||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||
<version>1.4.21</version>
|
||||
<version>1.4.42</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user