Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Satellite-im/Core-PWA
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 302594b9abef27dd21e9f712edd6b473ddce3e35
Choose a base ref
..
head repository: Satellite-im/Core-PWA
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b46deed2a01a0062bf5850052a69995896506fd2
Choose a head ref
Showing with 5,100 additions and 1,497 deletions.
  1. +5 −0 .gitignore
  2. +74 −0 .vscode/launch.json
  3. +1 −1 .vscode/settings.json
  4. +1 −0 __mocks__/it-pipe.js
  5. +24 −3 assets/styles/base.less
  6. +2 −9 components/ui/Global/Global.html
  7. +35 −25 components/ui/Global/Global.vue
  8. +16 −36 components/views/chat/chatbar/Chatbar.vue
  9. +4 −11 components/views/chat/chatbar/footer/is-connected/Connected.html
  10. +42 −5 components/views/chat/chatbar/footer/is-connected/Connected.vue
  11. +8 −5 components/views/files/upload/Upload.vue
  12. +41 −45 components/views/media/Media.html
  13. +27 −73 components/views/media/Media.vue
  14. +12 −5 components/views/media/actions/Actions.html
  15. +16 −48 components/views/media/actions/Actions.vue
  16. +2 −2 components/views/media/heading/Heading.vue
  17. +19 −7 components/views/media/incomingCall/IncomingCall.html
  18. +35 −6 components/views/media/incomingCall/IncomingCall.vue
  19. +40 −27 components/views/media/user/User.html
  20. +96 −24 components/views/media/user/User.vue
  21. +3 −3 components/views/navigation/sidebar/controls/Controls.html
  22. +20 −48 components/views/navigation/sidebar/controls/Controls.vue
  23. +1 −19 components/views/navigation/sidebar/live/Live.vue
  24. +5 −8 components/views/navigation/toolbar/Toolbar.html
  25. +45 −24 components/views/navigation/toolbar/Toolbar.vue
  26. +5 −1 components/views/user/User.html
  27. +2 −0 components/views/user/User.less
  28. +39 −0 components/views/user/User.vue
  29. +1 −1 cypress/integration/chat-top-toolbar.js
  30. +2 −5 jest.config.js
  31. +17 −17 layouts/chat.vue
  32. +3 −1 layouts/server.vue
  33. +1 −0 libraries/Enums/types/webrtc.ts
  34. +4 −0 libraries/Files/test/FilSystem.test.ts
  35. +2,285 −0 libraries/Files/test/__snapshots__/FilSystem.test.ts.snap
  36. +942 −327 libraries/WebRTC/Call.ts
  37. +84 −6 libraries/WebRTC/Libp2p.ts
  38. +9 −0 libraries/WebRTC/Peer.ts
  39. +1 −1 libraries/WebRTC/TracksManager.test.ts
  40. +46 −27 libraries/WebRTC/WebRTC.ts
  41. +39 −11 libraries/WebRTC/types.ts
  42. +0 −31 libraries/ui/Friends.test.ts
  43. +0 −26 libraries/ui/__snapshots__/Friends.test.ts.snap
  44. +3 −0 locales/en-US.js
  45. +8 −10 middleware/authenticated.test.ts
  46. +4 −1 nuxt.config.js
  47. +21 −6 pages/chat/direct/_address.vue
  48. +1 −1 pages/chat/groups/_id.vue
  49. +3 −7 plugins/local/classLoader.ts
  50. +5 −0 plugins/local/logger.ts
  51. +0 −1 plugins/thirdparty/persist.ts
  52. +0 −1 store/accounts/actions.test.ts
  53. +9 −5 store/accounts/actions.ts
  54. +3 −0 store/accounts/mutations.test.ts
  55. +8 −0 store/accounts/mutations.ts
  56. +15 −12 store/audio/actions.ts
  57. +106 −0 store/conversation/actions.ts
  58. +63 −0 store/conversation/mutations.ts
  59. +10 −0 store/conversation/state.ts
  60. +31 −0 store/conversation/types.ts
  61. +0 −6 store/friends/__snapshots__/mutations.test.ts.snap
  62. +1 −0 store/friends/__snapshots__/state.test.ts.snap
  63. +29 −8 store/friends/actions.ts
  64. +0 −10 store/friends/mutations.test.ts
  65. +4 −4 store/friends/mutations.ts
  66. +1 −0 store/friends/state.ts
  67. +5 −1 store/getters.test.ts
  68. +6 −4 store/groups/actions.ts
  69. +2 −0 store/groups/types.ts
  70. +1 −0 store/textile/__snapshots__/state.test.ts.snap
  71. +43 −13 store/textile/actions.ts
  72. +3 −0 store/textile/mutations.ts
  73. +1 −0 store/textile/state.ts
  74. +1 −0 store/textile/types.ts
  75. +0 −1 store/ui/actions.test.ts
  76. +1 −1 store/ui/actions.ts
  77. +0 −1 store/ui/mutations.test.ts
  78. +26 −0 store/video/actions.ts
  79. +5 −24 store/webrtc/__snapshots__/state.test.ts.snap
  80. +457 −134 store/webrtc/actions.ts
  81. +71 −220 store/webrtc/mutations.test.ts
  82. +54 −52 store/webrtc/mutations.ts
  83. +5 −15 store/webrtc/state.ts
  84. +19 −28 store/webrtc/types.ts
  85. +11 −1 tsconfig.json
  86. +1 −0 types/messaging.d.ts
  87. +4 −0 types/store/store.ts
  88. +1 −0 types/ui/core.d.ts
  89. +0 −1 types/ui/friends.d.ts
  90. +2 −0 types/ui/user.d.ts
  91. +0 −3 utilities/Hounddog.test.ts
  92. +1 −3 utilities/Hounddog.ts
  93. +0 −2 utilities/Messaging.test.ts
  94. +1 −33 utilities/__snapshots__/Hounddog.test.ts.snap
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -95,3 +95,8 @@ sw.*
# Scratchpad files for testing stuff
scratchpad.ts
scratchpad.js

# Browser profiles for debugging
.vscode/firefox/
.vscode/pwa-msedge/
.vscode/chrome/
74 changes: 74 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-msedge",
"name": "edge: profile-1",
"request": "launch",
"url": "http://localhost:3000/?p1",
"userDataDir": "${workspaceFolder}/.vscode/pwa-msedge/profile-1"
},
{
"type": "pwa-msedge",
"name": "edge: profile-2",
"request": "launch",
"url": "http://localhost:3000/?p2",
"userDataDir": "${workspaceFolder}/.vscode/pwa-msedge/profile-2"
},
{
"type": "pwa-msedge",
"name": "edge: profile-3",
"request": "launch",
"url": "http://localhost:3000/?p3",
"userDataDir": "${workspaceFolder}/.vscode/pwa-msedge/profile-3"
},
{
"type": "vscode-edge-devtools.debug",
"name": "edge: devtools",
"request": "attach",
"url": "http://localhost:3000/"
},
{
"name": "browser: firefox",
"type": "firefox",
"request": "launch",
"url": "http://localhost:3000",
"reAttach": true,
"profile": "debug",
"keepProfileChanges": true,
"profileDir": "${workspaceRoot}/.vscode/firefox",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack:///",
"path": "${webRoot}/"
}
]
},
{
"type": "node",
"request": "launch",
"name": "server: nuxi",
"args": ["dev"],
"osx": {
"program": "${workspaceFolder}/node_modules/.bin/nuxi"
},
"linux": {
"program": "${workspaceFolder}/node_modules/.bin/nuxi"
},
"windows": {
"program": "${workspaceFolder}/node_modules/nuxt/bin/nuxi.mjs"
}
}
],
"compounds": [
{
"name": "fullstack: nuxi",
"configurations": ["server: nuxi", "browser: firefox"]
},
{
"name": "edge: profile-1 w/ devtools",
"configurations": ["edge: profile-1", "edge: devtools"]
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": ["Dexie"]
"cSpell.words": ["Dexie", "minisearch"]
}
1 change: 1 addition & 0 deletions __mocks__/it-pipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function pipe() {}
27 changes: 24 additions & 3 deletions assets/styles/base.less
Original file line number Diff line number Diff line change
@@ -605,9 +605,30 @@ strong {
.user {
.user-info {
.subtitle {
* {
font-size: @micro-text-size;
color: @text-muted;
font-size: @micro-text-size;
color: @text-muted;
}

.bigmoji {
.emoji {
font-size: 15pt;
animation-name: emoji-appear;
animation-duration: 500ms;
}
}

.spoiler-container {
cursor: pointer;
background-color: @gray;
border-radius: @corner-rounding-smaller;
.spoiler {
opacity: 0;
}

.spoiler-open {
cursor: text;
background-color: @darker-transparent;
opacity: 1;
}
}
}
11 changes: 2 additions & 9 deletions components/ui/Global/Global.html
Original file line number Diff line number Diff line change
@@ -30,15 +30,8 @@
:set-close-timeout="5000"
/>
</UiModal>
<UiModal
v-if="this.$store.state.friends.all.some((friend) => friend.peerId === this.$store.state.webrtc.incomingCall)"
nopad
>
<MediaIncomingCall
:user="this.$store.state.friends.all.find((friend) => friend.peerId === this.$store.state.webrtc.incomingCall)"
:accept-call="acceptCall"
:deny-call="denyCall"
/>
<UiModal v-if="webrtc.incomingCall" nopad>
<MediaIncomingCall :accept-call="acceptCall" :deny-call="denyCall" />
</UiModal>
<UiModal
v-if="ui.modals.marketplace"
60 changes: 35 additions & 25 deletions components/ui/Global/Global.vue
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@ import { TrackKind } from '~/libraries/WebRTC/types'
import { ModalWindows } from '~/store/ui/types'
import { Item } from '~/libraries/Files/abstracts/Item.abstract'
import { Peer2Peer } from '~/libraries/WebRTC/Libp2p'
import { $WebRTC } from '~/libraries/WebRTC/WebRTC'
import { Friend } from '~/types/ui/friends'
const p2p = Peer2Peer.getInstance()
declare module 'vue/types/vue' {
interface Vue {
@@ -16,7 +20,7 @@ declare module 'vue/types/vue' {
export default Vue.extend({
name: 'Global',
computed: {
...mapState(['ui', 'media', 'webrtc']),
...mapState(['ui', 'media', 'webrtc', 'conversation']),
ModalWindows: () => ModalWindows,
},
mounted() {
@@ -68,30 +72,41 @@ export default Vue.extend({
* @example
*/
async acceptCall(kinds: TrackKind[]) {
if (this.webrtc.activeCall) {
this.hangUp()
this.$store.commit('webrtc/setStreamMuted', {
peerId: p2p.id,
audio: true,
video: true,
screen: true,
})
const { callId, peerId } = this.webrtc.incomingCall
const call = $WebRTC.getCall(callId)
if (!call) {
return
}
const identifier = this.webrtc.incomingCall
const call = this.$WebRTC.getPeer(identifier)
if (!call) return
const redirectId =
this.webrtc.incomingCall.type === 'group'
? `groups/${callId}`
: `direct/${
this.$store.state.friends.all.find(
(f: Friend) => f.peerId === peerId,
)?.address || 'error'
}`
if (call) {
try {
await call.createLocalTracks(kinds)
await call.answer()
} catch (error) {
if (error instanceof Error) {
this.$toast.error(this.$t(error.message) as string)
}
try {
await call.createLocalTracks(kinds)
await call.answer(peerId)
} catch (error) {
if (error instanceof Error) {
this.$toast.error(this.$t(error.message) as string)
}
}
const callingPath = `/chat/direct/${identifier}`
const callingPath = `/chat/${redirectId}`
if (this.$route.path !== callingPath) {
this.$router.push(callingPath)
}
if (this.ui.showSettings) {
this.$store.commit('ui/toggleSettings', { show: false })
}
@@ -102,11 +117,8 @@ export default Vue.extend({
* @example
*/
denyCall() {
const identifier = this.webrtc.incomingCall
const call = this.$WebRTC.getPeer(identifier)
if (call) call.deny()
this.$store.commit('webrtc/setIncomingCall', undefined)
this.$store.commit('ui/fullscreen', false)
this.$store.dispatch('webrtc/denyCall')
},
/**
@@ -115,11 +127,9 @@ export default Vue.extend({
* @example
*/
hangUp() {
if (!this.webrtc.activeCall) return
const call = this.$WebRTC.getPeer(this.webrtc.activeCall)
if (call) call.hangUp()
this.$store.dispatch('webrtc/hangUp')
this.$store.commit('webrtc/setIncomingCall', undefined, { root: true })
this.$store.commit('ui/fullscreen', false)
this.$store.dispatch('webrtc/hangUp')
},
/**
* @method share
52 changes: 16 additions & 36 deletions components/views/chat/chatbar/Chatbar.vue
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import Vue, { PropType } from 'vue'
import { mapState, mapGetters } from 'vuex'
import { throttle } from 'lodash'
import { TerminalIcon } from 'satellite-lucide-icons'
import PeerId from 'peer-id'
import Upload from '../../files/upload/Upload.vue'
import FilePreview from '../../files/upload/filePreview/FilePreview.vue'
@@ -17,8 +16,8 @@ import {
PropCommonEnum,
} from '~/libraries/Enums/enums'
import { Config } from '~/config'
import { Peer2Peer } from '~/libraries/WebRTC/Libp2p'
import { UploadDropItemType } from '~/types/files/file'
import { Group } from '~/types/messaging'
export default Vue.extend({
components: {
@@ -28,7 +27,7 @@ export default Vue.extend({
},
props: {
recipient: {
type: Object as PropType<Friend>,
type: Object as PropType<Friend | Group>,
default: () => {},
},
},
@@ -41,10 +40,10 @@ export default Vue.extend({
}
},
computed: {
...mapState(['ui', 'friends', 'webrtc', 'chat', 'textile']),
...mapGetters('chat', ['getFiles']),
activeFriend(): Friend | undefined {
return this.$Hounddog.getActiveFriend(this.friends)
...mapState(['ui', 'friends', 'webrtc', 'chat', 'textile', 'conversation']),
activeFriend() {
return this.conversation?.participants?.[0]
},
/**
* @method charlimit DocsTODO
@@ -134,6 +133,9 @@ export default Vue.extend({
this.recipientTyping =
activeFriend.typingState === PropCommonEnum.TYPING
},
},
'conversation.participants': {
handler() {},
deep: true,
},
'recipient.address': {
@@ -186,29 +188,7 @@ export default Vue.extend({
typingNotifHandler(
state: PropCommonEnum.TYPING | PropCommonEnum.NOT_TYPING,
) {
const activeFriend = this.$Hounddog.getActiveFriend(this.friends)
if (activeFriend) {
try {
const p2p = Peer2Peer.getInstance()
if (!activeFriend.peerId) return
p2p.sendMessage(
{
type: 'TYPING_STATE',
payload: { state: 'TYPING' },
sentAt: Date.now(),
},
PeerId.createFromB58String(activeFriend.peerId),
)
// const activePeer = this.$WebRTC.getPeer(activeFriend.address)
// activePeer?.send('TYPING_STATE', { state })
} catch (error: any) {
this.$Logger.log('cannot send after peer is destroyed', 'ERROR', {
error,
})
}
}
// TODO use conversation participants
},
/**
* @method throttleTyping
@@ -280,25 +260,25 @@ export default Vue.extend({
}
if (
this.ui.replyChatbarContent.from &&
!RegExp(this.$Config.regex.uuidv4).test(this.recipient.textilePubkey)
!RegExp(this.$Config.regex.uuidv4).test((this.recipient as Group)?.id)
) {
this.$store.dispatch('textile/sendReplyMessage', {
to: this.recipient.textilePubkey,
to: (this.recipient as Friend).textilePubkey,
text: value,
replyTo: this.ui.replyChatbarContent.messageID,
replyType: MessagingTypesEnum.TEXT,
})
return
}
// Check if it's a group
if (
RegExp(this.$Config.regex.uuidv4).test(
this.recipient.textilePubkey.split('|')[1],
(this.recipient as Group)?.id?.split('|')[1],
)
) {
if (this.ui.replyChatbarContent.from) {
this.$store.dispatch('textile/sendGroupReplyMessage', {
to: this.recipient.textilePubkey,
to: (this.recipient as Group).id,
text: value,
replyTo: this.ui.replyChatbarContent.messageID,
replyType: MessagingTypesEnum.TEXT,
@@ -307,12 +287,12 @@ export default Vue.extend({
return
}
this.$store.dispatch('textile/sendGroupMessage', {
groupId: this.recipient.textilePubkey,
groupId: (this.recipient as Group).id,
message: value,
})
} else {
this.$store.dispatch('textile/sendTextMessage', {
to: this.recipient.textilePubkey,
to: (this.recipient as Friend).textilePubkey,
text: value,
})
}
Loading