Skip to content

Commit

Permalink
Fixed an issue with !list pageNum not returning with large sound file…
Browse files Browse the repository at this point in the history
… lists. Also, fixing a test. Removing old webui files. Fixing the category display to ensure it's always in alphabetic order. Changed the Docker file to now overwrite the application.properties file if it's already there. Fixed a unit test.
  • Loading branch information
Darkside138 committed Apr 13, 2022
1 parent 2935363 commit 12782f3
Show file tree
Hide file tree
Showing 32 changed files with 21 additions and 10,142 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ EXPOSE 8080

COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
9 changes: 8 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#!/bin/sh
set -e

#Make config directory if it doesn't already exist
mkdir -p /etc/DiscordSoundboard/config
[ -f /etc/DiscordSoundboard/bin/application.properties ] && mv /etc/DiscordSoundboard/bin/application.properties /etc/DiscordSoundboard/config/application.properties
#If the file is still in /bin move it to ../config so that we can expose that as a persistent directory
# on something like unraid. Only moves the file if it's not already there.
[ -f /etc/DiscordSoundboard/bin/application.properties ] && mv -n /etc/DiscordSoundboard/bin/application.properties /etc/DiscordSoundboard/config/application.properties

cd /etc/DiscordSoundboard/config

#Overwrite the bottoken and username to join channel config entries from environment variables passed into docker run
sed -i 's/bot_token=SOME_TOKEN_YOU_GOT_FROM_DISCORD/bot_token='$bottoken'/g' application.properties
sed -i 's/username_to_join_channel=YourUserName/username_to_join_channel='$username'/g' application.properties

cd /etc/DiscordSoundboard/bin

#Copy the jar file into the bin dir. This wouldn't be necessary if we setup the class path to look in the lib dir. Should probably update this later
cp /etc/DiscordSoundboard/lib/DiscordSoundboard* /etc/DiscordSoundboard/bin/DiscordSoundboard.jar

#Run the bot. Pass the /config/application.properties as part of the classpath, other wise the bot will not work
exec java -Dserver.port=8080 -jar /etc/DiscordSoundboard/bin/DiscordSoundboard.jar --spring.config.location=classpath:file:///etc/DiscordSoundboard/config/application.properties

exec "$@"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
projectVersion = 3.2.2
projectVersion = 3.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected void execute(CommandEvent event) {
}

private List<String> getCommandList(StringBuilder commandString) {
final int maxLineLength = botConfig.getMessageSizeLimit();
final int maxLineLength = botConfig.getMessageSizeLimit() - 10;
List<String> soundFiles = new ArrayList<>();

//if text has \n, \r or \t symbols it's better to split by \s+
Expand All @@ -68,7 +68,7 @@ private List<String> getCommandList(StringBuilder commandString) {
for (int i = 0; i < tokens.length; i++) {
String word = tokens[i];

if (lineLen + (word).length() > maxLineLength) {
if (lineLen + (word).length() > maxLineLength + 2) {
if (i > 0) {
output.append("```\n");
soundFiles.add(output.toString());
Expand Down
Binary file removed src/main/webapp/images/backgroundpattern.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-bg_glass_40_ffc73d_1x400.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/main/webapp/images/ui-bg_loop_25_000000_21x21.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-icons_222222_256x240.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-icons_4b8e0b_256x240.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-icons_a83300_256x240.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-icons_cccccc_256x240.png
Binary file not shown.
Binary file removed src/main/webapp/images/ui-icons_ffffff_256x240.png
Binary file not shown.
Binary file removed src/main/webapp/images/volume-background.png
Binary file not shown.
Binary file removed src/main/webapp/images/volume-empty.png
Binary file not shown.
Binary file removed src/main/webapp/images/volume-full.png
Binary file not shown.
Binary file removed src/main/webapp/images/volume-knob.png
Binary file not shown.
10 changes: 8 additions & 2 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,19 @@
function determineShownNavigation(){
// Get available width for shown categories.
// 275px extra for spacing, more-dropdown and buttons
var availableWidth = window.innerWidth - $('.navbar-brand').width() - 275;
var availableWidth = window.innerWidth - $('.navbar-brand').width() - 230;
console.log(availableWidth);
var shouldSkip = false;
$.each($('#categories li'), function(i, obj){
var willFit = availableWidth - $(obj).width() > 0;
if (shouldSkip) willFit=false;
$(obj).toggle(willFit);
$('#more a[data-category="' + $(obj).find('a').data('category') + '"]').toggle(!willFit);
if(willFit) availableWidth -= $(obj).width();
if (willFit) {
availableWidth -= $(obj).width();
} else {
shouldSkip = true;
}
});
$('#more').toggle($('#categories li:hidden').length > 0);
}
Expand Down
36 changes: 0 additions & 36 deletions src/main/webapp/index_old.html

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/webapp/jquery-ui.min.css

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/webapp/jquery-ui.structure.min.css

This file was deleted.

Loading

0 comments on commit 12782f3

Please sign in to comment.