From fa1f8d3b9a8046611c07f0e54ed96b7cf2c2b7f3 Mon Sep 17 00:00:00 2001 From: zaigie Date: Thu, 14 Mar 2024 22:56:39 +0800 Subject: [PATCH] fix: remove non-ascii broadcast validate --- api/server.go | 5 ----- web/src/assets/i18n.js | 4 ---- web/src/views/MobileHome/MobileHome.vue | 4 ---- web/src/views/PcHome/PcHome.vue | 4 ---- 4 files changed, 17 deletions(-) diff --git a/api/server.go b/api/server.go index bc3c7ff..5bb1d63 100644 --- a/api/server.go +++ b/api/server.go @@ -145,10 +145,5 @@ func validateMessage(message string) error { if message == "" { return errors.New("message cannot be empty") } - for _, c := range message { - if c > 127 { - return errors.New("message cannot contain non-ascii characters") - } - } return nil } diff --git a/web/src/assets/i18n.js b/web/src/assets/i18n.js index 374f2a5..270262f 100644 --- a/web/src/assets/i18n.js +++ b/web/src/assets/i18n.js @@ -44,7 +44,6 @@ const messages = { broadcastsuccess: "Broadcast success!", shutdownsuccess: "Shutdown success!", broadcastfail: "Broadcast fail: {err}", - broadcastasciierr: "Broadcast only support ASCII characters!", shutdownfail: "Shutdown fail: {err}", shutdowntip: "This will shut down the server after 60 seconds and send a broadcast.", @@ -175,7 +174,6 @@ const messages = { broadcastsuccess: "广播成功!", shutdownsuccess: "关闭成功!", broadcastfail: "广播失败: {err}", - broadcastasciierr: "广播只支持ASCII字符,暂不支持中文", shutdownfail: "关闭失败: {err}", shutdowntip: "此操作将在60秒后关闭服务器并发送广播。", selectVerify: "请选择验证方式", @@ -303,8 +301,6 @@ const messages = { broadcastsuccess: "全体メッセージを配信しました!", shutdownsuccess: "シャットダウンに成功しました!", broadcastfail: "全体メッセージ配信に失敗しました: {err}", - broadcastasciierr: - "全体メッセージ配信は現在ASCII文字にのみ対応しています", shutdownfail: "シャットダウンに失敗しました: {err}", shutdowntip: "全体メッセージを配信し、60秒後にサーバーをシャットダウンします", diff --git a/web/src/views/MobileHome/MobileHome.vue b/web/src/views/MobileHome/MobileHome.vue index d428678..fa75be5 100644 --- a/web/src/views/MobileHome/MobileHome.vue +++ b/web/src/views/MobileHome/MobileHome.vue @@ -231,10 +231,6 @@ const handleBroadcast = async () => { showBroadcastModal.value = false; broadcastText.value = ""; } else { - if (data.value?.error.includes("contain non-ascii")) { - message.error(t("message.broadcastasciierr")); - return; - } message.error(t("message.broadcastfail", { err: data.value?.error })); } }; diff --git a/web/src/views/PcHome/PcHome.vue b/web/src/views/PcHome/PcHome.vue index 57950c9..40616f4 100644 --- a/web/src/views/PcHome/PcHome.vue +++ b/web/src/views/PcHome/PcHome.vue @@ -475,10 +475,6 @@ const handleBroadcast = async () => { showBroadcastModal.value = false; broadcastText.value = ""; } else { - if (data.value?.error.includes("contain non-ascii")) { - message.error(t("message.broadcastasciierr")); - return; - } message.error(t("message.broadcastfail", { err: data.value?.error })); } };