@ozdao/martyrs 0.2.469 → 0.2.470

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/{Media-DwVcRIAX.mjs → Media-C4Ges_Sd.mjs} +1 -1
  2. package/dist/{Media-DCGbUujy.js → Media-CR0V1zvB.js} +1 -1
  3. package/dist/chats.server.js +14 -13
  4. package/dist/chats.server.mjs +14 -13
  5. package/dist/globals.server.js +20 -12
  6. package/dist/globals.server.mjs +20 -12
  7. package/dist/{main-DEHjtgLs.mjs → main-CTcal9qN.mjs} +900 -884
  8. package/dist/{main-UVdexuMN.js → main-CsZAG5Wz.js} +5 -5
  9. package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +2 -2
  10. package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
  11. package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +2 -2
  12. package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
  13. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
  14. package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
  15. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
  16. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
  17. package/dist/martyrs/src/components/Feed/Feed.vue.cjs +1 -1
  18. package/dist/martyrs/src/components/Feed/Feed.vue.js +1 -1
  19. package/dist/martyrs/src/components/Menu/{Menu.vue2.cjs → Menu.vue.cjs} +2 -2
  20. package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +1 -0
  21. package/dist/martyrs/src/components/Menu/{Menu.vue2.js → Menu.vue.js} +2 -2
  22. package/dist/martyrs/src/components/Menu/Menu.vue.js.map +1 -0
  23. package/dist/martyrs/src/components/Popup/{Popup.vue2.cjs → Popup.vue.cjs} +2 -2
  24. package/dist/martyrs/src/components/Popup/{Popup.vue2.js.map → Popup.vue.cjs.map} +1 -1
  25. package/dist/martyrs/src/components/Popup/{Popup.vue2.js → Popup.vue.js} +2 -2
  26. package/dist/martyrs/src/components/Popup/Popup.vue.js.map +1 -0
  27. package/dist/martyrs/src/components/Tab/{Tab.vue.cjs → Tab.vue2.cjs} +2 -2
  28. package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +1 -0
  29. package/dist/martyrs/src/components/Tab/{Tab.vue.js → Tab.vue2.js} +2 -2
  30. package/dist/martyrs/src/components/Tab/{Tab.vue.cjs.map → Tab.vue2.js.map} +1 -1
  31. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
  32. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
  33. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
  34. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
  35. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
  36. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
  37. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
  38. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
  39. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
  40. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
  41. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
  42. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
  43. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
  44. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
  45. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
  46. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
  47. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
  48. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
  49. package/dist/martyrs/src/modules/chats/store/chat.store.cjs +47 -16
  50. package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
  51. package/dist/martyrs/src/modules/chats/store/chat.store.js +47 -16
  52. package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
  53. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +2 -2
  54. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs.map +1 -1
  55. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +2 -2
  56. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js.map +1 -1
  57. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.cjs +1 -1
  58. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.cjs.map +1 -1
  59. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.js +1 -1
  60. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.js.map +1 -1
  61. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +6 -3
  62. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs.map +1 -1
  63. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +6 -3
  64. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js.map +1 -1
  65. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +4 -4
  66. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs.map +1 -1
  67. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +4 -4
  68. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js.map +1 -1
  69. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  70. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  71. package/dist/martyrs/src/modules/constructor/components/elements/VideoPlayer.vue.cjs +1 -1
  72. package/dist/martyrs/src/modules/constructor/components/elements/VideoPlayer.vue.cjs.map +1 -1
  73. package/dist/martyrs/src/modules/constructor/components/elements/VideoPlayer.vue.js +1 -1
  74. package/dist/martyrs/src/modules/constructor/components/elements/VideoPlayer.vue.js.map +1 -1
  75. package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.cjs +9 -9
  76. package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.cjs.map +1 -1
  77. package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.js +9 -9
  78. package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.js.map +1 -1
  79. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  80. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  81. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +2 -2
  82. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs.map +1 -1
  83. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +2 -2
  84. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js.map +1 -1
  85. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  86. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
  87. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +1 -1
  88. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +1 -1
  89. package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +1 -1
  90. package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +1 -1
  91. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
  92. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
  93. package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.cjs +1 -1
  94. package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.js +1 -1
  95. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
  96. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
  97. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +2 -2
  98. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  99. package/dist/martyrs/src/modules/globals/globals.client.cjs +0 -9
  100. package/dist/martyrs/src/modules/globals/globals.client.cjs.map +1 -1
  101. package/dist/martyrs/src/modules/globals/globals.client.js +0 -9
  102. package/dist/martyrs/src/modules/globals/globals.client.js.map +1 -1
  103. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.cjs +40 -97
  104. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.cjs.map +1 -1
  105. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.js +40 -97
  106. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.js.map +1 -1
  107. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
  108. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
  109. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +1 -1
  110. package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +1 -1
  111. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -1
  112. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +1 -1
  113. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
  114. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
  115. package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
  116. package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
  117. package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs +1 -1
  118. package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js +1 -1
  119. package/dist/martyrs/src/modules/icons/skeletons/SkeletonBlogpost.vue.cjs +1 -1
  120. package/dist/martyrs/src/modules/icons/skeletons/SkeletonBlogpost.vue.cjs.map +1 -1
  121. package/dist/martyrs/src/modules/icons/skeletons/SkeletonBlogpost.vue.js +1 -1
  122. package/dist/martyrs/src/modules/icons/skeletons/SkeletonBlogpost.vue.js.map +1 -1
  123. package/dist/martyrs/src/modules/notifications/notifications.client.cjs +35 -9
  124. package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
  125. package/dist/martyrs/src/modules/notifications/notifications.client.js +35 -9
  126. package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
  127. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  128. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
  129. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +2 -2
  130. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +2 -2
  131. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  132. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
  133. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  134. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
  135. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  136. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  137. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +2 -2
  138. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
  139. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +3 -3
  140. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +3 -3
  141. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -2
  142. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -2
  143. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
  144. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  145. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
  146. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
  147. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  148. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  149. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +2 -2
  150. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +2 -2
  151. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  152. package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  153. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  154. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
  155. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
  156. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
  157. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  158. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  159. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  160. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  161. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  162. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  163. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  164. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  165. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +2 -2
  166. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
  167. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +2 -2
  168. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
  169. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
  170. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
  171. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
  172. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
  173. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  174. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  175. package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.cjs +1 -1
  176. package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.js +1 -1
  177. package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
  178. package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
  179. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +1 -1
  180. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +1 -1
  181. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  182. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  183. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  184. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  185. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  186. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
  187. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +2 -2
  188. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +2 -2
  189. package/dist/martyrs.cjs.js +1 -1
  190. package/dist/martyrs.css +1 -1
  191. package/dist/martyrs.es.js +1 -1
  192. package/dist/notifications.server.js +69 -13
  193. package/dist/notifications.server.mjs +69 -13
  194. package/dist/orders.server.js +1 -0
  195. package/dist/orders.server.mjs +1 -0
  196. package/package.json +1 -1
  197. package/src/components/Shader/Shader.vue +44 -25
  198. package/src/modules/chats/routes/chats.routes.js +21 -17
  199. package/src/modules/chats/store/chat.store.js +55 -28
  200. package/src/modules/community/components/blocks/CardBlogpost.vue +1 -1
  201. package/src/modules/community/components/pages/Blog.vue +1 -1
  202. package/src/modules/community/components/pages/BlogPost.vue +1 -0
  203. package/src/modules/community/components/pages/CreateBlogPost.vue +3 -3
  204. package/src/modules/constructor/components/elements/VideoPlayer.vue +1 -1
  205. package/src/modules/constructor/components/sections/Constructor.vue +9 -9
  206. package/src/modules/events/components/pages/EditEvent.vue +1 -1
  207. package/src/modules/globals/controllers/classes/globals.websocket.js +29 -21
  208. package/src/modules/globals/globals.client.js +0 -12
  209. package/src/modules/globals/views/classes/globals.websocket.js +46 -146
  210. package/src/modules/icons/skeletons/SkeletonBlogpost.vue +2 -2
  211. package/src/modules/notifications/controllers/notifications.controller.js +2 -2
  212. package/src/modules/notifications/notifications.client.js +57 -19
  213. package/src/modules/notifications/notifications.server.js +3 -1
  214. package/src/modules/notifications/routes/notifications.routes.js +2 -2
  215. package/src/modules/notifications/services/notification.service.js +34 -15
  216. package/src/modules/notifications/services/web-push.service.js +7 -6
  217. package/src/modules/orders/controllers/orders.controller.js +2 -0
  218. package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
  219. package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
  220. package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
  221. package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +0 -1
  222. package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +0 -1
  223. package/dist/martyrs/src/components/Popup/Popup.vue2.cjs.map +0 -1
  224. package/dist/martyrs/src/components/Tab/Tab.vue.js.map +0 -1
  225. package/src/modules/notifications/notifications2.client.js +0 -256
  226. package/src/modules/notifications/services/websocket.service.js +0 -100
@@ -8,65 +8,92 @@ const state = reactive({
8
8
  });
9
9
 
10
10
  const methods = {
11
- async connectWebSocket(user) {
12
- // Use the global WebSocket instance
11
+ /**
12
+ * Подключение к глобальному WebSocket и подписка на чат
13
+ * @param {String} userId
14
+ */
15
+ async connectWebSocket(userId) {
13
16
  try {
14
- console.log('connect', user);
15
- await globalWebSocket.connect(user);
17
+ console.log('[Chat] Connecting to WebSocket with userId:', userId);
18
+ await globalWebSocket.connect(userId);
19
+ await globalWebSocket.subscribeModule('chat'); // 👈 Подписка на модуль чата
16
20
 
17
- // Remove any existing 'message' listeners for the 'chat' module to avoid duplicates
21
+ // Очистка старых листенеров
18
22
  globalWebSocket.removeModuleListeners('chat');
19
23
 
20
- // Register chat message event listener
21
- const listenerId = globalWebSocket.addEventListener('message', (data) => {
24
+ // Добавляем обработчик входящих сообщений
25
+ globalWebSocket.addEventListener('message', (data) => {
22
26
  if (data.chatId === state.currentChatId) {
23
27
  state.messages.push(data);
24
28
  }
25
29
  }, { module: 'chat' });
26
30
 
27
- return globalWebSocket;
28
31
  } catch (error) {
29
- console.error('Failed to connect to WebSocket:', error);
32
+ console.error('[Chat] WebSocket connection failed:', error);
30
33
  throw error;
31
34
  }
32
35
  },
33
36
 
34
- setMessages(messages) {
35
- console.log(process.env.API_URL);
36
- state.messages = messages;
37
- },
38
-
39
- async addMessage(message) {
40
- await globalWebSocket.send(message);
41
- },
42
-
37
+ /**
38
+ * Установка текущего активного чата и загрузка сообщений
39
+ * @param {String} chatId
40
+ */
43
41
  async setCurrentChat(chatId) {
44
42
  state.currentChatId = chatId;
45
- state.messages = []; // Clear current messages when changing chat
43
+ state.messages = [];
46
44
 
47
- // Send join chat message through the WebSocket
45
+ // Отправляем joinChat через WebSocket
48
46
  globalWebSocket.send({ type: 'joinChat', module: 'chat', chatId });
49
47
 
50
- // Fetch chat history
51
- const response = await fetch(`/messages/${chatId}`);
52
- const messages = await response.json();
48
+ // Загружаем историю сообщений
49
+ try {
50
+ const response = await fetch(`/messages/${chatId}`);
51
+ const messages = await response.json();
52
+ methods.setMessages(messages);
53
+ } catch (err) {
54
+ console.error('[Chat] Failed to fetch messages:', err);
55
+ }
56
+ },
57
+
58
+ /**
59
+ * Установка сообщений
60
+ * @param {Array} messages
61
+ */
62
+ setMessages(messages) {
63
+ state.messages = messages;
64
+ },
53
65
 
54
- methods.setMessages(messages);
66
+ /**
67
+ * Отправка сообщения через WebSocket
68
+ * @param {Object} message
69
+ */
70
+ async addMessage(message) {
71
+ await globalWebSocket.send({
72
+ ...message,
73
+ module: 'chat',
74
+ type: 'message',
75
+ chatId: state.currentChatId
76
+ });
55
77
  },
56
78
 
79
+ /**
80
+ * Установка имени пользователя
81
+ * @param {String} username
82
+ */
57
83
  setUsername(username) {
58
84
  state.username = username;
59
85
  },
60
86
 
87
+ /**
88
+ * Отключение от чата (очистка листенеров)
89
+ */
61
90
  disconnectChat() {
62
- // Remove all chat-specific listeners when leaving chat page
63
91
  globalWebSocket.removeModuleListeners('chat');
64
- // Optionally disconnect the WebSocket if no longer needed
65
- // globalWebSocket.disconnect(); // Uncomment if you want to fully disconnect
92
+ // globalWebSocket.disconnect(); // включить, если нужно полностью разорвать соединение
66
93
  }
67
94
  };
68
95
 
69
96
  export default {
70
97
  state: readonly(state),
71
98
  methods
72
- };
99
+ };
@@ -86,7 +86,7 @@
86
86
  v-if="!firstImage?.content && firstVideo && firstVideo.content && type !== 'blogpostPage'"
87
87
  >
88
88
  <!-- <div class="flex-center flex"> -->
89
- <video controls class="mn-b-medium object-fit-cover w-100 h-max-20r">
89
+ <video controls class="mn-b-medium object-fit-fit bg-black w-100 h-max-20r">
90
90
  <source :src="firstVideo.content" type="video/mp4">
91
91
  Your browser does not support the video tag.
92
92
  </video>
@@ -23,7 +23,7 @@
23
23
  v-slot="{
24
24
  items
25
25
  }"
26
- class="row-1 gap-thin"
26
+ class="rows-1 gap-thin"
27
27
  >
28
28
  <CardBlogpost
29
29
  v-for="item in items"
@@ -4,6 +4,7 @@
4
4
  <SkeletonBlogpost
5
5
  v-if="isLoading"
6
6
  v-for="i in 3" :key="i"
7
+ class=""
7
8
  />
8
9
  </TransitionGroup>
9
10
  <transition
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <article
3
- class="w-100 h-100 pos-relative"
3
+ class="w-100 bg-light radius-medium pos-relative"
4
4
  >
5
5
  <section
6
6
  style="min-height: 100%;"
7
- class="w-100 bg-white pd-big radius-medium"
7
+ class="w-100 pd-big"
8
8
  >
9
9
  <!-- Title -->
10
10
  <div
@@ -29,7 +29,7 @@
29
29
  </section>
30
30
 
31
31
  <transition name="scaleIn" >
32
- <section v-if="post" class="pd-thin pos-sticky pos-l-0 pos-b-0 w-100 ">
32
+ <section v-if="post" class="pd-small pos-sticky pos-l-0 pos-b-0 w-100 ">
33
33
  <div class="pd-thin radius-big bg-main w-100 flex-nowrap flex">
34
34
  <a v-if="route.params.url" @click="onDelete()" class="mn-r-auto bg-red t-white t-black button">Delete</a>
35
35
  <a @click="onDrafts()" class="mn-l-auto bg-white t-black button">To Drafts</a>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="mn-b-thin w-100 pd-medium bg-black radius-medium"
3
+ class="mn-b-thin w-100 o-hidden bg-black radius-medium"
4
4
  >
5
5
 
6
6
  <div v-if="prop.content" class="flex-center flex">
@@ -42,55 +42,55 @@
42
42
  >
43
43
  <button
44
44
  @click="showMenu = !showMenu"
45
- class="mn-b-small cursor-pointer w-100 i-semi bg-light radius-thin"
45
+ class="mn-b-small cursor-pointer w-100 i-semi bg-white radius-thin"
46
46
  >
47
47
  {{ block.content ? '⋯' : '+' }}
48
48
  </button>
49
49
 
50
50
  <div
51
51
  v-if="showMenu"
52
- class="z-index-5 radius-thin pd-thin bg-light w-max mn-b-small flex-nowrap flex-column flex"
52
+ class="z-index-5 radius-thin pd-thin bg-white w-max mn-b-small flex-nowrap flex-column flex"
53
53
  >
54
54
  <span
55
55
  v-if="index !== 0"
56
56
  @click="handleDeleteBlock(block)"
57
- class="mn-b-thin w-max t-red bg-light button-small button"
57
+ class="mn-b-thin w-max t-red bg-white button-small button"
58
58
  >
59
59
  Remove
60
60
  </span>
61
61
  <span
62
62
  @click="handleAddBlock('ImageUpload', '', index)"
63
- class="mn-b-thin w-max t-black bg-light button-small button"
63
+ class="mn-b-thin w-max t-black bg-white button-small button"
64
64
  >
65
65
  Add Image
66
66
  </span>
67
67
  <span
68
68
  @click="handleAddBlock('H2', '', index)"
69
- class="w-max button-small t-black bg-light button"
69
+ class="w-max button-small t-black bg-white button"
70
70
  >
71
71
  Add Title
72
72
  </span>
73
73
  <span
74
74
  @click="handleAddBlock('Card', { photo: '', title: '', subtitle: '', }, index)"
75
- class="w-max button-small t-black bg-light button"
75
+ class="w-max button-small t-black bg-white button"
76
76
  >
77
77
  Add Card
78
78
  </span>
79
79
  <span
80
80
  @click="handleAddBlock('Embed', '', index)"
81
- class="w-max button-small t-black bg-light button"
81
+ class="w-max button-small t-black bg-white button"
82
82
  >
83
83
  Add Embed
84
84
  </span>
85
85
  <span
86
86
  @click="handleAddBlock('Audio', '', index)"
87
- class="w-max button-small t-black bg-light button"
87
+ class="w-max button-small t-black bg-white button"
88
88
  >
89
89
  Add Audio
90
90
  </span>
91
91
  <span
92
92
  @click="handleAddBlock('Video', '', index)"
93
- class="w-max button-small t-black bg-light button"
93
+ class="w-max button-small t-black bg-white button"
94
94
  >
95
95
  Add Video
96
96
  </span>
@@ -71,7 +71,7 @@
71
71
  </div>
72
72
  </Block>
73
73
 
74
- <section v-if="event" class="pd-b-extra w-100 bg-light pd-big radius-big">
74
+ <section v-if="event" class="pd-b-extra w-100 bg-light pd-big radius-medium">
75
75
  <Constructor
76
76
  :content="event.content"
77
77
  @update="update => event.content = update"
@@ -8,12 +8,12 @@ class WebSocketManager {
8
8
  verifyClient: this.verifyClient.bind(this)
9
9
  });
10
10
 
11
- this.modules = new Map(); // moduleName => handler
12
- this.userConnections = new Map(); // userId => Set(ws)
11
+ this.modules = new Map();
12
+ this.userConnections = new Map();
13
13
 
14
14
  this.wss.on('connection', (ws, req) => {
15
- ws.moduleName = null;
16
15
  ws.userId = req.userId || null;
16
+ ws.subscriptions = new Set();
17
17
 
18
18
  if (ws.userId) {
19
19
  this._trackUserConnection(ws.userId, ws);
@@ -22,14 +22,16 @@ class WebSocketManager {
22
22
  ws.on('message', async (rawMessage) => {
23
23
  try {
24
24
  const msg = JSON.parse(rawMessage);
25
- console.log(msg)
26
- const moduleName = ws.moduleName || msg.module;
27
25
 
28
- console.log('module name is,', moduleName)
29
- console.log('modules is,', this.modules)
26
+ // обработка подписки на модуль
27
+ if (msg.type === 'subscribe' && msg.module && this.modules.has(msg.module)) {
28
+ ws.subscriptions.add(msg.module);
29
+ return;
30
+ }
30
31
 
32
+ // нормальная маршрутизация
33
+ const moduleName = msg.module;
31
34
  if (moduleName && this.modules.has(moduleName)) {
32
- ws.moduleName = moduleName;
33
35
  const handler = this.modules.get(moduleName);
34
36
  await handler(ws, msg);
35
37
  }
@@ -51,21 +53,16 @@ class WebSocketManager {
51
53
 
52
54
  verifyClient(info, done) {
53
55
  try {
54
- const userCookie = info.req.headers.cookie
55
- ?.split('; ')
56
- .find((cookie) => cookie.startsWith('user='));
57
-
56
+ const userCookie = info.req.headers.cookie?.split('; ').find(c => c.startsWith('user='));
58
57
  if (!userCookie) return done(true);
59
58
 
60
59
  const token = JSON.parse(decodeURIComponent(userCookie.replace('user=', '')));
61
60
  const decoded = jwt.verify(token.accessToken, process.env.SECRET_KEY);
62
-
63
61
  info.req.userId = decoded._id;
64
62
  } catch (err) {
65
63
  console.error('Invalid token:', err);
66
64
  }
67
-
68
- done(true); // Разрешаем в любом случае
65
+ done(true);
69
66
  }
70
67
 
71
68
  _trackUserConnection(userId, ws) {
@@ -80,30 +77,41 @@ class WebSocketManager {
80
77
  }
81
78
 
82
79
  sendToUserInModule(moduleName, userId, data) {
83
- const sockets = this.userConnections.get(userId);
84
- if (!sockets) return;
80
+ const userIdStr = userId.toString();
81
+
82
+ const sockets = this.userConnections.get(userIdStr);
85
83
 
84
+ if (!sockets) {
85
+ console.log(`No sockets found for user ${userIdStr}`);
86
+ return false;
87
+ }
88
+
89
+ let sent = false;
86
90
  for (const ws of sockets) {
87
- if (ws.readyState === 1 && ws.moduleName === moduleName) {
91
+
92
+ if (ws.readyState === 1 && ws.subscriptions.has(moduleName)) {
88
93
  ws.send(JSON.stringify(data));
94
+ sent = true;
89
95
  }
90
96
  }
97
+ return sent;
91
98
  }
92
99
 
93
100
  broadcastToModule(moduleName, data) {
94
101
  for (const ws of this.wss.clients) {
95
- if (ws.readyState === 1 && ws.moduleName === moduleName) {
102
+ if (ws.readyState === 1 && ws.subscriptions.has(moduleName)) {
96
103
  ws.send(JSON.stringify(data));
97
104
  }
98
105
  }
99
106
  }
100
107
 
101
108
  broadcastToModuleWithFilter(moduleName, filterFn, data) {
109
+ const sockets = this.userConnections
110
+
102
111
  for (const ws of this.wss.clients) {
103
112
  if (ws.readyState !== 1) continue;
104
- if (ws.moduleName !== moduleName) continue;
113
+ if (!ws.subscriptions.has(moduleName)) continue;
105
114
  if (!filterFn(ws)) continue;
106
-
107
115
  ws.send(JSON.stringify(data));
108
116
  }
109
117
  }
@@ -3,8 +3,6 @@
3
3
 
4
4
  import getBrowserLocale from './views/localization/get-browser-locale.js';
5
5
  import scrollBehavior from './views/router/scrollBehavior.js';
6
- import globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';
7
-
8
6
 
9
7
  import layoutApp from './views/components/layouts/App.vue'
10
8
  import layoutClient from './views/components/layouts/Client.vue'
@@ -70,16 +68,6 @@ function initializeGlobals(app, store, router, config, options = {}) {
70
68
 
71
69
  });
72
70
 
73
- // Initialize global WebSocket
74
- if (typeof window !== 'undefined') {
75
- globalWebSocket.initialize({
76
- wsUrl: process.env.WSS_URL || undefined,
77
- maxReconnectAttempts: 5,
78
- reconnectDelay: 3000,
79
- pingInterval: 30000
80
- });
81
- }
82
-
83
71
 
84
72
  if (config && config.modules) storeGlobals.state.options = config.modules
85
73