Compare commits

...

36 Commits

Author SHA1 Message Date
Sheldan
3e147a37d9 [maven-release-plugin] prepare release sissi-1.4.36 2023-12-29 00:51:22 +01:00
Sheldan
99dca4906a [SIS-xxx] updating abstracto and preparing for release 2023-12-29 00:27:23 +01:00
Sheldan
32bfefc5b2 [maven-release-plugin] prepare for next development iteration 2023-12-28 22:56:31 +01:00
Sheldan
aa135b4663 [maven-release-plugin] prepare release sissi-1.4.35 2023-12-28 22:56:27 +01:00
Sheldan
4ffb5e5640 [SIS-xxx] updating abstracto and preparing for release 2023-12-28 22:40:16 +01:00
Sheldan
9376ac416f [maven-release-plugin] prepare for next development iteration 2023-12-26 21:29:35 +01:00
Sheldan
7cf44c99b7 [maven-release-plugin] prepare release sissi-1.4.34 2023-12-26 21:29:31 +01:00
Sheldan
5dce059d2b [SIS-xxx] updating abstracto and preparing for release 2023-12-26 21:28:51 +01:00
Sheldan
da30a120d7 [maven-release-plugin] prepare for next development iteration 2023-12-25 01:29:54 +01:00
Sheldan
49875b2467 [maven-release-plugin] prepare release sissi-1.4.33 2023-12-25 01:29:50 +01:00
Sheldan
2236710086 [SIS-xxx] preparing for release 2023-12-25 01:24:36 +01:00
Sheldan
99b266e94a [SIS-xxx] updating abstracto version 2023-12-25 01:24:07 +01:00
Sheldan
974ab230ac [SIS-xxx] fixing orange sun doge command alternative not handling replies correctly 2023-12-24 01:08:34 +01:00
Sheldan
e5239f971c [maven-release-plugin] prepare for next development iteration 2023-12-23 23:43:04 +01:00
Sheldan
23db0b7c9e [maven-release-plugin] prepare release sissi-1.4.32 2023-12-23 23:43:01 +01:00
Sheldan
8167accd34 [SIS-xxx] preparing for release
updating more abstracto versions
2023-12-23 23:42:23 +01:00
Sheldan
375045f508 [SIS-xxx] updating abstracto version 2023-12-23 23:41:16 +01:00
Sheldan
3f4d5510d8 [maven-release-plugin] prepare for next development iteration 2023-12-23 22:35:20 +01:00
Sheldan
ba67f65bea [maven-release-plugin] prepare release sissi-1.4.31 2023-12-23 22:35:16 +01:00
Sheldan
1b7c2263ae [SIS-xxx] preparing for release 2023-12-23 22:34:53 +01:00
Sheldan
f065bf5244 [SIS-xxx] fixing docker compose file 2023-12-23 22:33:56 +01:00
Sheldan
e036fd0867 [maven-release-plugin] prepare for next development iteration 2023-12-23 22:21:45 +01:00
Sheldan
96960d77ac [maven-release-plugin] prepare release sissi-1.4.30 2023-12-23 22:21:41 +01:00
Sheldan
3894d4567e [SIS-xxx] preparing for release 2023-12-23 22:21:07 +01:00
Sheldan
503fd2520d [SIS-xxx] updating abstracto version
restructuring api to private and public rest api
adding custom image generation module
2023-12-23 22:20:18 +01:00
Sheldan
58d6b12a67 [SIS-xxx] refactoring to use a base image for rest api instead of a zipfile
changing image pull policy for rest api and bot to always
renaming rest api container
2023-12-20 21:07:59 +01:00
Sheldan
4128274a7d [SIS-xxx] refactoring rest api to use a common code base 2023-12-19 01:26:27 +01:00
Sheldan
3b498c5d3f [SIS-xxx] fixing abstracto deployment versions after upgrade 2023-12-12 21:29:39 +01:00
Sheldan
c6bdcaa84c [maven-release-plugin] prepare for next development iteration 2023-12-12 20:17:10 +01:00
Sheldan
90f3dd0ae9 [maven-release-plugin] prepare release sissi-1.4.29 2023-12-12 20:17:06 +01:00
Sheldan
cd482d640f [SIS-xxx] prepare for release 2023-12-12 20:16:06 +01:00
Sheldan
ae2f88daa3 [SIS-xxx] adding endless stream feature
updating abstracto version
2023-12-12 20:14:55 +01:00
Sheldan
c13f40fd3b [maven-release-plugin] prepare for next development iteration 2023-12-10 14:59:33 +01:00
Sheldan
37147a866f [maven-release-plugin] prepare release sissi-1.4.28 2023-12-10 14:59:29 +01:00
Sheldan
9a7d0613b1 [SIS-xxx] enabling giveaway module
updating to newer abstracto version
preparing for release
2023-12-10 14:58:19 +01:00
Sheldan
7e60447ae6 [maven-release-plugin] prepare for next development iteration 2023-12-01 23:39:45 +01:00
91 changed files with 1596 additions and 974 deletions

4
.env Normal file
View File

@@ -0,0 +1,4 @@
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
ABSTRACTO_PREFIX=harbor.sheldan.dev/abstracto/
VERSION=1.4.36
ABSTRACTO_VERSION=1.5.21

View File

@@ -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 }}

View File

@@ -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,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-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/')

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application</groupId>
<artifactId>application</artifactId>
<version>1.4.27</version>
<version>1.4.36</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>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi</groupId>
<artifactId>sissi</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -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.36</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>

View File

@@ -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>

View File

@@ -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;
}
}

View File

@@ -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 {
}

View File

@@ -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()));
}
}
}

View File

@@ -0,0 +1 @@
abstracto.feature.imagegeneration.doge.orangeSun.url=http://${PRIVATE_REST_API_HOST}:${PRIVATE_REST_API_PORT}/memes/doge/orangeSun/?text={1}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
<artifactId>sissi-customizations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>application</artifactId>
<groupId>dev.sheldan.sissi.application</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -13,6 +13,7 @@
<modules>
<module>moderation-custom</module>
<module>image-generation-custom</module>
</modules>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application</groupId>
<artifactId>sissi-modules</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -1,4 +1,4 @@
package dev.sheldan.sissi.module.debra;
package dev.sheldan.sissi.module.debra.exception;
import dev.sheldan.abstracto.core.exception.AbstractoTemplatableException;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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");
}
}

View File

@@ -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.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;

View File

@@ -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);
}
}

View File

@@ -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.longValue=60000
abstracto.systemConfigs.endlessStreamMinuteRate.name=endlessStreamMinuteRate
abstracto.systemConfigs.endlessStreamMinuteRate.longValue=1
abstracto.systemConfigs.debraDonationApiFetchSize.name=debraDonationApiFetchSize
abstracto.systemConfigs.debraDonationApiFetchSize.longValue=1000

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -8,4 +8,5 @@
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>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application</groupId>
<artifactId>sissi-modules</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application</groupId>
<artifactId>application</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.application</groupId>
<artifactId>sissi-modules</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>sissi-modules</artifactId>
<groupId>dev.sheldan.sissi.application</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -15,10 +15,10 @@ 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.27
version: 1.4.36
# 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.27"
appVersion: "1.4.36"

View File

@@ -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}}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -25,7 +25,7 @@ spec:
securityContext:
{{- toYaml .Values.restApi.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
- 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 }}"

View File

@@ -6,9 +6,9 @@ replicaCount: 1
bot:
repository: harbor.sheldan.dev/sissi
pullPolicy: IfNotPresent
pullPolicy: Always
image: sissi-bot
tag: 1.4.27
tag: 1.4.36
livenessProbe:
initialDelaySeconds: 60
periodSeconds: 5
@@ -23,9 +23,9 @@ bot:
restApi:
enabled: true
repository: harbor.sheldan.dev/sissi
pullPolicy: IfNotPresent
pullPolicy: Always
image: sissi-rest-api
tag: 1.4.27
tag: 1.4.36
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
@@ -63,31 +63,63 @@ restApi:
extraPaths: []
tls: []
privateRestApi:
enabled: true
repository: harbor.sheldan.dev/sissi
pullPolicy: Always
image: sissi-private-rest-api
tag: 1.4.36
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.21
templateDeploymentData:
repository: harbor.sheldan.dev/sissi
pullPolicy: Always
image: sissi-template-data
tag: 1.4.27
tag: 1.4.36
dbConfigDeployment:
enabled: true
repository: harbor.sheldan.dev/abstracto
pullPolicy: Always
image: abstracto-db-deployment
tag: 1.5.12
tag: 1.5.21
dbConfigDeploymentData:
repository: harbor.sheldan.dev/sissi
pullPolicy: Always
image: sissi-db-data
tag: 1.4.27
tag: 1.4.36
dbCredentials:
host:

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
VERSION=1.4.27

View File

@@ -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"},

View File

@@ -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}

View File

@@ -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

View File

@@ -1,9 +1,9 @@
FROM python:3.10.13-alpine3.18
ADD requirements.txt /
RUN pip install -r requirements.txt
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
update-ms-fonts && \
fc-cache -f
ADD wrapper /
ADD python /python
CMD ["/run.sh"]
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

View File

@@ -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

View File

@@ -1,4 +0,0 @@
#!/bin/sh
echo "Starting python server..."
cd python && python3 -u main.py

View File

@@ -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"

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi</groupId>
<artifactId>sissi</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

43
docker-compose.yml Normal file
View 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
View File

@@ -13,15 +13,13 @@
<groupId>dev.sheldan.sissi</groupId>
<artifactId>sissi</artifactId>
<name>Sissi</name>
<version>1.4.27</version>
<version>1.4.36</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.21</abstracto.version>
<abstracto.templates.version>1.4.29</abstracto.templates.version>
<apache-jena.version>4.9.0</apache-jena.version>
<rssreader.version>3.5.0</rssreader.version>
</properties>
@@ -59,7 +57,7 @@
<scm>
<url>https://maven.pkg.github.com/Sheldan/Sissi</url>
<developerConnection>scm:git:git@github.com:Sheldan/Sissi.git</developerConnection>
<tag>sissi-1.4.27</tag>
<tag>sissi-1.4.36</tag>
</scm>
</project>

View File

@@ -0,0 +1,3 @@
FROM alpine:3.19.0
ADD resources/ /python/resources
ADD python /python

View File

@@ -6,13 +6,17 @@ import json
import logging
import uuid
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_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:
@@ -126,7 +130,61 @@ def total_donations_image():
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 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')
@@ -184,7 +242,7 @@ def rendering_donation_image(donation_stats, parameters):
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 serve_pil_image(img)
return flask_utils.serve_pil_image(img)
def parse_image_parameters() -> DonationImageGenerationParameters:

View File

@@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="{{ refreshInterval }}">
</head>
<body>
<img src="{{ imagePath }}">
</body>
</html>

View File

@@ -0,0 +1,3 @@
FROM alpine:3.19.0
ADD resources/ /python/resources
ADD python /python

View File

@@ -2,18 +2,23 @@ from __main__ import app
from PIL import Image, ImageDraw, ImageFont
from flask import request
import logging
from utils import serve_pil_image
from utils import flask_utils
@app.route('/memes/doge/orangeSun/')
def image_gen():
def doge_orange_sun():
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)
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 serve_pil_image(im)
return flask_utils.serve_pil_image(im)

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -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)

View File

@@ -1,7 +0,0 @@
<meta http-equiv="refresh" content="{{ refreshInterval }}">
<html>
<head></head>
<body>
<img src="{{ imagePath }}">
</body>
</html>

View File

@@ -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}')

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi</groupId>
<artifactId>sissi</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -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.36</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>

View File

@@ -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>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>customization-templates</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>sissi-templates</artifactId>
<groupId>dev.sheldan.sissi.templates</groupId>
<version>1.4.27</version>
<version>1.4.36</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>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>module-templates</artifactId>
<groupId>dev.sheldan.sissi.templates</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>module-templates</artifactId>
<groupId>dev.sheldan.sissi.templates</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>sissi-templates</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>module-templates</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>module-templates</artifactId>
<groupId>dev.sheldan.sissi.templates</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>templates</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>template-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>template-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>template-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>sissi-templates</artifactId>
<groupId>dev.sheldan.sissi.templates</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<artifactId>customization-translations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>sissi-translations</artifactId>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>module-translations</artifactId>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -0,0 +1 @@
The amount of records fetched from the Debra api. Default: ${defaultValue}

View File

@@ -0,0 +1 @@
The amount of time (in milliseconds) after which the donation notification should be sent. Default: ${defaultValue}

View File

@@ -0,0 +1 @@
The amount of minutes per euro donation. Default: ${defaultValue}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<artifactId>module-translations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<artifactId>sissi-translations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<artifactId>module-translations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>module-translations</artifactId>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates</groupId>
<artifactId>templates</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
<artifactId>translation-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
<artifactId>translation-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
<artifactId>translation-overrides</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.sissi.templates.translations</groupId>
<artifactId>sissi-translations</artifactId>
<version>1.4.27</version>
<version>1.4.36</version>
</parent>
<modelVersion>4.0.0</modelVersion>