diff --git a/gradle.properties b/gradle.properties index 5576ec9..9f8614b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.8.0.8 +VERSION = 0.8.0.9 CODENAME = putian diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index 2c188e6..4d26476 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,7 +4,7 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.8.0.8"; + public static final String VERSION = "0.8.0.9"; public static final String CODENAME = "putian"; - public static final long COMPILE_TIMESTAMP = 1665999835121L; + public static final long COMPILE_TIMESTAMP = 1666081545158L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/Encryptor.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/Encryptor.java index 485a562..e770b9f 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/Encryptor.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/Encryptor.java @@ -39,7 +39,9 @@ public class Encryptor implements ITelegramCommand { MornyCoeur.extra().exec(new SendMessage( event.message().chat().id(), """ base64, b64 + base64url, base64u, b64u base64decode, base64d, b64d + base64url-decode, base64ud, b64ud sha1 sha256 sha512 @@ -132,8 +134,9 @@ public class Encryptor implements ITelegramCommand { byte[] result = null; String resultName = null; switch (command.getArgs()[0]) { - case "base64", "b64" -> { - result = Base64.getEncoder().encode(data); + case "base64", "b64", "base64url", "base64u", "b64u" -> { + final Base64.Encoder b64tool = command.getArgs()[0].contains("u") ? Base64.getUrlEncoder() : Base64.getEncoder(); + result = b64tool.encode(data); if (!inputText) { echoString = false; resultName = dataName+".b64.txt"; @@ -141,8 +144,9 @@ public class Encryptor implements ITelegramCommand { resultString = new String(result, CommonEncrypt.ENCRYPT_STANDARD_CHARSET); } } - case "base64decode", "base64d", "b64d" -> { - try { result = Base64.getDecoder().decode(data); } + case "base64decode", "base64d", "b64d", "base64url-decode", "base64ud", "b64ud" -> { + final Base64.Decoder b64tool = command.getArgs()[0].contains("u") ? Base64.getUrlDecoder() : Base64.getDecoder(); + try { result = b64tool.decode(data); } catch (IllegalArgumentException e) { MornyCoeur.extra().exec(new SendSticker( event.message().chat().id(), TelegramStickers.ID_404