From 89a76859afea6464d29641ff854f043ee3482515 Mon Sep 17 00:00:00 2001 From: Dejan Date: Fri, 18 Nov 2022 11:20:31 +0100 Subject: [PATCH 1/2] mime type to filename for assets --- src/main/java/com/wire/bots/recording/utils/Collector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/wire/bots/recording/utils/Collector.java b/src/main/java/com/wire/bots/recording/utils/Collector.java index 22e3802..e724708 100644 --- a/src/main/java/com/wire/bots/recording/utils/Collector.java +++ b/src/main/java/com/wire/bots/recording/utils/Collector.java @@ -126,7 +126,8 @@ public void add(RemoteMessage event) throws Exception { } public void add(OriginMessage message) throws ParseException { - addSystem(message.getName(), message.getTime(), "file-preview", message.getMessageId()); + String text = String.format("%s | %s", message.getName(), message.getMimeType()); + addSystem(text, message.getTime(), "file-preview", message.getMessageId()); } public void add(RemoteMessage event, VideoPreviewMessage preview) throws Exception { From 1d1826384f044beeab004373650efbd6972fc90c Mon Sep 17 00:00:00 2001 From: Dejan Date: Wed, 23 Nov 2022 11:18:22 +0100 Subject: [PATCH 2/2] Disable swagger --- src/main/java/com/wire/bots/recording/MessageHandler.java | 3 +++ src/main/java/com/wire/bots/recording/Service.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/wire/bots/recording/MessageHandler.java b/src/main/java/com/wire/bots/recording/MessageHandler.java index 3b567bb..b1f34f6 100644 --- a/src/main/java/com/wire/bots/recording/MessageHandler.java +++ b/src/main/java/com/wire/bots/recording/MessageHandler.java @@ -74,6 +74,9 @@ void warmup(ClientRepo repo) { File file = eventProcessor.saveHtml(client, events, filename, false); Logger.debug("warmed up: %s", file.getName()); Thread.sleep(2 * 1000); + } catch (IOException e) { + Logger.warning("warmup: %s %s.. removing the bot", convId, e); + channelsDAO.delete(convId); } } } catch (Exception e) { diff --git a/src/main/java/com/wire/bots/recording/Service.java b/src/main/java/com/wire/bots/recording/Service.java index ab6ef16..f1b56ff 100644 --- a/src/main/java/com/wire/bots/recording/Service.java +++ b/src/main/java/com/wire/bots/recording/Service.java @@ -26,8 +26,12 @@ import com.wire.xenon.MessageHandlerBase; import io.dropwizard.Application; import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.configuration.EnvironmentVariableSubstitutor; +import io.dropwizard.configuration.SubstitutingSourceProvider; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; +import io.federecio.dropwizard.swagger.SwaggerBundle; +import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration; import java.util.concurrent.ExecutorService; @@ -43,9 +47,11 @@ public static void main(String[] args) throws Exception { @Override public void initialize(Bootstrap bootstrap) { - super.initialize(bootstrap); String workingDir = System.getProperty("user.dir"); + bootstrap.setConfigurationSourceProvider( + new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), + new EnvironmentVariableSubstitutor(false))); bootstrap.addBundle(new AssetsBundle("/scripts", "/scripts", "index.htm", "scripts")); bootstrap.addBundle(new ImagesBundle(workingDir + "/avatars", "/avatars", "avatars")); bootstrap.addBundle(new ImagesBundle(workingDir + "/html", "/channel", "channels"));