Skip to content

Commit

Permalink
fix: remove non-ascii broadcast validate
Browse files Browse the repository at this point in the history
  • Loading branch information
zaigie committed Mar 14, 2024
1 parent 6f0478e commit fa1f8d3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 17 deletions.
5 changes: 0 additions & 5 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 0 additions & 4 deletions web/src/assets/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -175,7 +174,6 @@ const messages = {
broadcastsuccess: "广播成功!",
shutdownsuccess: "关闭成功!",
broadcastfail: "广播失败: {err}",
broadcastasciierr: "广播只支持ASCII字符,暂不支持中文",
shutdownfail: "关闭失败: {err}",
shutdowntip: "此操作将在60秒后关闭服务器并发送广播。",
selectVerify: "请选择验证方式",
Expand Down Expand Up @@ -303,8 +301,6 @@ const messages = {
broadcastsuccess: "全体メッセージを配信しました!",
shutdownsuccess: "シャットダウンに成功しました!",
broadcastfail: "全体メッセージ配信に失敗しました: {err}",
broadcastasciierr:
"全体メッセージ配信は現在ASCII文字にのみ対応しています",
shutdownfail: "シャットダウンに失敗しました: {err}",
shutdowntip:
"全体メッセージを配信し、60秒後にサーバーをシャットダウンします",
Expand Down
4 changes: 0 additions & 4 deletions web/src/views/MobileHome/MobileHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
}
};
Expand Down
4 changes: 0 additions & 4 deletions web/src/views/PcHome/PcHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
}
};
Expand Down

0 comments on commit fa1f8d3

Please sign in to comment.