diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6fcfa53..2b9921f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,8 @@
## 变更记录
+- 2024-09-10
+1. 重构本地聊天,修改发现机制(基于ip扫描和arp过滤)
+2. 本地聊天可批量发送图片/文件夹,修改发送机制,消息基于udp发送,文件基于tcp发送
+
-2024-09-04
1. 修复word导入格式丢失问题
-2024-09-03
diff --git a/frontend/src/components/localchat/ChatDomain.vue b/frontend/src/components/localchat/ChatDomain.vue
index 6c71f0a..66de55b 100644
--- a/frontend/src/components/localchat/ChatDomain.vue
+++ b/frontend/src/components/localchat/ChatDomain.vue
@@ -2,57 +2,48 @@
-
+
-
+
-
+
-
-
+
+
{{ msg.reciperInfo ? msg.reciperInfo.hostname : '' }}
{{ msg.content }}
-
+
-
- {{ formatChatTime(msg.createdAt) }}
+
+ {{ formatChatTime(msg.createdAt) }}
{{ formatChatTime(msg.createdAt) }}
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
@@ -73,16 +64,45 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
@@ -92,66 +112,84 @@
\ No newline at end of file
diff --git a/frontend/src/stores/localchat.ts b/frontend/src/stores/localchat.ts
index 47be69d..f4af130 100644
--- a/frontend/src/stores/localchat.ts
+++ b/frontend/src/stores/localchat.ts
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import emojiList from "@/assets/emoji.json"
import { ref, toRaw } from "vue";
import { db } from './db'
-import { getSystemConfig } from "@/system/config";
+import { getSystemConfig, setSystemKey } from "@/system/config";
import { isValidIP } from "@/util/common";
import { notifyError, notifySuccess } from "@/util/msg";
export const useLocalChatStore = defineStore('localChatStore', () => {
@@ -449,6 +449,24 @@ export const useLocalChatStore = defineStore('localChatStore', () => {
//notifySuccess("确认成功!")
}
}
+ async function saveConfig(conf:any){
+ conf = toRaw(conf)
+ //console.log(conf)
+ const postUrl = `${config.apiUrl}/localchat/setting`
+ const coms = await fetch(postUrl, {
+ method: "POST",
+ body: JSON.stringify(conf),
+ })
+ if (!coms.ok) {
+ //console.log(coms)
+ notifyError("保存失败!")
+ } else {
+ setSystemKey('chatConf', conf)
+ notifySuccess("保存成功!")
+ showAddUser.value = false
+ }
+
+ }
return {
userList,
@@ -476,6 +494,7 @@ export const useLocalChatStore = defineStore('localChatStore', () => {
clearMsg,
handlerMessage,
cannelFile,
- accessFile
+ accessFile,
+ saveConfig
}
})
diff --git a/frontend/src/system/config.ts b/frontend/src/system/config.ts
index eda6bc7..2e3d757 100644
--- a/frontend/src/system/config.ts
+++ b/frontend/src/system/config.ts
@@ -123,7 +123,17 @@ export const getSystemConfig = (ifset = false) => {
dbname: ''
};
}
-
+ if (!config.chatConf) {
+ config.chatConf = {
+ 'checkTime': '15',
+ 'first': '192',
+ 'second': '168',
+ 'thirdStart': '1',
+ 'thirdEnd': '1',
+ 'fourthStart': '2',
+ 'fourthEnd': '254'
+ }
+ }
// 初始化桌面快捷方式列表,若本地存储中已存在则不进行覆盖
if (!config.desktopList) {
config.desktopList = [];
diff --git a/godo/libs/chatip.go b/godo/libs/chatip.go
index 50be288..2a26486 100644
--- a/godo/libs/chatip.go
+++ b/godo/libs/chatip.go
@@ -29,18 +29,18 @@ import (
)
type UserChatIpSetting struct {
- CheckTime int `json:"CheckTime"`
- First string `json:"First"`
- Second string `json:"Second"`
- ThirdStart string `json:"ThirdStart"`
- ThirdEnd string `json:"ThirdEnd"`
- FourthStart string `json:"FourthStart"`
- FourthEnd string `json:"FourthEnd"`
+ CheckTime string `json:"checkTime"`
+ First string `json:"first"`
+ Second string `json:"second"`
+ ThirdStart string `json:"thirdStart"`
+ ThirdEnd string `json:"thirdEnd"`
+ FourthStart string `json:"fourthStart"`
+ FourthEnd string `json:"fourthEnd"`
}
func GetDefaultChatIpSetting() UserChatIpSetting {
return UserChatIpSetting{
- CheckTime: 30,
+ CheckTime: "15",
First: "192",
Second: "168",
ThirdStart: "1",
diff --git a/godo/localchat/server.go b/godo/localchat/server.go
index d65a69a..6300981 100644
--- a/godo/localchat/server.go
+++ b/godo/localchat/server.go
@@ -28,6 +28,7 @@ import (
"godo/libs"
"log"
"net"
+ "strconv"
"time"
)
@@ -60,7 +61,11 @@ func init() {
func CheckOnlines() {
//CheckOnline()
chatIpSetting := libs.GetChatIpSetting()
- checkTimeDuration := time.Duration(chatIpSetting.CheckTime) * time.Second
+ cktime, err := strconv.Atoi(chatIpSetting.CheckTime)
+ if err != nil {
+ cktime = 15
+ }
+ checkTimeDuration := time.Duration(cktime) * time.Second
ticker := time.NewTicker(checkTimeDuration)
defer ticker.Stop()