diff --git a/server/handlers/handlers.go b/server/handlers/handlers.go index 5fb8992..7b14c85 100644 --- a/server/handlers/handlers.go +++ b/server/handlers/handlers.go @@ -205,10 +205,10 @@ func GetPublicKey(c *fiber.Ctx) error { return c.JSON(res.SendPublicKey) } -func ReplayMessage(c *fiber.Ctx) error { +func ReplyMessage(c *fiber.Ctx) error { userid := c.Locals("userid") - var body request.ReplayMessage + var body request.ReplyMessage if err := c.BodyParser(&body); err != nil { return err @@ -266,7 +266,7 @@ func GetMessages(c *fiber.Ctx) error { Content: result[i].Content, Time: result[i].Time, Owner: owner, // true - CanReplay: true, + CanReply: true, SenderPublicKey: sourceUser.SendPublicKey, Quote: &response.Quote{ ID: res.ID, @@ -279,7 +279,7 @@ func GetMessages(c *fiber.Ctx) error { Content: result[i].Content, Time: result[i].Time, Owner: owner, // false - CanReplay: true, + CanReply: true, SenderPublicKey: sourceUser.ReceivePublicKey, Quote: &response.Quote{ ID: res.ID, @@ -294,7 +294,7 @@ func GetMessages(c *fiber.Ctx) error { Owner: owner, Quote: nil, Content: result[i].Content, - CanReplay: true, + CanReply: true, SenderPublicKey: sourceUser.SendPublicKey, }) } diff --git a/server/request/request.go b/server/request/request.go index aca6bca..da8a29e 100644 --- a/server/request/request.go +++ b/server/request/request.go @@ -14,7 +14,7 @@ type SendMessage struct { Message string `json:"message"` } -type ReplayMessage struct { +type ReplyMessage struct { MessageId uint64 `json:"message_id"` Message string `json:"message"` } diff --git a/server/response/response.go b/server/response/response.go index 605d1db..8418b4c 100644 --- a/server/response/response.go +++ b/server/response/response.go @@ -54,6 +54,6 @@ type GetMessages struct { Time time.Time `json:"time"` Owner bool `json:"owner"` Quote *Quote `json:"quote,omitempty"` - CanReplay bool `json:"can_replay"` + CanReply bool `json:"can_reply"` SenderPublicKey string `json:"sender_public_key"` } diff --git a/server/routes/routes.go b/server/routes/routes.go index cc76516..f296ed7 100644 --- a/server/routes/routes.go +++ b/server/routes/routes.go @@ -8,7 +8,7 @@ import ( func DefineRoutes(app *fiber.App) { app.Get("/", middlewares.AuthMiddleware, handlers.HelloWorld) - + app.Get("/me", middlewares.AuthMiddleware, handlers.GetMe) app.Get("/get-messages", middlewares.AuthMiddleware, handlers.GetMessages) app.Get("/profile/:username", handlers.GetProfile) @@ -16,5 +16,5 @@ func DefineRoutes(app *fiber.App) { app.Post("/set-username", middlewares.AuthMiddleware, handlers.SetUsername) app.Post("/send-message", middlewares.AuthMiddleware, handlers.SendMessage) app.Post("/set-key", middlewares.AuthMiddleware, handlers.SetPublicKey) - app.Post("/replay-message", middlewares.AuthMiddleware, handlers.ReplayMessage) + app.Post("/reply-message", middlewares.AuthMiddleware, handlers.ReplyMessage) } diff --git a/src/components/Message.vue b/src/components/Message.vue index 16ff5d0..2b1824d 100644 --- a/src/components/Message.vue +++ b/src/components/Message.vue @@ -14,7 +14,7 @@ const props = defineProps<{ time: string owner: boolean mark: boolean - canReplay: boolean + canReply: boolean sender_public_key: string quote?: { id: number @@ -22,9 +22,9 @@ const props = defineProps<{ } }>() -const replaying = ref(false) -const replayMessage = ref('') -const replaySent = ref(false) +const replying = ref(false) +const replyMessage = ref('') +const replySent = ref(false) const vDecrypt = { mounted: async (el: HTMLParagraphElement) => { @@ -69,7 +69,7 @@ const vFocus = { } function Submit() { - if (!replayMessage.value) return + if (!replyMessage.value) return axios.get(`/get-key/${props.id}`).then(async ({ data: key }) => { window.Telegram.WebApp.CloudStorage.getItem( @@ -78,19 +78,19 @@ function Submit() { const encryptedMsg = await createE2EPacket( key, privateKey!, - replayMessage.value, + replyMessage.value, ) axios - .post('/replay-message', { + .post('/reply-message', { message_id: props.id, message: encryptedMsg, }) .then(() => { - replaying.value = false - replayMessage.value = '' - replaySent.value = true + replying.value = false + replyMessage.value = '' + replySent.value = true - setTimeout(() => (replaySent.value = false), 1500) + setTimeout(() => (replySent.value = false), 1500) }) }, ) @@ -115,9 +115,9 @@ function Submit() {
{{ text }}
- -بیخیال
+
پاسخ شما ارسال شد.
diff --git a/src/views/Inbox.vue b/src/views/Inbox.vue index 1279f99..a6864d5 100644 --- a/src/views/Inbox.vue +++ b/src/views/Inbox.vue @@ -33,7 +33,7 @@ axios