mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-07 09:47:52 +00:00
Compare commits
28 Commits
sissi-1.4.
...
9376ac416f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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.34
|
||||||
|
ABSTRACTO_VERSION=1.5.19
|
||||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -33,9 +33,8 @@ jobs:
|
|||||||
id: dotenv
|
id: dotenv
|
||||||
uses: falti/dotenv-action@v1.0.4
|
uses: falti/dotenv-action@v1.0.4
|
||||||
with:
|
with:
|
||||||
path: ./deployment/image-packaging/src/main/docker/.env
|
path: .env
|
||||||
- name: Push container
|
- name: Push container
|
||||||
working-directory: ./deployment/image-packaging/src/main/docker
|
|
||||||
run: docker-compose build && docker-compose push
|
run: docker-compose build && docker-compose push
|
||||||
env:
|
env:
|
||||||
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
||||||
|
|||||||
8
Tiltfile
8
Tiltfile
@@ -2,6 +2,7 @@ allow_k8s_contexts('k8s-cluster')
|
|||||||
|
|
||||||
load('ext://restart_process', 'docker_build_with_restart')
|
load('ext://restart_process', 'docker_build_with_restart')
|
||||||
registry = 'harbor.sheldan.dev/sissi/'
|
registry = 'harbor.sheldan.dev/sissi/'
|
||||||
|
abstracto_registry = 'harbor.sheldan.dev/abstracto/'
|
||||||
|
|
||||||
local_resource(
|
local_resource(
|
||||||
'sissi-java-compile',
|
'sissi-java-compile',
|
||||||
@@ -28,7 +29,12 @@ docker_build_with_restart(
|
|||||||
)
|
)
|
||||||
|
|
||||||
docker_build(registry + 'sissi-db-data', 'deployment/image-packaging/src/main/docker/db-data/')
|
docker_build(registry + 'sissi-db-data', 'deployment/image-packaging/src/main/docker/db-data/')
|
||||||
docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/')
|
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/')
|
docker_build(registry + 'sissi-template-data', 'deployment/image-packaging/src/main/docker/template-data/')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>executable</artifactId>
|
<artifactId>executable</artifactId>
|
||||||
@@ -141,6 +141,11 @@
|
|||||||
<artifactId>giveaway-impl</artifactId>
|
<artifactId>giveaway-impl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>image-generation-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- sissi modules -->
|
<!-- sissi modules -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -175,6 +180,12 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
|
<artifactId>image-generation-custom</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi</groupId>
|
<groupId>dev.sheldan.sissi</groupId>
|
||||||
<artifactId>sissi</artifactId>
|
<artifactId>sissi</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<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.35-SNAPSHOT</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>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
<artifactId>sissi-customizations</artifactId>
|
<artifactId>sissi-customizations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>moderation-custom</module>
|
<module>moderation-custom</module>
|
||||||
|
<module>image-generation-custom</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<artifactId>sissi-modules</artifactId>
|
<artifactId>sissi-modules</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
public class DebraFeatureConfig implements FeatureConfig {
|
public class DebraFeatureConfig implements FeatureConfig {
|
||||||
|
|
||||||
public static final String DEBRA_DONATION_NOTIFICATION_DELAY_CONFIG_KEY = "debraDonationNotificationDelayMillis";
|
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_API_FETCH_SIZE_KEY = "debraDonationApiFetchSize";
|
||||||
public static final String DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME = "DEBRA_DONATION_NOTIFICATION_SERVER_ID";
|
public static final String DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME = "DEBRA_DONATION_NOTIFICATION_SERVER_ID";
|
||||||
@Override
|
@Override
|
||||||
@@ -26,6 +27,6 @@ public class DebraFeatureConfig implements FeatureConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getRequiredSystemConfigKeys() {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package dev.sheldan.sissi.module.debra;
|
package dev.sheldan.sissi.module.debra.exception;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;
|
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;
|
||||||
|
|
||||||
@@ -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,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> {
|
||||||
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package dev.sheldan.sissi.module.debra.service;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.cache.CacheManager;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class DonationCacheService implements InitializingBean {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CacheManager cacheManager;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterPropertiesSet() throws Exception {
|
|
||||||
cacheManager.getCache("donations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
|||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
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.DebraPostTarget;
|
||||||
import dev.sheldan.sissi.module.debra.config.DebraProperties;
|
import dev.sheldan.sissi.module.debra.config.DebraProperties;
|
||||||
import dev.sheldan.sissi.module.debra.converter.DonationConverter;
|
import dev.sheldan.sissi.module.debra.converter.DonationConverter;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,5 +10,8 @@ sissi.debra.donationAPIUrl=https://www.altruja.de/api/page/discord-gg-austria-fu
|
|||||||
abstracto.systemConfigs.debraDonationNotificationDelayMillis.name=debraDonationNotificationDelayMillis
|
abstracto.systemConfigs.debraDonationNotificationDelayMillis.name=debraDonationNotificationDelayMillis
|
||||||
abstracto.systemConfigs.debraDonationNotificationDelayMillis.longValue=60000
|
abstracto.systemConfigs.debraDonationNotificationDelayMillis.longValue=60000
|
||||||
|
|
||||||
|
abstracto.systemConfigs.endlessStreamMinuteRate.name=endlessStreamMinuteRate
|
||||||
|
abstracto.systemConfigs.endlessStreamMinuteRate.longValue=1
|
||||||
|
|
||||||
abstracto.systemConfigs.debraDonationApiFetchSize.name=debraDonationApiFetchSize
|
abstracto.systemConfigs.debraDonationApiFetchSize.name=debraDonationApiFetchSize
|
||||||
abstracto.systemConfigs.debraDonationApiFetchSize.longValue=1000
|
abstracto.systemConfigs.debraDonationApiFetchSize.longValue=1000
|
||||||
@@ -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>
|
||||||
@@ -8,4 +8,5 @@
|
|||||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
<include file="1.3.6/collection.xml" relativeToChangelogFile="true"/>
|
<include file="1.3.6/collection.xml" relativeToChangelogFile="true"/>
|
||||||
<include file="1.4.21/collection.xml" relativeToChangelogFile="true"/>
|
<include file="1.4.21/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="1.4.29/collection.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<artifactId>sissi-modules</artifactId>
|
<artifactId>sissi-modules</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<artifactId>sissi-modules</artifactId>
|
<artifactId>sissi-modules</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>sissi-modules</artifactId>
|
<artifactId>sissi-modules</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.application</groupId>
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# 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.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 1.4.28
|
version: 1.4.34
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# 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
|
# 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.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "1.4.28"
|
appVersion: "1.4.34"
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: api-keys
|
name: api-keys
|
||||||
key: twitchSecret
|
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 }}
|
{{- range $key, $value := .Values.bot.propertyConfig }}
|
||||||
- name: {{ $key | quote }}
|
- name: {{ $key | quote }}
|
||||||
value: {{ $value | 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 }}
|
||||||
@@ -25,7 +25,7 @@ spec:
|
|||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.restApi.podSecurityContext | nindent 8 }}
|
{{- toYaml .Values.restApi.podSecurityContext | nindent 8 }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}-rest-api
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.restApi.securityContext | nindent 12 }}
|
{{- toYaml .Values.restApi.securityContext | nindent 12 }}
|
||||||
image: "{{ .Values.restApi.repository }}/{{ .Values.restApi.image }}:{{ .Values.restApi.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.restApi.repository }}/{{ .Values.restApi.image }}:{{ .Values.restApi.tag | default .Chart.AppVersion }}"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ replicaCount: 1
|
|||||||
|
|
||||||
bot:
|
bot:
|
||||||
repository: harbor.sheldan.dev/sissi
|
repository: harbor.sheldan.dev/sissi
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: Always
|
||||||
image: sissi-bot
|
image: sissi-bot
|
||||||
tag: 1.4.28
|
tag: 1.4.34
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
initialDelaySeconds: 60
|
initialDelaySeconds: 60
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
@@ -23,9 +23,9 @@ bot:
|
|||||||
restApi:
|
restApi:
|
||||||
enabled: true
|
enabled: true
|
||||||
repository: harbor.sheldan.dev/sissi
|
repository: harbor.sheldan.dev/sissi
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: Always
|
||||||
image: sissi-rest-api
|
image: sissi-rest-api
|
||||||
tag: 1.4.28
|
tag: 1.4.34
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
podSecurityContext: {}
|
podSecurityContext: {}
|
||||||
securityContext: {}
|
securityContext: {}
|
||||||
@@ -63,31 +63,63 @@ restApi:
|
|||||||
extraPaths: []
|
extraPaths: []
|
||||||
tls: []
|
tls: []
|
||||||
|
|
||||||
|
privateRestApi:
|
||||||
|
enabled: true
|
||||||
|
repository: harbor.sheldan.dev/sissi
|
||||||
|
pullPolicy: Always
|
||||||
|
image: sissi-private-rest-api
|
||||||
|
tag: 1.4.34
|
||||||
|
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:
|
templateDeployment:
|
||||||
enabled: true
|
enabled: true
|
||||||
repository: harbor.sheldan.dev/abstracto
|
repository: harbor.sheldan.dev/abstracto
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
image: abstracto-template-deployment
|
image: abstracto-template-deployment
|
||||||
tag: 1.5.13
|
tag: 1.5.19
|
||||||
|
|
||||||
templateDeploymentData:
|
templateDeploymentData:
|
||||||
repository: harbor.sheldan.dev/sissi
|
repository: harbor.sheldan.dev/sissi
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
image: sissi-template-data
|
image: sissi-template-data
|
||||||
tag: 1.4.28
|
tag: 1.4.34
|
||||||
|
|
||||||
dbConfigDeployment:
|
dbConfigDeployment:
|
||||||
enabled: true
|
enabled: true
|
||||||
repository: harbor.sheldan.dev/abstracto
|
repository: harbor.sheldan.dev/abstracto
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
image: abstracto-db-deployment
|
image: abstracto-db-deployment
|
||||||
tag: 1.5.13
|
tag: 1.5.19
|
||||||
|
|
||||||
dbConfigDeploymentData:
|
dbConfigDeploymentData:
|
||||||
repository: harbor.sheldan.dev/sissi
|
repository: harbor.sheldan.dev/sissi
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
image: sissi-db-data
|
image: sissi-db-data
|
||||||
tag: 1.4.28
|
tag: 1.4.34
|
||||||
|
|
||||||
dbCredentials:
|
dbCredentials:
|
||||||
host:
|
host:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
|||||||
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
|
|
||||||
VERSION=1.4.28
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
||||||
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
||||||
{ "zip": "giveaway", "file": "giveaway-changeLog.xml"},
|
{ "zip": "giveaway", "file": "giveaway-changeLog.xml"},
|
||||||
|
{ "zip": "image-generation", "file": "imageGeneration-changeLog.xml"},
|
||||||
{ "zip": "meetup", "file": "meetup-changeLog.xml"},
|
{ "zip": "meetup", "file": "meetup-changeLog.xml"},
|
||||||
{ "zip": "rss-news", "file": "rssNews-changeLog.xml"},
|
{ "zip": "rss-news", "file": "rssNews-changeLog.xml"},
|
||||||
{ "zip": "debra", "file": "debra-changeLog.xml"},
|
{ "zip": "debra", "file": "debra-changeLog.xml"},
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
version: "3.7"
|
|
||||||
|
|
||||||
services:
|
|
||||||
bot:
|
|
||||||
build:
|
|
||||||
context: sissi
|
|
||||||
image: ${REGISTRY_PREFIX}sissi-bot:${VERSION:-latest}
|
|
||||||
rest-api:
|
|
||||||
build:
|
|
||||||
context: rest-api
|
|
||||||
image: ${REGISTRY_PREFIX}sissi-rest-api:${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
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
FROM python:3.10.13-alpine3.18
|
ARG REGISTRY_PREFIX
|
||||||
ADD requirements.txt /
|
ARG SISSI_REGISTRY_PREFIX
|
||||||
RUN pip install -r requirements.txt
|
ARG VERSION
|
||||||
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
|
ARG ABSTRACTO_VERSION
|
||||||
update-ms-fonts && \
|
FROM ${SISSI_REGISTRY_PREFIX}sissi-debra-rest-api:${VERSION:-latest} AS debra-api
|
||||||
fc-cache -f
|
|
||||||
ADD wrapper /
|
|
||||||
ADD python /python
|
FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest}
|
||||||
CMD ["/run.sh"]
|
COPY --from=debra-api /python /python
|
||||||
@@ -1 +0,0 @@
|
|||||||
*
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
blinker==1.7.0
|
|
||||||
certifi==2023.7.22
|
|
||||||
charset-normalizer==3.3.2
|
|
||||||
click==8.1.7
|
|
||||||
Flask==3.0.0
|
|
||||||
idna==3.4
|
|
||||||
importlib-metadata==6.8.0
|
|
||||||
itsdangerous==2.1.2
|
|
||||||
Jinja2==3.1.2
|
|
||||||
MarkupSafe==2.1.3
|
|
||||||
Pillow==10.1.0
|
|
||||||
requests==2.31.0
|
|
||||||
urllib3==2.0.7
|
|
||||||
waitress==2.1.2
|
|
||||||
Werkzeug==3.0.1
|
|
||||||
zipp==3.17.0
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "Starting python server..."
|
|
||||||
cd python && python3 -u main.py
|
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
{
|
{
|
||||||
"template_artifacts": [
|
"template_artifacts": [
|
||||||
"core","starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "remind", "suggestion", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
"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",
|
"quotes", "meetup", "debra", "rss-news",
|
||||||
"moderation-custom",
|
"moderation-custom", "image-generation-custom",
|
||||||
"moderation-template-overrides", "experience-template-overrides", "logging-template-overrides"
|
"moderation-template-overrides", "experience-template-overrides", "logging-template-overrides"
|
||||||
],
|
],
|
||||||
"translation_artifacts": [
|
"translation_artifacts": [
|
||||||
"core",
|
"core",
|
||||||
"starboard", "link-embed", "moderation", "entertainment", "custom-command", "utility", "webservices", "suggestion", "remind", "modmail", "assignable-roles", "experience-tracking", "logging", "statistic", "twitch", "giveaway",
|
"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",
|
"quotes", "meetup", "debra", "rss-news",
|
||||||
"moderation-custom",
|
"moderation-custom",
|
||||||
"moderation-translation-overrides", "experience-translation-overrides", "logging-translation-overrides"
|
"moderation-translation-overrides", "experience-translation-overrides", "logging-translation-overrides"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi</groupId>
|
<groupId>dev.sheldan.sissi</groupId>
|
||||||
<artifactId>sissi</artifactId>
|
<artifactId>sissi</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<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}
|
||||||
10
pom.xml
10
pom.xml
@@ -13,15 +13,13 @@
|
|||||||
<groupId>dev.sheldan.sissi</groupId>
|
<groupId>dev.sheldan.sissi</groupId>
|
||||||
<artifactId>sissi</artifactId>
|
<artifactId>sissi</artifactId>
|
||||||
<name>Sissi</name>
|
<name>Sissi</name>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<!-- edit in release.yml as well -->
|
<abstracto.version>1.5.19</abstracto.version>
|
||||||
<!-- when releasing a new bot version, update the .env as well-->
|
<abstracto.templates.version>1.4.28</abstracto.templates.version>
|
||||||
<abstracto.version>1.5.13</abstracto.version>
|
|
||||||
<abstracto.templates.version>1.4.24</abstracto.templates.version>
|
|
||||||
<apache-jena.version>4.9.0</apache-jena.version>
|
<apache-jena.version>4.9.0</apache-jena.version>
|
||||||
<rssreader.version>3.5.0</rssreader.version>
|
<rssreader.version>3.5.0</rssreader.version>
|
||||||
</properties>
|
</properties>
|
||||||
@@ -59,7 +57,7 @@
|
|||||||
<scm>
|
<scm>
|
||||||
<url>https://maven.pkg.github.com/Sheldan/Sissi</url>
|
<url>https://maven.pkg.github.com/Sheldan/Sissi</url>
|
||||||
<developerConnection>scm:git:git@github.com:Sheldan/Sissi.git</developerConnection>
|
<developerConnection>scm:git:git@github.com:Sheldan/Sissi.git</developerConnection>
|
||||||
<tag>sissi-1.4.28</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
</project>
|
</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
|
||||||
@@ -6,13 +6,17 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
from __main__ import app
|
from __main__ import app
|
||||||
from utils import serve_pil_image
|
from utils import flask_utils
|
||||||
|
from datetime import timezone, datetime
|
||||||
|
import pytz
|
||||||
|
|
||||||
|
|
||||||
sissi_host = os.getenv('SISSI_HOST')
|
sissi_host = os.getenv('SISSI_HOST')
|
||||||
sissi_port = os.getenv('SISSI_PORT')
|
sissi_port = os.getenv('SISSI_PORT')
|
||||||
latest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/latestDonations'
|
latest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/latestDonations'
|
||||||
highest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/highestDonations'
|
highest_donations_url = f'http://{sissi_host}:{sissi_port}/debra/highestDonations'
|
||||||
campaign_info_url = f'http://{sissi_host}:{sissi_port}/debra/campaignInfo'
|
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:
|
class DonationImageGenerationParameters:
|
||||||
@@ -126,7 +130,61 @@ def total_donations_image():
|
|||||||
d1 = ImageDraw.Draw(img)
|
d1 = ImageDraw.Draw(img)
|
||||||
font = ImageFont.truetype(f'{parameters.font_name}.ttf', parameters.font_size)
|
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)
|
d1.text((0, 0), f"{campaign_info['collected']}/{campaign_info['target']}€", fill=parameters.color, font=font)
|
||||||
return serve_pil_image(img)
|
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')
|
@app.route('/debra/image/latestDonations')
|
||||||
@@ -184,7 +242,7 @@ def rendering_donation_image(donation_stats, parameters):
|
|||||||
name = donation['firstName'] if not donation['anonymous'] else 'anonym'
|
name = donation['firstName'] if not donation['anonymous'] else 'anonym'
|
||||||
d1.text((0, height * it), f"{donation['donationAmount']}€ von {name}", fill=parameters.color, font=font)
|
d1.text((0, height * it), f"{donation['donationAmount']}€ von {name}", fill=parameters.color, font=font)
|
||||||
it += 1
|
it += 1
|
||||||
return serve_pil_image(img)
|
return flask_utils.serve_pil_image(img)
|
||||||
|
|
||||||
|
|
||||||
def parse_image_parameters() -> DonationImageGenerationParameters:
|
def parse_image_parameters() -> DonationImageGenerationParameters:
|
||||||
@@ -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
|
||||||
@@ -2,18 +2,23 @@ from __main__ import app
|
|||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from flask import request
|
from flask import request
|
||||||
|
import logging
|
||||||
|
|
||||||
from utils import serve_pil_image
|
from utils import flask_utils
|
||||||
|
|
||||||
|
|
||||||
@app.route('/memes/doge/orangeSun/')
|
@app.route('/memes/doge/orangeSun/')
|
||||||
def image_gen():
|
def doge_orange_sun():
|
||||||
text = request.args.get('text')
|
text = request.args.get('text')
|
||||||
with Image.open('res/img/semf_template.jpg') as im:
|
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)
|
d1 = ImageDraw.Draw(im)
|
||||||
text_box_size = (300, 240)
|
text_box_size = (300, 240)
|
||||||
W, H = text_box_size
|
W, H = text_box_size
|
||||||
font = ImageFont.truetype(f'Impact.ttf', 60)
|
font = ImageFont.truetype(f'Impact.ttf', 60)
|
||||||
_, _, w, h = d1.textbbox((0, 0), text, font=font)
|
_, _, 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))
|
d1.text(((W-w)/2 + 320, (H-h)/2 + 120), text, font=font, fill=(255, 255, 255))
|
||||||
return serve_pil_image(im)
|
return flask_utils.serve_pil_image(im)
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,23 +0,0 @@
|
|||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
||||||
logging.basicConfig(encoding='utf-8', level=logging.INFO, format=FORMAT)
|
|
||||||
template_dir = os.path.abspath('res/templates')
|
|
||||||
app = Flask(__name__, template_folder=template_dir)
|
|
||||||
|
|
||||||
# loads the api end points
|
|
||||||
import debra
|
|
||||||
import image_gen
|
|
||||||
|
|
||||||
@app.route('/')
|
|
||||||
def hello():
|
|
||||||
return 'Hello, World?'
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
from waitress import serve
|
|
||||||
|
|
||||||
serve(app, host="0.0.0.0", port=8080)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<meta http-equiv="refresh" content="{{ refreshInterval }}">
|
|
||||||
<html>
|
|
||||||
<head></head>
|
|
||||||
<body>
|
|
||||||
<img src="{{ imagePath }}">
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
from io import BytesIO
|
|
||||||
|
|
||||||
from flask import send_file
|
|
||||||
|
|
||||||
|
|
||||||
def serve_pil_image(pil_img):
|
|
||||||
img_io = BytesIO()
|
|
||||||
pil_img.save(img_io, 'PNG')
|
|
||||||
img_io.seek(0)
|
|
||||||
return send_file(img_io, mimetype='image/png')
|
|
||||||
|
|
||||||
|
|
||||||
class ValidationException(Exception):
|
|
||||||
def __init__(self, provided_value, message):
|
|
||||||
self.provided_value = provided_value
|
|
||||||
self.message = message
|
|
||||||
super().__init__(f'{self.message}: provided value: {provided_value}')
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi</groupId>
|
<groupId>dev.sheldan.sissi</groupId>
|
||||||
<artifactId>sissi</artifactId>
|
<artifactId>sissi</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<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.35-SNAPSHOT</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>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>customization-templates</artifactId>
|
<artifactId>customization-templates</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>sissi-templates</artifactId>
|
<artifactId>sissi-templates</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>moderation-customization-templates</module>
|
<module>moderation-customization-templates</module>
|
||||||
|
<module>image-generation-customization-templates</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>module-templates</artifactId>
|
<artifactId>module-templates</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>module-templates</artifactId>
|
<artifactId>module-templates</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>sissi-templates</artifactId>
|
<artifactId>sissi-templates</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>module-templates</artifactId>
|
<artifactId>module-templates</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>module-templates</artifactId>
|
<artifactId>module-templates</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>templates</artifactId>
|
<artifactId>templates</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>template-overrides</artifactId>
|
<artifactId>template-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>template-overrides</artifactId>
|
<artifactId>template-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>template-overrides</artifactId>
|
<artifactId>template-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>sissi-templates</artifactId>
|
<artifactId>sissi-templates</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>customization-translations</artifactId>
|
<artifactId>customization-translations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>sissi-translations</artifactId>
|
<artifactId>sissi-translations</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>module-translations</artifactId>
|
<artifactId>module-translations</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
The amount of records fetched from the Debra api. Default: ${defaultValue}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
The amount of time (in milliseconds) after which the donation notification should be sent. Default: ${defaultValue}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
The amount of minutes per euro donation. Default: ${defaultValue}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>module-translations</artifactId>
|
<artifactId>module-translations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>sissi-translations</artifactId>
|
<artifactId>sissi-translations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>module-translations</artifactId>
|
<artifactId>module-translations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>module-translations</artifactId>
|
<artifactId>module-translations</artifactId>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>templates</artifactId>
|
<artifactId>templates</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
<artifactId>translation-overrides</artifactId>
|
<artifactId>translation-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
<artifactId>translation-overrides</artifactId>
|
<artifactId>translation-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
<artifactId>translation-overrides</artifactId>
|
<artifactId>translation-overrides</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>sissi-translations</artifactId>
|
<artifactId>sissi-translations</artifactId>
|
||||||
<version>1.4.28</version>
|
<version>1.4.35-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user