Fix robosats on blixt's react-native-webview (#594)

This commit is contained in:
Reckless_Satoshi 2023-05-18 13:29:49 +00:00 committed by GitHub
parent 8a04474934
commit 0797a7d1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View File

@ -13,4 +13,8 @@ export interface SystemClient {
}
export const systemClient: SystemClient =
window.ReactNativeWebView != null ? new SystemNativeClient() : new SystemWebClient();
// If userAgent has "RoboSats", we assume the app is running inside of the
// react-native-web view of the RoboSats Android app.
window.navigator.userAgent.includes('robosats')
? new SystemNativeClient()
: new SystemWebClient();

View File

@ -5,6 +5,7 @@ import TorClient from './services/Tor';
import Clipboard from '@react-native-clipboard/clipboard';
import NetInfo from '@react-native-community/netinfo';
import EncryptedStorage from 'react-native-encrypted-storage';
import { name as app_name, version as app_version } from './package.json';
const backgroundColors = {
light: 'white',
@ -157,6 +158,7 @@ const App = () => {
}}
onMessage={onMessage}
// @ts-expect-error
userAgent={`${app_name} v${app_version} Android`}
style={{ backgroundColor: backgroundColors[colorScheme] }}
ref={(ref) => (webViewRef.current = ref)}
overScrollMode='never'

View File

@ -14,6 +14,7 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
large_client_header_buffers 4 64K;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '

View File

@ -6,8 +6,11 @@
# 2) nginx: does the magic of redirecting every request to either local (the app, static,
# languages) or remote (for each coordinator, either API or WS, and static avatar)
# Every robosat coordinators needs a tor bridge. So far only experimental coordinator available.
# Every robosat coordinators needs a tor socat bridge. So far only experimental coordinator available.
experimental_onion=robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion
experimental_socat="socat tcp4-LISTEN:81,reuseaddr,fork,keepalive,bind=127.0.0.1 SOCKS4A:${TOR_PROXY_IP:-127.0.0.1}:${experimental_onion}:80,socksport=${TOR_PROXY_PORT:-9050}"
experimental_port=81
# ... add more
experimental_socat="socat tcp4-LISTEN:${experimental_port},reuseaddr,fork,keepalive,bind=127.0.0.1 SOCKS4A:${TOR_PROXY_IP:-127.0.0.1}:${experimental_onion}:80,socksport=${TOR_PROXY_PORT:-9050}"
$experimental_socat & nginx