diff --git a/.github/workflows/BuildNative.yaml b/.github/workflows/BuildNative.yaml deleted file mode 100644 index 7859892a38..0000000000 --- a/.github/workflows/BuildNative.yaml +++ /dev/null @@ -1,152 +0,0 @@ -name: BuildNative -on: - push: - tags: - - '*' ## We are watching for all tags. Create a release, generate a new tag, and the rest of this script will run -jobs: - build: - runs-on: macos-latest - steps: - - name: Checkout the code - uses: actions/checkout@v2 - with: - persist-credentials: false - submodules: true ## Installs the android, electron, and locales directory - fetch-depth: 400 ## This fetches entire history, we need this so we can get all the tags - - name: Reconfigure git to use HTTP authentication - run: > - git config --global url."https://github.com/".insteadOf - ssh://git@github.com/ - - name: Get Tags/Checkout bug override - run: git fetch --tags --force ## take this out later if https://github.com/actions/checkout/issues/290 is fixed - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV ## Later this is used to update the output files so they have the tag number in the name - - name: Find and Replace Version Numer in Package File ## bumps package version to match ref for the build, will commit to repo at the end when the files are created - run: | - sed -i '' -e 's/\"version\":.*/\"version\": "${{ env.RELEASE_VERSION }}",/g' package.json - - name: Get Current Release Version - run: | - echo $RELEASE_VERSION - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: '16' - - - name: Install dependencies - run: yarn - - - name: Building Android Version - run: | - yarn android-generate - cp "android/app/build/outputs/apk/debug/app-debug.apk" "android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk" - - - name: Building Windows Version - run: | - yarn electron-windows - cp "electron/dist/Satellite Setup 0.0.1.exe" "electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe" - # cp "electron/dist/Satellite Setup 0.0.1.exe.blockmap" "electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe.blockmap" - - - name: Building Mac Version - run: | - yarn electron-mac - cp "electron/dist/Satellite-0.0.1-mac.zip" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip" - cp "electron/dist/Satellite-0.0.1-arm64-mac.zip" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip" - # cp "electron/dist/Satellite-0.0.1-mac.dmg.blockmap" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.dmg.blockmap" - # cp "electron/dist/Satellite-0.0.1-arm64-mac.dmg.blockmap" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.dmg.blockmap" - - - name: Building Linux Version - run: | - yarn electron-linux - cp "electron/dist/Satellite-0.0.1.AppImage" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage" - cp "electron/dist/Satellite-0.0.1-arm64.AppImage" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage" - - - name: Writing checksums to Release - run: | - touch checksums.txt - echo '### sha 256 checksums ###' >> checksums.txt - echo '| platform | checksum | file |' >> checksums.txt - echo '| ----------- | ----------- | ----------- |' >> checksums.txt - (echo '| Android | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk)) >> checksums.txt - echo ' | Satellite-${{ env.RELEASE_VERSION }}.apk |' >> checksums.txt - (echo '| Windows (x86) | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe)) >> checksums.txt - echo ' | Satellite-Setup-${{ env.RELEASE_VERSION }}.exe |' >> checksums.txt - (echo '| Linux (arm) | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage)) >> checksums.txt - echo ' | Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage |' >> checksums.txt - (echo '| Linux (x86) | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage)) >> checksums.txt - echo ' | Satellite-${{ env.RELEASE_VERSION }}.AppImage |' >> checksums.txt - (echo '| Mac (x86) | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip)) >> checksums.txt - echo ' | Satellite-${{ env.RELEASE_VERSION }}-mac.zip |' >> checksums.txt - (echo '| Mac (arm) | ') | tr -d '\n' >> checksums.txt - (head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip)) >> checksums.txt - echo ' | Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip |' >> checksums.txt - - - name: Getting Tag Names - run: | - echo $'\n### Changelog ###' >> checksums.txt - echo "ELDERLY=$(git tag --sort version:refname | tail -n 3 | head -n 1)" >> $GITHUB_ENV - echo "START=$(git tag --sort version:refname | tail -n 2 | head -n 1)" >> $GITHUB_ENV - echo "END=$(git tag --sort version:refname | tail -n 1 | head -n 1)" >> $GITHUB_ENV - echo $(git tag) - - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - commitMode: true - configuration: ".github/config/changelog_config.json" - fromTag: "${{ env.ELDERLY }}" - toTag: "${{ env.END }}" - outputFile: ./changelog.txt - - - name: Combine Changelog and Checksums - run: | - cat ./changelog.txt >> checksums.txt - sed -i '' '/Merge pull request/d' checksums.txt - sed -i '' '/Merge branch/d' checksums.txt - awk '!visited[$0]++' checksums.txt > deduplicated_checksums.txt - - - name: Copy file to release - uses: softprops/action-gh-release@v1 - with: - files: | - android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk - electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage - electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage - electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip - electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip - electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe - ./deduplicated_checksums.txt - body_path: ./deduplicated_checksums.txt - - commit: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout the code - uses: actions/checkout@v2 - with: - ref: main - - name: Set env - run: | - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Find and Replace Version Numer in Package File ## bumps package version to match ref for the build, will commit to repo at the end when the files are created - run: | - sed -i -e 's/\"version\":.*/\"version\": "${{ env.RELEASE_VERSION }}",/g' ./package.json - - name: Commit Package.json to Repo - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: main - commit_message: Increment Package Version - file_pattern: ./package.json - commit_user_name: Github Actions # defaults to "GitHub Actions" - commit_user_email: dev@satellite.im # defaults to "actions@github.com" - commit_author: Github Actions # defaults to author of the commit that triggered the run \ No newline at end of file diff --git a/.github/workflows/GenerateChangelog.yml b/.github/workflows/GenerateChangelog.yml new file mode 100644 index 0000000000..c15cde9924 --- /dev/null +++ b/.github/workflows/GenerateChangelog.yml @@ -0,0 +1,92 @@ +name: GenerateChangelog +on: + push: + tags: + - '*' ## We are watching for all tags. Create a release, generate a new tag, and the rest of this script will run +jobs: + build: + runs-on: macos-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + with: + persist-credentials: false + submodules: true ## Installs the android, electron, and locales directory + fetch-depth: 400 ## This fetches entire history, we need this so we can get all the tags + - name: Reconfigure git to use HTTP authentication + run: > + git config --global url."https://github.com/".insteadOf + ssh://git@github.com/ + - name: Get Tags/Checkout bug override + run: git fetch --tags --force ## take this out later if https://github.com/actions/checkout/issues/290 is fixed + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV ## Later this is used to update the output files so they have the tag number in the name + - name: Find and Replace Version Numer in Package File ## bumps package version to match ref for the build, will commit to repo at the end when the files are created + run: | + sed -i '' -e 's/\"version\":.*/\"version\": "${{ env.RELEASE_VERSION }}",/g' package.json + - name: Get Current Release Version + run: | + echo $RELEASE_VERSION + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: '16' + + # - name: Install dependencies + # run: yarn + + - name: Getting Tag Names + run: | + echo "ELDERLY=$(git tag --sort version:refname | tail -n 3 | head -n 1)" >> $GITHUB_ENV + echo "START=$(git tag --sort version:refname | tail -n 2 | head -n 1)" >> $GITHUB_ENV + echo "END=$(git tag --sort version:refname | tail -n 1 | head -n 1)" >> $GITHUB_ENV + echo $(git tag) + + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commitMode: true + configuration: ".github/config/changelog_config.json" + fromTag: "${{ env.ELDERLY }}" + toTag: "${{ env.END }}" + outputFile: ./changelog.txt + + - name: Combine Changelog and Checksums + run: | + sed -i '' '/Merge pull request/d' changelog.txt + sed -i '' '/Merge branch/d' changelog.txt + awk '!visited[$0]++' changelog.txt > deduplicated_changelog.txt + + - name: Copy file to release + uses: softprops/action-gh-release@v1 + with: + body_path: ./deduplicated_changelog.txt + + commit: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v2 + with: + ref: main + - name: Set env + run: | + echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Find and Replace Version Numer in Package File ## bumps package version to match ref for the build, will commit to repo at the end when the files are created + run: | + sed -i -e 's/\"version\":.*/\"version\": "${{ env.RELEASE_VERSION }}",/g' ./package.json + - name: Commit Package.json to Repo + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: Increment Package Version + file_pattern: ./package.json + commit_user_name: Github Actions # defaults to "GitHub Actions" + commit_user_email: dev@satellite.im # defaults to "actions@github.com" + commit_author: Github Actions # defaults to author of the commit that triggered the run \ No newline at end of file diff --git a/components/mixins/Layouts/Layout.ts b/components/mixins/Layouts/Layout.ts index b1d39de9f4..cbe4a2fb8c 100644 --- a/components/mixins/Layouts/Layout.ts +++ b/components/mixins/Layouts/Layout.ts @@ -46,8 +46,8 @@ export default Vue.extend({ */ toggleMarketPlace() { this.$store.commit('ui/toggleModal', { - name: 'showMarketPlace', - state: !this.ui.modals.showMarketPlace, + name: 'marketplace', + state: !this.ui.modals['marketplace'], }) }, }, diff --git a/components/tailored/core/chatbar/Chatbar.html b/components/tailored/core/chatbar/Chatbar.html index 4a02bf3bf7..008d5cdeea 100644 --- a/components/tailored/core/chatbar/Chatbar.html +++ b/components/tailored/core/chatbar/Chatbar.html @@ -22,5 +22,5 @@ - + diff --git a/components/tailored/core/chatbar/Chatbar.vue b/components/tailored/core/chatbar/Chatbar.vue index b225e13b3c..0e65b56376 100644 --- a/components/tailored/core/chatbar/Chatbar.vue +++ b/components/tailored/core/chatbar/Chatbar.vue @@ -3,6 +3,7 @@ diff --git a/components/tailored/core/chatbar/footer/Footer.vue b/components/tailored/core/chatbar/footer/Footer.vue index 022d1f1736..f33dc9cf53 100644 --- a/components/tailored/core/chatbar/footer/Footer.vue +++ b/components/tailored/core/chatbar/footer/Footer.vue @@ -1,7 +1,6 @@ diff --git a/components/ui/UpdateModal/UpdateModal.html b/components/ui/UpdateModal/UpdateModal.html index 84da2fced4..1c502df76a 100644 --- a/components/ui/UpdateModal/UpdateModal.html +++ b/components/ui/UpdateModal/UpdateModal.html @@ -1,20 +1,19 @@ -
+
-
+
- +
-{{ releaseData.body }}
+        
       
- +
- - - --> + import Vue from 'vue' - +import { mapState } from 'vuex' +import { ReleaseNotes } from '~/libraries/ui/ReleaseNotes' import { RefreshCwIcon, XIcon } from 'satellite-lucide-icons' +import VueMarkdown from 'vue-markdown' export default Vue.extend({ components: { RefreshCwIcon, XIcon, + VueMarkdown, }, data() { return { hasMinorUpdate: false, requiresUpdate: false, - releaseData: {} + releaseData: {}, } }, + computed: { + ...mapState(['ui']), + }, mounted() { - let lsVersion = localStorage.getItem('local-version') - if (!lsVersion) { - localStorage.setItem('local-version', this.$config.clientVersion) - lsVersion = this.$config.clientVersion - return - } - - const minorVersion = this.$config.clientVersion.split('.')[1] - const patchVersion = this.$config.clientVersion.split('.')[2] - - // A update which requires resetting of the app has occured. - if (lsVersion.split('.')[1] !== minorVersion) { - this.getReleaseBody() - this.$data.requiresUpdate = true - this.$data.hasMinorUpdate = true - return - } - // A version which brings new features without major changes exists - if (lsVersion.split('.')[2] !== patchVersion) { - this.getReleaseBody() - this.$data.hasMinorUpdate = true - } + this.getReleaseBody() }, methods: { - clearAndReload() { - localStorage.clear() - window.location.reload() - }, + // clearAndReload() { + // commented out until we can test this - we probably won't want to clean all of local storage' + // localStorage.removeItem('local-version') + // window.location.reload() + // }, skipVersion() { localStorage.setItem('local-version', this.$config.clientVersion) this.$data.requiresUpdate = false this.$data.hasMinorUpdate = false + this.toggleVisibility() + }, + async getReleaseBody() { + await ReleaseNotes().then((releaseData) => { + this.releaseData = releaseData + }) + }, + toggleVisibility() { + this.$store.commit('ui/toggleModal', { + name: 'changelog', + state: !this.ui.modals['changelog'], + }) }, - getReleaseBody() { - fetch('https://api.github.com/repos/Satellite-im/Core-PWA/releases/latest') - .then(response => response.json()) - .then(data => { - this.releaseData = data - }) - } }, }) diff --git a/config.ts b/config.ts index edff10b759..06f03d7b13 100644 --- a/config.ts +++ b/config.ts @@ -33,6 +33,10 @@ export const Config = { 'wss://tracker.openwebtorrent.com', 'wss://tracker.sloppyta.co:443/announce', 'wss://tracker.novage.com.ua:443/announce', + 'udp://opentracker.i2p.rocks:6969/announce', + 'http://opentracker.i2p.rocks:6969/announce', + 'udp://tracker.opentrackr.org:1337/announce', + 'http://tracker.opentrackr.org:1337/announce', ], }, solana: { diff --git a/electron b/electron index c54d4cd938..489248badb 160000 --- a/electron +++ b/electron @@ -1 +1 @@ -Subproject commit c54d4cd93872f940003ccd05d86b97cbbd901bf7 +Subproject commit 489248badb0a308bf4a624f5a08dcafd60afe56b diff --git a/libraries/WebRTC/Call.ts b/libraries/WebRTC/Call.ts index af1d8231f8..580f0404ee 100644 --- a/libraries/WebRTC/Call.ts +++ b/libraries/WebRTC/Call.ts @@ -78,8 +78,6 @@ export class Call extends Emitter { * call.hangUp() */ hangUp() { - console.log('hangup') - this.peer?.destroy() this.stream?.getTracks().forEach((track) => track.stop()) @@ -150,7 +148,7 @@ export class Call extends Emitter { replaceTrack( oldTrack: MediaStreamTrack, newTrack: MediaStreamTrack, - stream: MediaStream + stream: MediaStream, ) { this.peer?.replaceTrack(oldTrack, newTrack, stream) } @@ -163,7 +161,6 @@ export class Call extends Emitter { */ protected _bindBusListeners() { this.communicationBus?.on('SIGNAL', this._onBusSignal.bind(this)) - // this.communicationBus?.on('REFUSE', this.) } /** diff --git a/libraries/WebRTC/Peer.ts b/libraries/WebRTC/Peer.ts index 06e37d75f1..db1ec4ec9d 100644 --- a/libraries/WebRTC/Peer.ts +++ b/libraries/WebRTC/Peer.ts @@ -1 +1,36 @@ -export default class Peer {} +import { Call } from './Call' +import { WireMessage, WireMessageType } from './types' +import { Wire } from './Wire' + +export class Peer { + identifier: string // identifier of the user to connect with + communicationBus: Wire + call: Call + + constructor( + originator: string, + identifier: string, + channel: string, + announceUrls: string[] = [], + ) { + this.identifier = identifier + + this.communicationBus = new Wire( + originator, + identifier, + channel, + announceUrls, + true, + ) + + this.call = new Call(this.communicationBus) + } + + send(type: WireMessageType, data: WireMessage['payload']) { + this.communicationBus.send({ + type, + payload: data, + sentAt: Date.now(), + } as WireMessage) + } +} diff --git a/libraries/WebRTC/WebRTC.ts b/libraries/WebRTC/WebRTC.ts index 8dfa464b5a..4e1c0e4034 100644 --- a/libraries/WebRTC/WebRTC.ts +++ b/libraries/WebRTC/WebRTC.ts @@ -2,19 +2,17 @@ import { Config } from '~/config' import Emitter from '~/libraries/WebRTC/Emitter' import { Wire } from '~/libraries/WebRTC/Wire' -import { - WebRTCEventListeners, - WebRTCEvents, - WireEvents, -} from '~/libraries/WebRTC/types' +import { WebRTCEventListeners, WireEvents } from '~/libraries/WebRTC/types' +import { Peer } from './Peer' +import { WebRTCError } from '~/store/webrtc/types' export default class WebRTC extends Emitter { // Identifier to connect to signaling server with - id: string | undefined + originator?: string // If this is undefined, the WebRTC services cannot run - initalized: boolean | undefined + initialized?: boolean // List of peers we're actively or have been connected to - peers: Map | undefined + peers: Map // --- Internal --- // @@ -31,15 +29,17 @@ export default class WebRTC extends Emitter { /** * @method init * @description Bind required startup data to the WebRTC class - * @param id identifier to connect to the signaling server with + * @param originator identifier of the current user * @example */ - init(id: string) { - this.id = id + init(originator: string) { + this.originator = originator - this.initalized = true + this.initialized = true this._runQueue() - this.emit(WebRTCEvents.INIT) + this.emit('INIT') + + console.log('init', this.originator, this._announceURLs) } /** @@ -87,27 +87,30 @@ export default class WebRTC extends Emitter { * @method _connect * @description Internal abstraction of connect to allow for connection queueing * @param peerId identifier of peer we're connecting to + * @param channel Secret communication channel you want to connect with * @returns * @example */ protected _connect(peerId: string, channel: string): void { - console.log('connecting to', peerId) - const wire = new Wire( - 'originator', - peerId, - channel, - this._announceURLs, - false - ) - - this._bindWireListeners(wire) - - return undefined + if (!this.initialized || !this.originator) { + throw new Error(WebRTCError.NOT_INITIALIZED) + } + + // Avoid multiple connections to the same peer + if (this.peers.has(peerId)) { + return + } + + const peer = new Peer(this.originator, peerId, channel, this._announceURLs) + + this._bindWireListeners(peer.communicationBus) + + this.peers.set(peerId, peer) } protected _bindWireListeners(wire: Wire) { wire.on('CONNECT', ({ peerId }) => { - this.emit(WebRTCEvents.PEER_CONNECT, { peerId }) + this.emit('PEER_CONNECT', { peerId }) }) wire.on('DATA', ({ peerId, data }) => { @@ -142,18 +145,19 @@ export default class WebRTC extends Emitter { * @returns * @example */ - getPeer(peerId: string): Wire | undefined { - return this.peers?.get(peerId) + getPeer(peerId: string): Peer | undefined { + return this.peers.get(peerId) } /** * @method connect * @description Connect to a new peer * @param peerId identifier of peer we're connecting to + * @param channel Secret communication channel you want to connect with * @example */ connect(peerId: string, channel: string) { - if (!this.initalized) { + if (!this.initialized) { this._queue(() => this._connect(peerId, channel)) } else { this._connect(peerId, channel) diff --git a/libraries/WebRTC/Wire.ts b/libraries/WebRTC/Wire.ts index d39d40e96e..41f5e44e13 100644 --- a/libraries/WebRTC/Wire.ts +++ b/libraries/WebRTC/Wire.ts @@ -10,6 +10,7 @@ import { import { wireDataMessage, wireIdentificationMessage, + wireKeyboardState, wireRefuseConnectionMessage, wireSignalMessage, } from './encoders' @@ -96,7 +97,6 @@ export class Wire extends Emitter { peer.on('close', this._onClose.bind(this)) this.peer = peer - this._onConnectionHappened(peer) } @@ -147,7 +147,7 @@ export class Wire extends Emitter { const { peerId } = identificationMessage.right.payload if (peerId !== this.identifier) { - console.log('Not recognized. Drop connection') + console.warn('Not recognized. Drop connection') } else { console.log('identified') } @@ -197,6 +197,17 @@ export class Wire extends Emitter { return } + const keyboardState = wireKeyboardState.decode(parsedData) + + if (isRight(keyboardState)) { + this.emit('TYPING_STATE', { + state: keyboardState.right.payload.state, + peerId: this.identifier, + }) + + return + } + this.emit('RAW_DATA', { peerId: this.identifier, data: parsedData.data.payload, diff --git a/libraries/WebRTC/encoders.ts b/libraries/WebRTC/encoders.ts index 3e270d1445..496cadc3f2 100644 --- a/libraries/WebRTC/encoders.ts +++ b/libraries/WebRTC/encoders.ts @@ -43,3 +43,18 @@ export const wireRefuseConnectionMessage = t.intersection([ }), }), ]) + +export const KeyboardStates = t.union([ + t.literal('TYPING'), + t.literal('NOT_TYPING') +]) + +export const wireKeyboardState = t.intersection([ + wireBaseMessage, + t.type({ + type: t.literal('TYPING_STATE'), + payload: t.type({ + state: KeyboardStates, + }), + }), +]) diff --git a/libraries/WebRTC/types.ts b/libraries/WebRTC/types.ts index 47de2eb90b..a12310f741 100644 --- a/libraries/WebRTC/types.ts +++ b/libraries/WebRTC/types.ts @@ -4,6 +4,8 @@ import { wireIdentificationMessage, wireRefuseConnectionMessage, wireSignalMessage, + wireKeyboardState, + KeyboardStates, } from './Encoders' import { SignalData } from 'simple-peer' @@ -17,6 +19,10 @@ export interface WireEventListeners { IDENTIFICATION: (data: { peerId: string }) => void SIGNAL: (data: { peerId: string; data: SignalData }) => void REFUSE: (data: { peerId: string }) => void + TYPING_STATE: (data: { + state: TypeOf, + peerId: string + }) => void } export type WireEvents = keyof WireEventListeners @@ -24,6 +30,7 @@ export type WireEvents = keyof WireEventListeners export type WireIdentificationMessage = TypeOf export type WireDataMessage = TypeOf export type WireSignalMessage = TypeOf +export type WireKeyboardState = TypeOf export type WireRefuseConnectionMessage = TypeOf< typeof wireRefuseConnectionMessage > @@ -32,6 +39,7 @@ export interface WireMessages { DATA: WireDataMessage SIGNAL: WireSignalMessage REFUSE: WireRefuseConnectionMessage + TYPING_STATE: WireKeyboardState } export type WireMessageType = keyof WireMessages @@ -52,43 +60,14 @@ export interface CallEventListeners { export type CallEvents = keyof CallEventListeners -export enum WebRTCUserEvents { - INCOMING_CALL = 'INCOMING_CALL', - CALL_CONNECTED = 'CALL_CONNECTED', - STREAM_RECEIVED = 'STREAM_RECEIVED', - TRACK_RECEIVED = 'TRACK_RECEIVED', - CALL_ENDED = 'CALL_ENDED', - CALL_ANSWERED = 'CALL_ANSWERED', - CALL_BUSY = 'CALL_BUSY', -} - -export interface WebRTCUserEventListeners { - [WebRTCUserEvents.INCOMING_CALL]: () => void - [WebRTCUserEvents.CALL_CONNECTED]: () => void - [WebRTCUserEvents.STREAM_RECEIVED]: () => void - [WebRTCUserEvents.TRACK_RECEIVED]: () => void - [WebRTCUserEvents.CALL_ENDED]: () => void - [WebRTCUserEvents.CALL_ANSWERED]: () => void - [WebRTCUserEvents.CALL_BUSY]: () => void -} - -export enum WebRTCEvents { - INIT = 'INIT', - KILL = 'KILL', - ERROR = 'ERROR', - CLOSE = 'CLOSE', - TRACKER_CONNECT = 'TRACKER_CONNECT', - PEER_CONNECT = 'PEER_CONNECT', - PEER_DATA = 'PEER_DATA', -} export interface WebRTCEventListeners { - [WebRTCEvents.INIT]: () => void - [WebRTCEvents.KILL]: () => void - [WebRTCEvents.ERROR]: (data: { error: Error }) => void - [WebRTCEvents.CLOSE]: (data: { peerId: string }) => void - [WebRTCEvents.TRACKER_CONNECT]: (data: { tracker: string }) => void - [WebRTCEvents.PEER_CONNECT]: (data: { peerId: string }) => void - [WebRTCEvents.PEER_DATA]: (data: { peerId: string; data: any }) => void + INIT: () => void + KILL: () => void + ERROR: (data: { error: Error }) => void + TRACKER_CONNECT: (data: { peerId: string; tracker: string }) => void + PEER_CONNECT: (data: { peerId: string }) => void + PEER_DISCONNECT: (data: { peerId: string }) => void + PEER_DATA: (data: { peerId: string; data: any }) => void } export type WebRTCEvent = keyof WebRTCEventListeners @@ -102,14 +81,14 @@ export type WebRTCEventBox = { export type OptionalPayload< T extends keyof B, - B extends { [key in keyof B]: (...args: any[]) => any } + B extends { [key in keyof B]: (...args: any[]) => any }, > = Parameters extends never ? { data?: undefined } : { data: Parameters[0] } export type DataOf< T extends keyof B, - B extends { [key in keyof B]: (...args: any[]) => any } + B extends { [key in keyof B]: (...args: any[]) => any }, > = { at: number event: T diff --git a/libraries/ui/ReleaseNotes.ts b/libraries/ui/ReleaseNotes.ts new file mode 100644 index 0000000000..f62f99f2cd --- /dev/null +++ b/libraries/ui/ReleaseNotes.ts @@ -0,0 +1,18 @@ +/** + * @method ReleaseNotes + * @description Get the most recent release notes from github + * @param none + * @returns Promise with an object for the release info that includes a body + * @example + */ + +let responseBody: object +export async function ReleaseNotes(): Promise { + if (!responseBody) { + const response = await fetch('https://api.github.com/repos/Satellite-im/Core-PWA/releases/latest') + responseBody = await response.json() + return responseBody + } + return responseBody + } + diff --git a/locales b/locales index 2225fe1b3b..b02800a6ca 160000 --- a/locales +++ b/locales @@ -1 +1 @@ -Subproject commit 2225fe1b3b6dfd87cdd963cff36fbd500d8599e0 +Subproject commit b02800a6ca9777ba102e0256fcd5c28f34c2e2df diff --git a/pages/auth/unlock/Unlock.html b/pages/auth/unlock/Unlock.html index a5849262c6..cb1ce613ff 100644 --- a/pages/auth/unlock/Unlock.html +++ b/pages/auth/unlock/Unlock.html @@ -30,6 +30,9 @@
- - + + + + +
diff --git a/pages/auth/unlock/index.vue b/pages/auth/unlock/index.vue index 38c133b4cc..dc31b2e9e0 100644 --- a/pages/auth/unlock/index.vue +++ b/pages/auth/unlock/index.vue @@ -3,7 +3,7 @@