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

show if proxing on RemotePeer #994

Open
wants to merge 1,164 commits into
base: next
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
1164 commits
Select commit Hold shift + click to select a range
0f6b7ae
chore(api): generate types + docs
jwerle Jul 8, 2024
bcf7be5
refactor(): remove dead android code
jwerle Jul 8, 2024
96d8d91
fix(api/internal/init.js): handle 'Blob' without types for 'Worker' c…
jwerle Jul 9, 2024
b678d40
fix(api/shared-worker): handle 'Blob' without types for 'SharedWorker…
jwerle Jul 9, 2024
5908c62
fix(api/service-worker/container.js): handle 'blob:' URL origins
jwerle Jul 9, 2024
bc52ef6
chore(api): generate types
jwerle Jul 9, 2024
293a2a2
feature(core): high thoughput streams
heapwolf Jun 25, 2024
8d2a287
refactor(core): condiuit should use existing routes
heapwolf Jun 26, 2024
b4cbaa5
refactor(window): update preload call
heapwolf Jun 28, 2024
d6d43a0
refactor(api): add conduit api
heapwolf Jun 28, 2024
678b025
refactor(core): conduit protocol
heapwolf Jun 28, 2024
a9ffcfb
refactor(core): improve uri as the frame passes though the conduit
heapwolf Jun 28, 2024
11e5810
refactor(api): update conduit javascript to reflect new api
heapwolf Jun 28, 2024
4febd40
factor(core): continues integration of conduit into core
heapwolf Jun 29, 2024
412f41f
factor(core): integrate core changes to conduit
heapwolf Jun 29, 2024
4d3c393
factor(core): fix syntax issues, types
heapwolf Jun 29, 2024
02749c6
factor(core): integrate conduit into core
heapwolf Jun 29, 2024
e3b44a5
refactor(core): integrate conduit with dgram
heapwolf Jul 1, 2024
229d2d3
factor(api): add condition for non-legacy sockets
heapwolf Jul 1, 2024
d252eaf
refactor(api): ensure dgram uses runInAsyncScope as well as publishes…
heapwolf Jul 1, 2024
084c4e4
refactor(core): correct conduit decode, allow ios
heapwolf Jul 9, 2024
51771be
fix(api): fixes regression in cache
heapwolf Jul 9, 2024
1ccbe83
chore(api): update protocol
heapwolf Jul 9, 2024
2422e5c
chore(api): update protocol
heapwolf Jul 9, 2024
e862bc2
chore(api): update protocol
heapwolf Jul 9, 2024
b359c93
chore(api): update protocol
heapwolf Jul 10, 2024
4130fbd
chore(api): update protocol, allow specifying worker
heapwolf Jul 10, 2024
e376b98
fix(window): fix struct init members
jwerle Jul 10, 2024
54b179c
fix(ipc): detect more bad 'ipc:' URIs
jwerle Jul 10, 2024
83cd891
refactor(core): introduce lifecycle methods, fix 'CoreConduit::open'
jwerle Jul 10, 2024
c51e7b9
refactor(app): use 'resume/pause' Core lifecycle methods
jwerle Jul 10, 2024
da1eb3a
refactor(cli): provide 'socket_*' C extern impls
jwerle Jul 10, 2024
ea7c12c
refactor(api/internal/conduit.js): introduce reconnect logic and life…
jwerle Jul 10, 2024
ec74cc8
refactor(api/latica): clean up lint
jwerle Jul 10, 2024
488021d
refactor(api/dgram.js): clean up conduit usage
jwerle Jul 10, 2024
6f91240
chore(api): generate types + docs
jwerle Jul 10, 2024
d8d188e
fix(app): fix typo
jwerle Jul 10, 2024
8d92571
fix(app): set 'applicationInstance' to 'nullptr'
jwerle Jul 10, 2024
4a5ec13
refactor(desktop): do not destroy window manager in shutdown
jwerle Jul 10, 2024
3893d8f
refactor(window): check if 'app' is a 'nullptr'
jwerle Jul 10, 2024
ce95747
fix(api/fetch): attempt to pass untyped buffer
chrisfarms Jul 3, 2024
4450206
fix(api/internal): url.protocol can be undefined
chrisfarms Jul 3, 2024
045c633
refactor(core): conduit cleanup, more diagnostics
jwerle Jul 11, 2024
5198e47
refactor(api/internal/conduit.js): improve reconnect logic
jwerle Jul 11, 2024
4aa415d
refactor(src/app/app.cc): do not pause core on macos desktop
jwerle Jul 12, 2024
7ededcc
refactor(core/modules/conduit): call callback in 'start() when actual…
jwerle Jul 12, 2024
76def96
refactor(ipc/routes): introduce 'internal.conduit.*' routes
jwerle Jul 12, 2024
0aed4eb
fix(window/linux): fix permissions logic
jwerle Jul 12, 2024
84b6c4e
fix(api): process, timers, conduit
jwerle Jul 12, 2024
f630c8d
chore(): set version to '0.6.0-next'
jwerle Jul 12, 2024
5ea2c6b
chore(api): generate types + docs
jwerle Jul 12, 2024
df2ae30
refactor(core): improve logs
heapwolf Jul 12, 2024
9398964
refactor(core): improve logging on macos
heapwolf Jul 13, 2024
9839eeb
refactor(window): consolidate 'applicationurl' handler
jwerle Jul 12, 2024
49b1dd0
refactor(ipc): track 'readyState' for 'Window' from 'document'
jwerle Jul 12, 2024
3b394ac
refactor(app): handle 'applicationurl' on android correctly
jwerle Jul 12, 2024
f4f08f6
refactor(app): remove pending application URL state
jwerle Jul 15, 2024
f89699c
refactor(core/modules/platform.cc): do not use loop dispatch
jwerle Jul 15, 2024
70e426b
refactor(desktop/main): simplify app url handler on linux
jwerle Jul 15, 2024
b6b91ed
refactor(ipc): handle 'readystatechange' on 'Window'
jwerle Jul 15, 2024
42e5411
refactor(window): introduce 'onReadyStateChange' callback
jwerle Jul 15, 2024
1e6a5bd
fix(cli): guard apple
jwerle Jul 15, 2024
0d5e899
reafactor(cli): include bundle id in log predicate
heapwolf Jul 15, 2024
2f27db9
docs(api): use more appropriate naming
jwerle Jul 15, 2024
6754986
fix(bin/generate-docs.js): handle offline
jwerle Jul 15, 2024
1cdd6ab
fix(api/location.js): normalize origin protocol for 'socket:location'
jwerle Jul 15, 2024
636fb2d
refactor(api/process): move 'signal.js' to 'process/signal.js'
jwerle Jul 15, 2024
acaaac5
fix(api): fix 'process/signal.js' imports
jwerle Jul 16, 2024
7093b2c
refactor(app): conslidate pause/resume logic into 'App'
jwerle Jul 16, 2024
bae7c55
refactor(desktop/main): verify pid when launching second instance
jwerle Jul 16, 2024
cef088f
refactor(ipc,platform): clean up + more types
jwerle Jul 16, 2024
fe3817d
chore(api): update protocol
heapwolf Jul 16, 2024
0b9cb74
chore(api): update protocol to improve logging
heapwolf Jul 17, 2024
8c35d17
chore(api): update protocol to allow specifying ranges in sync
heapwolf Jul 18, 2024
4a46b8f
chore(api): lint
heapwolf Jul 18, 2024
170cbae
fix(ipc/preload.cc): ensure correct values in webview from preload
jwerle Jul 18, 2024
306cfc4
refactor(core/modules/conduit): introduce 'isActive()', msleep after …
jwerle Jul 18, 2024
9496128
refactor(core/modules/diagnostics): improve 'conduit' diagnostics
jwerle Jul 18, 2024
19376a2
refactor(ipc/routes): include 'active' status in 'internal.conduit.st…
jwerle Jul 18, 2024
47b3de1
chore(api): generate docs
heapwolf Jul 18, 2024
288d6ae
fix(core/modules/platform): fix 'CorePlatform::openExternal'
jwerle Jul 18, 2024
51d39d2
refactor(platform/android): clean up, more android platform types
jwerle Jul 18, 2024
49ce80f
refactor(core/modules/platform): call 'openExternal' for android
jwerle Jul 18, 2024
6b37ad6
refactor(app): introduce 'openExternal' on app activity
jwerle Jul 18, 2024
f693911
chore(api): update protocol
heapwolf Jul 18, 2024
1214fac
feature(api): expose max cache time in protocol
heapwolf Jul 19, 2024
658b358
refactor(window): introduce 'WindowManager::emit'
jwerle Jul 22, 2024
f3295b0
refactor(app): emit events for 'pause' and 'resume' on windows
jwerle Jul 22, 2024
ae2b489
refactor(core/modules/conduit): msleep in start if already active
jwerle Jul 22, 2024
8564451
fix(ipc/routes): fix 'internal.conduit.*' return values
jwerle Jul 22, 2024
d5b31ae
refactor(api/application.js): handle pause/resume state, dispatch app…
jwerle Jul 22, 2024
544fc60
fix(api/dgram.js): check if conduit exists before creating
jwerle Jul 22, 2024
725b78a
feat(api/hooks.js): introduce 'onApplicationResume' and 'onApplicatio…
jwerle Jul 22, 2024
024901b
refactor(api/internal/conduit.js): improve reconnect logic, handle pa…
jwerle Jul 22, 2024
f0693fe
refactor(api/internal/init.js): propagate application events to workers
jwerle Jul 22, 2024
f865381
refactor(api/internal/worker.js): improve event proxies
jwerle Jul 22, 2024
fbc8c08
chore(api): generate types + docs
jwerle Jul 22, 2024
40cb7ab
refactor(window): more window manager APIs on android
jwerle Jul 23, 2024
73a29fd
feat(core/modules/permissions): consolidate permissions APIs
jwerle Jul 23, 2024
720537c
refactor(ipc): clean up permissions/notifications routing
jwerle Jul 23, 2024
768d01c
refactor(core): various core module improvements and android impls
jwerle Jul 23, 2024
b8284e0
refactor(cli): clean up
jwerle Jul 23, 2024
99b42e7
refactor(app): introduce android notifications API again, improve lif…
jwerle Jul 23, 2024
2c97540
refactor(api/commonjs/loader.js): disable 'withCredentials' for android
jwerle Jul 23, 2024
2860450
refactor(api/ipc.js): clean up
jwerle Jul 23, 2024
35d5168
refactor(api/internal/init.js): init shared worker context window
jwerle Jul 23, 2024
dd88763
refactor(api/internal/conduit.js): more internal conduit state imporo…
jwerle Jul 23, 2024
d2e8235
refactor(api/internal/init.js): clean up lint
jwerle Jul 23, 2024
0bacf08
chore(api): generate types + docs
jwerle Jul 23, 2024
4f1c0f5
fix(window/linux): fix 'Notifcations' API
jwerle Jul 23, 2024
4c90cf2
refactor(permissions): fix typos and introduce more permissions to qu…
jwerle Jul 23, 2024
c3c726b
chore(core/webview): clenan up
jwerle Jul 24, 2024
f5b9e1a
refactor(api/internal/permissions.js): handle 'microphone' and 'camer…
jwerle Jul 24, 2024
25abe2e
chore(api): generate types
jwerle Jul 24, 2024
3c49816
refactor(cli/templates): use 'DayNight' theme on android
jwerle Jul 24, 2024
0bf46da
chore(api): update protocol
heapwolf Jul 24, 2024
793b721
fix(cli): fix race on shutdown from cli
jwerle Jul 25, 2024
55fedc7
fix(core/module): fix remove/dispatch crash
jwerle Jul 25, 2024
0ac8810
fix(window/linux): various fixes
jwerle Jul 25, 2024
2fe05fa
chore(app): clean up
jwerle Jul 25, 2024
50c495d
refactor(cli): clean up 'AndroidManifest.xml' template
jwerle Jul 25, 2024
52ac4ac
fix(window): fix dialog impl on android
jwerle Jul 25, 2024
be8d49b
refactor(api/dgram.js): consider detached array buffers
jwerle Jul 25, 2024
7ce2400
chore(api/dgram.js): fix typo
jwerle Jul 25, 2024
2fd9629
feat(core/modules/media_devices): introduce 'CoreMediaDevices' module
jwerle Jul 26, 2024
b5c409f
refactor(core/modules/permissions): handle 'camera' and 'microphone' …
jwerle Jul 26, 2024
76523a3
refactor(app): handle 'camera' and 'microphone' permissions on androi…
jwerle Jul 26, 2024
1ee214e
refactor(api/internal/permissions.js): handle 'camera' and 'microphon…
jwerle Jul 26, 2024
e19628f
feat(platform/android): introduce 'ContentResolver' platform API
jwerle Jul 30, 2024
73d57d9
refactor(core/modules/{fs,platform}): handle android assets/content i…
jwerle Jul 30, 2024
42bc77c
refactor(window): clean up, handle async javascript, imrpove android …
jwerle Jul 30, 2024
a32c567
refactor(core/{resource,url}): improve URL, handle android assets/con…
jwerle Jul 30, 2024
f81e1a5
refactor(app): configure well known paths correctly on android
jwerle Jul 30, 2024
a390985
chore(ipc): clean up
jwerle Jul 30, 2024
fed82a5
refctor(bin/publish-npm-modules.sh): symlink kotlin files when requested
jwerle Jul 30, 2024
40e6cf9
fix(api/dgram.js): check if buffer is detached before calling callback
jwerle Jul 30, 2024
e3e971e
feat(api/fs/web.js): support 'File.prototype.slice'
jwerle Jul 30, 2024
c46eac2
fix(api/internal/error.js): fix error stack building on android
jwerle Jul 30, 2024
59259ef
fix(api/ipc.js): do not set 'responseType' for sync XHR in document mode
jwerle Jul 30, 2024
1032e0e
feat(api/path.js): introduce 'path.MEDIA'
jwerle Jul 30, 2024
fa01fed
refacvtor(api/url.js): support 'content:' and 'android.reource:' sche…
jwerle Jul 30, 2024
2d2e458
chore(api): generate types + docs
jwerle Jul 30, 2024
050d66f
fix(api/ipc.js): typeof check 'globalThis.primordials'
jwerle Jul 30, 2024
54ef3bf
fix(window/apple): fix bad var use
jwerle Jul 30, 2024
e234d7f
chore(api): generate types
jwerle Jul 30, 2024
317bcf9
refactor(ipc/preload): handle already defined preload
jwerle Jul 30, 2024
cd939df
fix(window/apple): ensure runtime preload is injected
jwerle Jul 30, 2024
e53cef5
refactor(ipc/bridge): ensure preload is injected on android ipc bridge
jwerle Jul 30, 2024
a2c4b16
refactor(window): ensure preload is injected on android/linux/windows
jwerle Jul 30, 2024
55ef5b6
fix(core/resource): fix 'music/media' well known paths
jwerle Jul 30, 2024
7baec2a
fix(ipc/preload): fix typo
jwerle Jul 30, 2024
267abf9
fix(window): fix 'IPC::Preload' misuse
jwerle Jul 30, 2024
0b34f0c
refator(window/android): introduce 'getPreloadUserScript()'
jwerle Jul 31, 2024
84c309e
refactor(platform/android/content_resolver): clean up
jwerle Jul 31, 2024
ca2dbaf
refactor(ipc): introduce 'mime.lookup' route
jwerle Jul 31, 2024
222c796
fix(core/resource): handle 'url' in copy/move, fix mimeType for conte…
jwerle Jul 31, 2024
ee75431
refactor(app): clean up
jwerle Jul 31, 2024
c8d7036
fix(api/util.js): handle non-string error 'stack'
jwerle Jul 31, 2024
db30ec7
refactor(api/mime): query IPC for more results
jwerle Jul 31, 2024
bdb9c36
fix(api/internal/error.js): fix 'stack' value
jwerle Jul 31, 2024
187a7d1
refactor(api/fs): handle 'URL' file names
jwerle Jul 31, 2024
a3d355e
fix(api/dgram.js): check for detached array buffer in callback
jwerle Jul 31, 2024
e93807a
chore(api): generate types + docs
jwerle Jul 31, 2024
7a875ac
fix(core/modules/conduit): do not use private UV APIs, fix mem leak
jwerle Aug 1, 2024
235154e
fix(ipc/bridge): explicit opt-out of auth component on 'npm:' URIs to…
jwerle Aug 1, 2024
1871449
fix(window/win): fix typos
jwerle Aug 1, 2024
63d9b23
chore(clib.json): remove 'src' array
jwerle Aug 2, 2024
54449f6
refactor(api/commonjs): handle package export fields as arrays
jwerle Aug 4, 2024
7fb5520
fix(api/npm/service-worker.js): improve 'export default' detection
jwerle Aug 4, 2024
32dc291
chore(api): generate types
jwerle Aug 4, 2024
4cfcb69
fix(cli): remove sleep in signal handler
jwerle Aug 4, 2024
b581372
fix(core): fix 'fs.*' resources paths
jwerle Aug 4, 2024
ddc92e3
refactor(desktop/extension/linux): clean up
jwerle Aug 4, 2024
ad032ee
fix(api/commonjs/package.js): handle implicit entry exports object
jwerle Aug 4, 2024
22d75c6
refactor(api/fs): handle 'FileSystemFileHandle' and 'FileSystemDirect…
jwerle Aug 4, 2024
777346d
refactor(api/internal/pickers.js): ensure directory handle is opened
jwerle Aug 4, 2024
9d33479
chore(api): generate types + docs
jwerle Aug 4, 2024
46547fa
fix(api/dgram.js): fix send callback '...args' spread
jwerle Aug 6, 2024
3145619
fix(core/modules/fs): fix path string usage
jwerle Aug 7, 2024
4bb9f0a
fix(api/npm/service-worker.js): fix 'export default' syntax detection
jwerle Aug 7, 2024
e7cdb64
refactor(bin/clean.sh): clean env by default
jwerle Aug 8, 2024
55cfe7f
fix(bin/install.sh): advise 'cmake' when needed
jwerle Aug 8, 2024
f938623
chore(api): update protocol
heapwolf Aug 8, 2024
03dfbbf
fix(core/modules/notifications): fix start/resume state and block la…
jwerle Aug 8, 2024
3ecdbef
fix(core): start/stop notification timers
jwerle Aug 8, 2024
c05a259
fix(cli): fix watcher crash
jwerle Aug 8, 2024
931932a
fix(core/modules/notifications): check if default icon exists
jwerle Aug 9, 2024
1fdc9ae
refactor(ipc/bridge): set cache control for resource assets
jwerle Aug 9, 2024
7370513
refactor(api/notification.js): improve global Symbol usage
jwerle Aug 9, 2024
3716cc9
chore(api): generate types
jwerle Aug 9, 2024
91b4784
fix(core/webview,window/apple): fix fullscreen API on apple
jwerle Aug 9, 2024
ae0bf75
fix(core/webview): fix resetting layout after fullscreen exit
jwerle Aug 12, 2024
5c94a38
refactor(cli): clean up
jwerle Aug 12, 2024
853a0dd
refactor(app): emit pause/resume events right away, dispatch core pau…
jwerle Aug 12, 2024
17e1134
fix(window/apple): fix window style constraints and bad 'eval()'
jwerle Aug 12, 2024
f2a34a2
fix(app): fix pause dispatch
jwerle Aug 12, 2024
d0da967
refactor(window/apple): clean up
jwerle Aug 17, 2024
c4cfb18
refaactor(ipc/scheme_handlers): remove unused mutex
jwerle Aug 17, 2024
c7a21ce
refactor(desktop/main): clean up
jwerle Aug 17, 2024
f22613d
refactor(core/socket): improve close logic
jwerle Aug 17, 2024
f82e753
refactor(core): consolidate mutexes
jwerle Aug 17, 2024
733c624
refactor(core): wait for async dispatch to dequeue, close loop in 'st…
jwerle Aug 17, 2024
4cfdff5
refactor(core/modules/diagnostics): include handles in 'uv' diagnostic
jwerle Aug 17, 2024
0f09705
fix(cli): fix asset compilation target for ios
jwerle Aug 17, 2024
354a83d
chore(app): clean up
jwerle Aug 17, 2024
48389bb
refactor(core/modules/conduit): close server and clients correctly
jwerle Aug 17, 2024
4eb02cf
refactor(api/dgram.js): improve conduit usage lifecycles
jwerle Aug 17, 2024
b702a5f
refactor(api/diagnostics/runtime.js): allow selector syntax in 'query()'
jwerle Aug 17, 2024
54ea7e3
refactor(api/internal/conduit.js): improve conduit lifecycles and rec…
jwerle Aug 17, 2024
38e58d1
refactor(core): improve loop lifecycles
jwerle Aug 17, 2024
034860f
refactor(cli): improve signal handler
jwerle Aug 17, 2024
4be1427
refactor(app/app.kt): handle default image icon
jwerle Aug 17, 2024
51d1908
refactor(ipc): use better core predicate names
jwerle Aug 17, 2024
50b547c
fix(core/modules/conduit): set default frame buffer values
jwerle Aug 17, 2024
5e062a3
chore(package.json): introduce 'clean' script
jwerle Aug 17, 2024
60cc12b
chore(): clean up
jwerle Aug 17, 2024
7247af2
refactor(app): use 'https:' window navigation on android
jwerle Aug 18, 2024
ff3741e
refactor(ipc/scheme_handlers): handle 'runtime-xhr-seq' header
jwerle Aug 18, 2024
644c829
refactor(api/vm.js): use pathname instead of URL for window
jwerle Aug 19, 2024
fb62083
chore(api/url/index.js): clean up jsdoc
jwerle Aug 19, 2024
f13e10e
refactor(api/shared-worker/index.js): use pathname instead of URL for…
jwerle Aug 19, 2024
80a9ec5
refactor(api/service-worker/worker.js): cache protocol data
jwerle Aug 19, 2024
0de5f84
fix(api/location.js): handle 'null' origins
jwerle Aug 19, 2024
6ff6df1
fix(api/commonjs/loader.js): fix ref cycle
jwerle Aug 19, 2024
d9dcd6b
fix(api/ipc.js): allow POST/PUT/PATCH for android protocol handlers
jwerle Aug 19, 2024
4aaf1db
chore(api/internal/conduit.js): clean up lint
jwerle Aug 19, 2024
157db56
chore(api): generate types + docs
jwerle Aug 19, 2024
3a299cd
fix(api/ipc.js): improve ipc port/channel impl
jwerle Aug 20, 2024
bdbf6e6
fix(api/vm): fix context argument and shared worker impl
jwerle Aug 20, 2024
f03c470
fix(api/shared-worker/worker.js): tracker active connections, replace…
jwerle Aug 20, 2024
d442799
chore(api): generate types + docs
jwerle Aug 20, 2024
e43d1b4
chore(api/ipc.js): clean up lint
jwerle Aug 20, 2024
ce1c87c
fix(core): do not wait for dispatch queue drain on linux
jwerle Aug 20, 2024
ea51055
refactor(desktop/main): improve signal handling dispatch
jwerle Aug 20, 2024
493fafc
fix(window/linux): check if application exists before destruction
jwerle Aug 20, 2024
c9c6d91
fix(api/fs/web.js): make 'getFile' async
jwerle Aug 20, 2024
7526c7f
fix(api/internal/primitives.js): fix 'FormData' append/set for 'Objec…
jwerle Aug 20, 2024
c75bfaa
fix(window/manager.cc): allow 'http' requests on linux again
jwerle Aug 20, 2024
1ce44c9
fix(api/ipc.js): fix early primordials check
jwerle Aug 20, 2024
5869745
fix(api/fs/web.js): fix 'slice()' for 'File' factory impl
jwerle Aug 20, 2024
062f993
fix(api/fs): fix incorrect 'readFileSync' default encoding
jwerle Aug 20, 2024
bb48605
chore(api): generate types + docs
jwerle Aug 20, 2024
4642235
chore(api/internal/primitives.js): lint
jwerle Aug 20, 2024
829fa04
chore(api): update protocol
heapwolf Aug 21, 2024
17409a4
fix(cli): set verbose output default to false
jwerle Aug 21, 2024
71fa3b2
fix(cli): fix '--verbose' flag
jwerle Aug 21, 2024
88114f3
refactor(window/linux): make back/forward gesture navigation configur…
jwerle Aug 22, 2024
4caf2a4
refactor(window/apple): make back/forward gesture navigation configur…
jwerle Aug 22, 2024
1af17c7
refactor(window/win): make back/forward gesture navigation configurable
jwerle Aug 22, 2024
57c8842
feat(api/latica): expose proxy on RemotePeer
chrisfarms Aug 25, 2024
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
Prev Previous commit
Next Next commit
chore(api): update protocol
heapwolf committed Jul 18, 2024
commit f6939116c3847e9b93c40c48bd242e698e2b145b
3 changes: 3 additions & 0 deletions api/latica/api.js
Original file line number Diff line number Diff line change
@@ -357,6 +357,9 @@ async function api (options = {}, events, dgram) {

sub.peers.set(peer.peerId, ee)
const isStateChange = !oldPeer || change

_peer.onDebug(_peer.peerId, `<-- API CONNECTION JOIN (scid=${scid}, peerId=${peer.peerId.slice(0, 6)})`)

sub._emit('#join', ee, packet, isStateChange)
})

38 changes: 23 additions & 15 deletions api/latica/index.js
Original file line number Diff line number Diff line change
@@ -935,7 +935,8 @@ export class Peer {
requesterPeerId: this.peerId,
natType: this.natType,
address: this.address,
port: this.port
port: this.port,
key: [cid, scid].join(':')
}
})

@@ -1091,23 +1092,23 @@ export class Peer {
/**
* @return {undefined}
*/
async sync (peer) {
async sync (peer, ptime = Date.now()) {
if (typeof peer === 'string') {
peer = this.peers.find(p => p.peerId === peer)
}

const rinfo = peer?.proxy || peer

this.lastSync = Date.now()
const summary = await this.cache.summarize('', this.cachePredicate)
const summary = await this.cache.summarize('', this.cachePredicate(ptime))

this._onDebug(`-> SYNC START (dest=${peer.peerId.slice(0, 8)}, to=${rinfo.address}:${rinfo.port})`)
if (this.onSyncStart) this.onSyncStart(peer, rinfo.port, rinfo.address)

// if we are out of sync send our cache summary
const data = await Packet.encode(new PacketSync({
message: Cache.encodeSummary(summary),
usr4: Buffer.from(String(Date.now()))
usr4: Buffer.from(String(ptime))
}))

this.send(data, rinfo.port, rinfo.address, peer.socket)
@@ -1157,13 +1158,13 @@ export class Peer {
* from the cache when receiving a request to sync. that can be overridden
*
*/
cachePredicate (packet) {
if (packet.usr4.byteLength < 8 || packet.usr4.byteLength > 16) return
cachePredicate (ts) {
const max = Date.now() - Packet.ttl
const T = Math.min(ts || max, max)

const timestamp = parseInt(Buffer.from(packet.usr4).toString(), 10)
const ts = Math.min(Packet.ttl, timestamp)

return packet.version === VERSION && ts > Date.now() - Packet.ttl
return packet => {
return packet.version === VERSION && packet.timestamp > T
}
}

/**
@@ -1246,13 +1247,20 @@ export class Peer {
this.lastSync = Date.now()
const pid = packet.packetId.toString('hex')

let ptime = Date.now()

if (packet.usr4.byteLength > 8 || packet.usr4.byteLength < 16) {
const usr4 = parseInt(Buffer.from(packet.usr4).toString(), 10)
ptime = Math.min(ptime - Packet.ttl, usr4)
}

if (!isBufferLike(packet.message)) return
if (this.gate.has(pid)) return

this.gate.set(pid, 1)

const remote = Cache.decodeSummary(packet.message)
const local = await this.cache.summarize(remote.prefix, this.cachePredicate)
const local = await this.cache.summarize(remote.prefix, this.cachePredicate(ptime))

if (!remote || !remote.hash || !local || !local.hash || local.hash === remote.hash) {
if (this.onSyncFinished) this.onSyncFinished(packet, port, address)
@@ -1278,7 +1286,7 @@ export class Peer {
if (!key.startsWith(local.prefix + i.toString(16))) continue

const packet = Packet.from(p)
if (!this.cachePredicate(packet)) continue
if (!this.cachePredicate(ptime)(packet)) continue

const pid = packet.packetId.toString('hex')
this._onDebug(`-> SYNC SEND PACKET (type=data, packetId=${pid.slice(0, 8)}, to=${address}:${port})`)
@@ -1289,7 +1297,7 @@ export class Peer {
//
// need more details about what exactly isn't synce'd
//
const nextLevel = await this.cache.summarize(local.prefix + i.toString(16), this.cachePredicate)
const nextLevel = await this.cache.summarize(local.prefix + i.toString(16), this.cachePredicate(ptime))
const data = await Packet.encode(new PacketSync({
message: Cache.encodeSummary(nextLevel),
usr4: Buffer.from(String(Date.now()))
@@ -1450,7 +1458,7 @@ export class Peer {
delete message.isProbe
}

const { hash } = await this.cache.summarize('', this.cachePredicate)
const { hash } = await this.cache.summarize('', this.cachePredicate())
message.cacheSummaryHash = hash

const packetPong = new PacketPong({ message })
@@ -1645,7 +1653,7 @@ export class Peer {
if (this.onIntro) this.onIntro(packet, peer, peerPort, peerAddress)

const pingId = randomBytes(6).toString('hex').padStart(12, '0')
const { hash } = await this.cache.summarize('', this.cachePredicate)
const { hash } = await this.cache.summarize('', this.cachePredicate())

const props = {
clusterId,
1 change: 1 addition & 0 deletions api/latica/packets.js
Original file line number Diff line number Diff line change
@@ -494,6 +494,7 @@ export class PacketJoin extends Packet {
requesterPeerId: { required: true, type: 'string', assert: Peer.isValidPeerId },
natType: { required: true, type: 'number', assert: NAT.isValid },
address: { required: true, type: 'string' },
key: { type: 'string' },
port: { required: true, type: 'number', assert: isValidPort },
isConnection: { type: 'boolean' }
})
10 changes: 6 additions & 4 deletions api/latica/proxy.js
Original file line number Diff line number Diff line change
@@ -263,12 +263,14 @@ class PeerWorkerProxy {

if (arg?.constructor.name === 'RemotePeer' || arg?.constructor.name === 'Peer') {
args[i] = { // what details we want to expose outside of the protocol
peerId: arg.peerId,
address: arg.address,
port: arg.port,
natType: arg.natType,
clusters: arg.clusters,
connected: arg.connected
connected: arg.connected,
lastRequest: arg.lastRequest,
lastUpdate: arg.lastUpdate,
natType: arg.natType,
peerId: arg.peerId,
port: arg.port
}

delete args[i].localPeer // don't copy this over