mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 15:42:05 +00:00
feat: nat pmp for android
This commit is contained in:
parent
a41d076929
commit
8a876a1053
6 changed files with 29 additions and 1 deletions
|
|
@ -43,6 +43,7 @@
|
|||
"@capacitor/ios": "^5.5.1",
|
||||
"@capacitor/status-bar": "^5.0.6",
|
||||
"@superfrogbe/cordova-plugin-chrome-apps-sockets-udp": "github:superfrogbe/cordova-plugin-chrome-apps-sockets-udp",
|
||||
"capacitor-default-gateway": "github:funniray/capacitor-default-gateway",
|
||||
"capacitor-dns": "github:funniray/capacitor-dns",
|
||||
"capacitor-os-interfaces-hack": "github:funniray/capacitor-os-interfaces-hack",
|
||||
"capacitor-plugin-safe-area": "^2.0.5",
|
||||
|
|
|
|||
9
capacitor/src/gateway.js
Normal file
9
capacitor/src/gateway.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { gateway4async } from 'capacitor-default-gateway'
|
||||
|
||||
let v4Gateway
|
||||
|
||||
export const v4 = () => {}
|
||||
v4.sync = () => v4Gateway
|
||||
export const ready = gateway4async().then(gateway => {
|
||||
v4Gateway = gateway
|
||||
})
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'events'
|
||||
import { ready } from './gateway.js'
|
||||
|
||||
export const ipcRendererUI = new EventEmitter()
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ async function portRequest (data) {
|
|||
}
|
||||
await globalThis.controller
|
||||
await globalThis.prefetchNetworkInterfaces
|
||||
await ready
|
||||
await new Promise(resolve => setTimeout(() => resolve(), 50))
|
||||
ipcRendererUI.emit('port', { ports: [port2] })
|
||||
ipcRendererWebTorrent.emit('port', { ports: [port1] })
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import TorrentClient from 'common/modules/webtorrent.js'
|
||||
import { ipcRendererWebTorrent } from './ipc.js'
|
||||
import { prefetchNetworkInterfaces } from 'os'
|
||||
import { ready } from './gateway.js'
|
||||
|
||||
globalThis.chrome.runtime = { lastError: false, id: 'something' }
|
||||
|
||||
|
|
@ -28,5 +29,6 @@ async function storageQuota () {
|
|||
}
|
||||
|
||||
await prefetchNetworkInterfaces
|
||||
await ready
|
||||
|
||||
globalThis.client = new TorrentClient(ipcRendererWebTorrent, storageQuota, 'browser', controller, { torrentPort: Math.floor(Math.random() * 65535 + 1) })
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const capacitorConfig = {
|
|||
const alias = {
|
||||
fs: false,
|
||||
ws: false,
|
||||
'default-gateway': false,
|
||||
'default-gateway': join(__dirname, 'src', 'gateway.js'),
|
||||
'load-ip-set': false,
|
||||
'node-fetch': false,
|
||||
'webtorrent/lib/utp.cjs': false,
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ importers:
|
|||
'@superfrogbe/cordova-plugin-chrome-apps-sockets-udp':
|
||||
specifier: github:superfrogbe/cordova-plugin-chrome-apps-sockets-udp
|
||||
version: github.com/superfrogbe/cordova-plugin-chrome-apps-sockets-udp/4b740017299c81cfc7d5b49c7d6122a6650b57d4
|
||||
capacitor-default-gateway:
|
||||
specifier: github:funniray/capacitor-default-gateway
|
||||
version: github.com/funniray/capacitor-default-gateway/786bd15a6d445c82f009a4a9b4b331afa3b45725(@capacitor/core@5.5.1)
|
||||
capacitor-dns:
|
||||
specifier: github:funniray/capacitor-dns
|
||||
version: github.com/funniray/capacitor-dns/6362cd1ad0a6b9b5bdbdc9fee3fba4c8dae91e16(@capacitor/core@5.5.1)
|
||||
|
|
@ -8302,6 +8305,17 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
github.com/funniray/capacitor-default-gateway/786bd15a6d445c82f009a4a9b4b331afa3b45725(@capacitor/core@5.5.1):
|
||||
resolution: {tarball: https://codeload.github.com/funniray/capacitor-default-gateway/tar.gz/786bd15a6d445c82f009a4a9b4b331afa3b45725}
|
||||
id: github.com/funniray/capacitor-default-gateway/786bd15a6d445c82f009a4a9b4b331afa3b45725
|
||||
name: capacitor-default-gateway
|
||||
version: 0.0.1
|
||||
peerDependencies:
|
||||
'@capacitor/core': ^5.0.0
|
||||
dependencies:
|
||||
'@capacitor/core': 5.5.1
|
||||
dev: false
|
||||
|
||||
github.com/funniray/capacitor-dns/6362cd1ad0a6b9b5bdbdc9fee3fba4c8dae91e16(@capacitor/core@5.5.1):
|
||||
resolution: {tarball: https://codeload.github.com/funniray/capacitor-dns/tar.gz/6362cd1ad0a6b9b5bdbdc9fee3fba4c8dae91e16}
|
||||
id: github.com/funniray/capacitor-dns/6362cd1ad0a6b9b5bdbdc9fee3fba4c8dae91e16
|
||||
|
|
|
|||
Loading…
Reference in a new issue