Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing peerbook's websocket for full WebRTC #437

Merged
merged 53 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c208d45
Adding the book icon to the legend
daonb Oct 15, 2023
245e400
Refactoring the admin command
daonb Oct 22, 2023
57eaa30
Updating the nack schema
daonb Oct 22, 2023
57157b3
Fixixng small bugs
daonb Oct 23, 2023
f843ebf
Updating gatepad on succesful verification
daonb Oct 23, 2023
3553a00
Updating rename on peer_update
daonb Oct 24, 2023
c7ad16b
Cleaning up
daonb Oct 24, 2023
d5ce6b4
Fixing login
daonb Oct 25, 2023
13726a4
Fixing the offer and candidate signals
daonb Oct 25, 2023
959ff2f
Unparsing what needs to be parsed
daonb Oct 25, 2023
b38ac40
Fixing redis and sleeping longer
daonb Oct 25, 2023
eee6053
Fixing reconnect
daonb Oct 25, 2023
abd783a
Restoring an arrow
daonb Oct 25, 2023
e4f67fe
Fixing candidate passing
daonb Oct 26, 2023
6d75b62
Adding connection retries
daonb Oct 26, 2023
026b3cf
Moving PeerBook message handler wher it belongs
daonb Oct 30, 2023
f81a2db
Linting
daonb Oct 30, 2023
1611642
Linting some more
daonb Oct 30, 2023
f836b7a
Fixing closed connection discovery
daonb Oct 31, 2023
3cfafc6
Updating pods db
daonb Oct 31, 2023
a431cfa
Fixing offer after candidate
daonb Oct 31, 2023
3a09e33
Removing double json
daonb Nov 1, 2023
09726b8
Fixing a glitch
daonb Nov 2, 2023
3cbb101
WIP: Supporting WHIP Server
daonb Nov 2, 2023
bc06e4d
Adding html titles (tooltips) to buttons for mouse users (#425)
DmitryPorotov Nov 1, 2023
80fc213
Adding support for latest peerbook
daonb Nov 6, 2023
9e33acd
Improving tests stability
daonb Nov 6, 2023
011764e
Upgrading capacitor
daonb Nov 6, 2023
b813cfb
WIP: Making it work
daonb Nov 6, 2023
c6d23aa
Improving test stability
daonb Nov 7, 2023
a5e3fb7
Catching errors
daonb Nov 7, 2023
8b3b53e
Fixing WHIP resource delete
daonb Nov 7, 2023
003e156
Fixing ignoreAppEvents
daonb Nov 8, 2023
0d6ae13
updating the tests
daonb Nov 8, 2023
360ef36
Improving notifications & prompt
daonb Nov 8, 2023
4a4d663
Improving reset
daonb Nov 8, 2023
3e04431
Moving isOpen where it belongs
daonb Nov 8, 2023
bd0f733
Sending only sdp when connecting to WHIP
daonb Nov 9, 2023
39d4dac
Simplifying reconnect
daonb Nov 13, 2023
6613e5a
Fixing the peerbook aatp
daonb Nov 13, 2023
4ff8c19
WIP: optimizing reconnect
daonb Nov 13, 2023
19f68ff
Polishing & Restoring un related changes
daonb Nov 14, 2023
807070a
Moving the retry where it belongs
daonb Nov 14, 2023
600db47
Removing the first failing resize
daonb Nov 16, 2023
a66b0be
Adding PeerBook to ui tests
daonb Nov 16, 2023
3535ade
Improving notification
daonb Nov 16, 2023
da1d477
Polishing
daonb Nov 16, 2023
67ee7e8
Improving flaky tests
daonb Nov 17, 2023
4aaf60c
Linting
daonb Nov 17, 2023
b930d8f
Polishing
daonb Nov 17, 2023
a5b3dab
Adding a sleep to a test for resiliency
daonb Nov 19, 2023
e031764
Removing comments
daonb Nov 19, 2023
640a26d
Avoiding reentrancy
daonb Nov 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Using only WebRTC to connect to PeerBook

## [1.8.1] - 2023/9/14

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions aatp/http_webrtc/lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ services:
dockerfile: ./aatp/infra/webexec/Dockerfile
args:
REF: ${WEBEXEC_REF-master}
environment:
WEBEXEC_SERVER_URL: http://webexec:7777
volumes:
- ./aatp/http_webrtc/webexec_conf:/conf
- webexec_auth:/auth
Expand Down
3 changes: 3 additions & 0 deletions aatp/infra/redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM redis:alpine
RUN echo "appendonly no" >> /etc/redis.conf
CMD [ "redis-server", "/etc/redis.conf" ]
3 changes: 2 additions & 1 deletion aatp/infra/webexec/docker_entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if [[ $PEERBOOK == "1" ]]
then
/scripts/wait-for-it.sh -h peerbook -p 17777
fi
trap 'break' SIGTERM
while true
do
su - runner -c '/usr/local/bin/webexec start --debug'
su - runner -c "WEBEXEC_SERVER_URL=$WEBEXEC_SERVER_URL /usr/local/bin/webexec start --debug"
done
16 changes: 11 additions & 5 deletions aatp/peerbook_webrtc/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test.describe('peerbook administration', () => {
await page.evaluate(async () => {
terminal7.pb.close()
try {
await terminal7.pb.connect("$ValidBearer")
await terminal7.pb.connect({token: "$ValidBearer"})
} catch (e) {
console.log("pb.connect failed", e)
if (e == "Unregistered")
Expand Down Expand Up @@ -328,9 +328,13 @@ test.describe('peerbook administration', () => {
await page.keyboard.press("Enter")
await page.keyboard.type('testclient')
await page.keyboard.press("Enter")
await sleep(1000)
const fp = await page.evaluate(() => terminal7.getFingerprint())
expect(await redisClient.hGet(`peer:${fp}`, "user")).toBe(uid)
let peerUID = await redisClient.hGet(`peer:${fp}`, "user")
while (!peerUID) {
await sleep(100)
peerUID = await redisClient.hGet(`peer:${fp}`, "user")
}
expect(peerUID).toBe(uid)
twr = await getTWRBuffer(page)
await page.screenshot({ path: '/result/4.png' })
expect(twr).toMatch(/Email sent/)
Expand All @@ -346,13 +350,15 @@ test.describe('peerbook administration', () => {
expect(url).toMatch(/^http:\/\/peerbook:17777\/verify/)
await sleep(500)
const fp = await page.evaluate(() => terminal7.getFingerprint())
console.log("fp", fp)
console.log("new client's fp", fp)
expect(await redisClient.hGet(`peer:${fp}`, "user")).toBe("123456")
const verifyPage = await (await browser.newContext()).newPage()
await verifyPage.goto(url)
await verifyPage.screenshot({ path: '/result/6.png' })
await verifyPage.click('button[type="submit"]')
await sleep(500)
// TODO: optimize this sleep. 5 second is the max time it takes for the
// client to be logged in. We should have a retry loop instead.
await sleep(2000)
const twr = await getTWRBuffer(page)
await page.screenshot({ path: '/result/5.png' })
expect(twr).toMatch(/Logged in/)
Expand Down
6 changes: 5 additions & 1 deletion aatp/peerbook_webrtc/lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
REF: ${WEBEXEC_REF-master}
environment:
PEERBOOK: 1
WEBEXEC_SERVER_URL: http://webexec:7777
depends_on:
- peerbook
volumes:
Expand All @@ -52,8 +53,11 @@ services:
PB_SMTP_HOST: smtp
PB_SMTP_PORT: 1025
PB_HOME_URL: http://peerbook:17777
WEBEXEC_SERVER_URL: http://peerbook:17777
redis:
image: "redis:alpine"
build:
context: .
dockerfile: ./aatp/infra/redis/Dockerfile
revenuecat:
image: "mockserver/mockserver"
environment:
Expand Down
38 changes: 38 additions & 0 deletions aatp/ui/lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,46 @@ services:
dockerfile: ./aatp/infra/webexec/Dockerfile
args:
REF: ${WEBEXEC_REF-master}
environment:
WEBEXEC_SERVER_URL: http://webexec:7777
volumes:
- ./aatp/ui/webexec_conf:/conf
- webexec_auth:/auth
peerbook:
build:
context: .
dockerfile: ./aatp/infra/peerbook/Dockerfile
args:
REF: ${PEERBOOK_REF-master}
expose:
- 17777
depends_on:
- redis
- revenuecat
environment:
REDIS_HOST: redis:6379
REVENUECAT_URL: http://revenuecat:1080
PB_SMTP_HOST: smtp
PB_SMTP_PORT: 1025
PB_HOME_URL: http://peerbook:17777
WEBEXEC_SERVER_URL: http://peerbook:17777
redis:
build:
context: .
dockerfile: ./aatp/infra/redis/Dockerfile
revenuecat:
image: "mockserver/mockserver"
environment:
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/revenuecat_double.json
MOCKSERVER_LOG_LEVEL: WARN
expose:
- 1080
volumes:
- ./aatp/peerbook_webrtc:/config
smtp:
image: jcalonso/mailhog
expose:
- 1025
- 8025
volumes:
webexec_auth:
14 changes: 12 additions & 2 deletions aatp/ui/ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ test.describe('terminal7 UI', () => {
await page.evaluate(async () => {
window.terminal7.notify = (msg: string) => console.log("NOTIFY: "+msg)
localStorage.setItem("CapacitorStorage.dotfile",`
[net]
peerbook = "peerbook:17777"
[peerbook]
insecure=true`)
localStorage.setItem("CapacitorStorage.gates", JSON.stringify(
Expand Down Expand Up @@ -82,12 +84,16 @@ insecure=true`)
await page.reload({waitUntil: "networkidle"})
await page.evaluate(async () => {
window.notifications = []
while (!window.terminal7) {
await new Promise(r => setTimeout(r, 100))
}
window.terminal7.notify = (m) => window.notifications.push(m)
})
await connectFirstGate(page)
await sleep(500)
await page.locator('.tabbar .reset').click()
await expect(page.locator('#t0')).toBeVisible()
await sleep(500)
await sleep(100)
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
await expect(page.locator('.windows-container')).toBeHidden()
Expand All @@ -96,15 +102,19 @@ insecure=true`)
await page.reload({waitUntil: "networkidle"})
await page.evaluate(async () => {
window.notifications = []
while (!window.terminal7) {
await new Promise(r => setTimeout(r, 100))
}
window.terminal7.notify = (m) => window.notifications.push(m)
})
await connectFirstGate(page)
await sleep(500)
await page.screenshot({ path: `/result/2.png` })
await page.locator('.tabbar .reset').click()
await expect(page.locator('#t0')).toBeVisible()
await sleep(20)
await sleep(100)
await page.keyboard.press('Enter')
await sleep(100)
await expect(page.locator('#t0')).toBeHidden()
await expect(page.locator('.pane')).toHaveCount(1)
await expect(page.locator('.windows-container')).toBeVisible()
Expand Down
27 changes: 16 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h1 id="title-short">T7</h1>
</div>
<ul>
<li>
&#x1F4D6; &nbsp;
<a id="peerbook-legend">
PeerBook
<span id="peerbook-status" class="status">🚧</span>
Expand Down Expand Up @@ -190,16 +191,20 @@ <h1 class="warning">Network is down</h1>
</div>
</div>
<nav id="navbar" class="bar">
<button type="button" id="map-button" class="off"><i class="f7-icons">map</i></button>
<button type="button" id="log-button"><i class="f7-icons">greaterthan</i></button>
<button type="button" id="trash-button" class="pane-buttons off"><i class="f7-icons">rectangle_fill_badge_xmark</i></button>
<button type="button" id="divide-h" class="pane-buttons off"><i class="f7-icons">divide</i></button>
<button type="button" id="divide-v" class="pane-buttons off">
<button type="button" id="map-button" class="off" title="Map"><i class="f7-icons">map</i></button>
<button type="button" id="log-button" title="Log"><i class="f7-icons">greaterthan</i></button>
<button type="button" id="trash-button" class="pane-buttons off" title="Close pane">
<i class="f7-icons">rectangle_fill_badge_xmark</i></button>
<button type="button" id="divide-h" class="pane-buttons off" title="Split horizontally">
<i class="f7-icons">divide</i></button>
<button type="button" id="divide-v" class="pane-buttons off" title="Split vertically">
<i class="f7-icons" style="display: inline-block; transform: rotate(90deg);">divide</i></button>
<button type="button" id="search-button" class="pane-buttons off"><i class="f7-icons">doc_text_search</i></button>
<button type="button" id="video-button" class="pane-buttons off"><i class="f7-icons">videocam</i></button>
<button type="button" id="help-button"><i class="f7-icons">question</i></button>
<button type="button" id="dotfile-button"><i class="f7-icons">gear</i></button>
<button type="button" id="search-button" class="pane-buttons off" title="Search">
<i class="f7-icons">doc_text_search</i></button>
<button type="button" id="video-button" class="pane-buttons off" title="Video">
<i class="f7-icons">videocam</i></button>
<button type="button" id="help-button"><i class="f7-icons" title="Help">question</i></button>
<button type="button" id="dotfile-button"><i class="f7-icons" title="Dotfile config">gear</i></button>
</nav>

<template id="lose-state-template">
Expand Down Expand Up @@ -266,11 +271,11 @@ <h1><span class="name"></span> Error</h1>
</div>
</template>
<nav class="tabbar">
<button type="button" class="add-tab"><i class="f7-icons">
<button type="button" class="add-tab" title="Add pane"><i class="f7-icons">
plus</i></button>
<nav class="tabbar-names">
</nav>
<button type="button" class="reset"><i class="f7-icons">
<button type="button" class="reset" title="Reset connection"><i class="f7-icons">
arrow_2_circlepath</i></button>
</nav>
</template>
Expand Down
6 changes: 3 additions & 3 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd ../..\n/usr/local/bin/npx cap copy ios\n";
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd ../..\n/usr/local/bin/npx cap sync ios\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -308,7 +308,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -359,7 +359,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
13 changes: 1 addition & 12 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
def assertDeploymentTarget(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# ensure IPHONEOS_DEPLOYMENT_TARGET is at least 13.0
deployment_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f
should_upgrade = deployment_target < 13.0 && deployment_target != 0.0
if should_upgrade
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end
require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers'
platform :ios, '15.4'
use_frameworks!

Expand Down
32 changes: 16 additions & 16 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PODS:
- Capacitor (5.3.0):
- Capacitor (5.5.1):
- CapacitorCordova
- CapacitorApp (5.0.6):
- Capacitor
- CapacitorBrowser (5.0.6):
- CapacitorBrowser (5.1.0):
- Capacitor
- CapacitorCamera (5.0.7):
- Capacitor
- CapacitorClipboard (5.0.6):
- Capacitor
- CapacitorCordova (5.3.0)
- CapacitorCordova (5.5.1)
- CapacitorDevice (5.0.6):
- Capacitor
- CapacitorKeyboard (5.0.6):
Expand All @@ -28,12 +28,12 @@ PODS:
- CapacitorStatusBar (5.0.6):
- Capacitor
- NMSSHT7 (2.9.1)
- PurchasesHybridCommon (7.0.0):
- RevenueCat (= 4.27.0)
- RevenueCat (4.27.0)
- RevenuecatPurchasesCapacitor (7.0.0):
- PurchasesHybridCommon (7.3.0):
- RevenueCat (= 4.30.2)
- RevenueCat (4.30.2)
- RevenuecatPurchasesCapacitor (7.1.0):
- Capacitor
- PurchasesHybridCommon (= 7.0.0)
- PurchasesHybridCommon (= 7.3.0)

DEPENDENCIES:
- "Capacitor (from `../../node_modules/@capacitor/ios`)"
Expand Down Expand Up @@ -91,12 +91,12 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@revenuecat/purchases-capacitor"

SPEC CHECKSUMS:
Capacitor: 1ac9165943bc4f2137642d218c5ba05df811de69
Capacitor: 9da0a2415e3b6098511f8b5ffdb578d91ee79f8f
CapacitorApp: 024e1b1bea5f883d79f6330d309bc441c88ad04a
CapacitorBrowser: 6192948e0ce804fd72aaf77f4114a3ad2e08c760
CapacitorBrowser: 7a0fb6a1011abfaaf2dfedfd8248f942a8eda3d6
CapacitorCamera: 084b0b228bba7d00587910337b1c89e93b1d32ab
CapacitorClipboard: 77edf49827ea21da2a9c05c690a4a6a4d07199c4
CapacitorCordova: b9374d68e63ce29e96ab5db994cf14fbefd722c9
CapacitorCordova: e128cc7688c070ca0bfa439898a5f609da8dbcfe
CapacitorDevice: 2c968f98a1ec4d22357418c1521e7ddc46c675e6
CapacitorKeyboard: b978154b024a5f65e044908e37d15b7de58b9d12
CapacitorNativeBiometric: b47637a8cd349bdac014424bb4ddcae9ee5d4919
Expand All @@ -106,10 +106,10 @@ SPEC CHECKSUMS:
CapacitorSshPlugin: 79f67cb26d40bd0c07cec6dda93d93d5faf7b614
CapacitorStatusBar: 565c0a1ebd79bb40d797606a8992b4a105885309
NMSSHT7: 67f9d8f43b40b997728761b4cf2aa7ea660ba7c2
PurchasesHybridCommon: af3b2413f9cb999bc1fdca44770bdaf39dfb89fa
RevenueCat: 84fbe2eb9bbf63e1abf346ccd3ff9ee45d633e3b
RevenuecatPurchasesCapacitor: c0de310959a58b3217acd7ec5ce981175bb050b1
PurchasesHybridCommon: a3101e0f94de9bf872a67a6511ecaa932fdef02e
RevenueCat: bedd1226d8081830838fb492603cc96349a24f34
RevenuecatPurchasesCapacitor: cf268ba90377d12f49e6b003244a0c0fa87b1a80

PODFILE CHECKSUM: 4e9654adb0765b7ee27622f314473ebfafd489a8
PODFILE CHECKSUM: b1f79f7d62e59482e73924f44c49c50186ac72be

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
},
"devDependencies": {
"@capacitor/assets": "^2.0.4",
"native-run": "^1.7.4",
"@playwright/test": "^1.20.1",
"@types/hammerjs": "^2.0.42",
"@types/xterm": "^3.0.0",
Expand All @@ -73,13 +74,12 @@
"start": "npm run dev",
"dev": "vite",
"stage": "vite build --sourcemap && vite preview",
"run": "cap run ios",
"run": "vite build -c vite.dev.config.js && cap run ios",
"test": "vitest",
"build": "vite build -c vite.dev.config.js",
"clean": "rm -rf dist ios/App/App/public/*",
"aatp": "bash ./aatp/run",
"lint": "npx eslint aatp src --ext .js,.ts && npx tsc --noEmit --target es2022 --moduleResolution node src/*.ts",
"capacitor:copy:before": "npm run build"
"lint": "npx eslint aatp src --ext .js,.ts && npx tsc --skipLibCheck --noEmit --target es2022 --moduleResolution node src/*.ts"
},
"repository": {
"type": "git",
Expand Down
Loading
Loading