+
+
+
+
+
+
+
+ -
+
Looking for robot parts ...
+
+ -
+
Adding layers to the onion ...
+
+ -
+
Winning at game theory ...
+
+ -
+
Moving Sats at light speed ...
+
+ -
+
Hiding in 2^256 bits of entropy...
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/webpack.config.ts b/frontend/webpack.config.ts
index 0768c17aa..42ef12c97 100644
--- a/frontend/webpack.config.ts
+++ b/frontend/webpack.config.ts
@@ -1,6 +1,8 @@
import path from "path";
import { Configuration } from "webpack";
+const CopyPlugin = require("copy-webpack-plugin");
+
const config: Configuration = {
entry: "./src/index.js",
module: {
@@ -24,10 +26,35 @@ const config: Configuration = {
resolve: {
extensions: [".tsx", ".ts", ".jsx", ".js"],
},
+};
+
+var configWeb = Object.assign({}, config, {
+ name: "configWeb",
output: {
- path: path.resolve(__dirname, "static/frontend"),
- filename: "main.js",
+ path: path.resolve(__dirname, "static/frontend"),
+ filename: "main.js",
},
-};
+});
+var configMobile = Object.assign({}, config, {
+ name: "configMobile",
+ output: {
+ path: path.resolve(__dirname, "../mobile/html/Web.bundle"),
+ filename: "js/main.js",
+ },
+ plugins: [
+ new CopyPlugin({
+ patterns: [
+ {
+ from: "static/locales/*.json",
+ to: "static/locales/[name][ext]"
+ },
+ {
+ from: "static/css",
+ to: "static/css"
+ },
+ ],
+ }),
+ ],
+});
-export default config;
+export default [configWeb, configMobile];
diff --git a/mobile/.gitignore b/mobile/.gitignore
index 412c61fd6..892c39bc6 100644
--- a/mobile/.gitignore
+++ b/mobile/.gitignore
@@ -64,3 +64,4 @@ buck-out/
# frontend js
/html/Web.bundle/js*
+/html/Web.bundle/locales*
diff --git a/mobile/App.tsx b/mobile/App.tsx
index a1adf0539..0ae150228 100644
--- a/mobile/App.tsx
+++ b/mobile/App.tsx
@@ -1,51 +1,66 @@
-import React from 'react';
-import { WebView, WebViewMessageEvent } from "react-native-webview";
+import React, {useRef} from 'react';
+import {WebView, WebViewMessageEvent, WebViewProps} from 'react-native-webview';
import {SafeAreaView, Text, Platform} from 'react-native';
-// import Tor from "react-native-tor";
+import Tor from 'react-native-tor';
+import {torClient} from './services/Tor';
-// Initialize the module
-// const tor = Tor();
+const App = () => {
+ const webViewRef = useRef
();
+ var uri =
+ (Platform.OS === 'android' ? 'file:///android_asset/' : '') +
+ 'Web.bundle/index.html';
+ // const uri = 'https://robosats.onion.moe';
-// const makeTorRequest = async()=>{
-// // Start the daemon and socks proxy (no need for Orbot and yes iOS supported!)
-// await tor.startIfNotStarted();
+ const onion =
+ 'http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion';
-// try{
-// // Use built in client to make REST calls to .onion urls routed through the Sock5 proxy !
-// const resp = await tor.get('http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion/api/info');
-// return resp
-// } catch(error){
-// // Catch a network or server error like you normally with any other fetch library
-// }
-// }
+ const injectMessage = (id: string, data: object) => {
+ const json = JSON.stringify(data);
+ webViewRef.current?.injectJavaScript(
+ `(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`,
+ );
+ };
-const App = () => {
- // Webview with local html/js in a single location for andrid/iOS
- // https://yelotofu.com/react-native-load-local-static-site-inside-webview-2b93eb1c4225
- const htmlPath = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
+ const manageWebViewMessage = (data: any) => {
+ if (data.category === 'http') {
+ if (data.type === 'get') {
+ torClient.get(data.path).then((response: object) => {
+ injectMessage(data.id, response);
+ });
+ } else if (data.type === 'post') {
+ torClient
+ .post(data.path, data.body, data.headers)
+ .then((response: object) => {
+ injectMessage(data.id, response);
+ });
+ }
+ }
+ };
- const uri = 'https://robosats.onion.moe'
- const onion = 'http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion'
+ const onMessage = async (event: WebViewMessageEvent) => {
+ const data = JSON.parse(event.nativeEvent.data);
+ manageWebViewMessage(data);
+ };
- const runFirst = `
- // document.body.style.backgroundColor = 'red';
- // const currentLocation = window.location;
- // setTimeout(function() { window.alert(currentLocation) }, 000);
- // true; // note: this is required, or you'll sometimes get silent failures
- `;
+ torClient.startDaemon();
return (
-
+
(webViewRef.current = ref)}
javaScriptEnabled={true}
domStorageEnabled={true}
sharedCookiesEnabled={true}
- originWhitelist={['*']} //originWhitelist={[uri,uri2]}
+ thirdPartyCookiesEnabled={true}
+ originWhitelist={[uri, onion]}
scalesPageToFit={true}
startInLoadingState={true}
- mixedContentMode={"always"}
+ mixedContentMode={'always'}
allowsInlineMediaPlayback={true}
allowsFullscreenVideo={false}
setBuiltInZoomControls={false}
@@ -54,9 +69,8 @@ const App = () => {
allowsBackForwardNavigationGestures={false}
mediaPlaybackRequiresUserAction={false}
allowsLinkPreview={false}
- injectedJavaScript={runFirst}
renderLoading={() => Loading RoboSats}
- onError={(syntheticEvent) => {syntheticEvent}}
+ onError={syntheticEvent => {syntheticEvent}}
/>
);
diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle
index 04aa8719e..6c86bb0ad 100644
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -132,11 +132,11 @@ android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
-
- sourceSets {
- main { assets.srcDirs = ['src/main/assets', '../../html'] }
+
+ sourceSets {
+ main { assets.srcDirs = ['src/main/assets', '../../html'] }
}
-
+
defaultConfig {
applicationId "com.robosats"
minSdkVersion rootProject.ext.minSdkVersion
@@ -267,6 +267,8 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
+ implementation files("../../node_modules/react-native-tor/android/libs/sifir_android.aar")
+
if (enableHermes) {
//noinspection GradleDynamicVersion
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
diff --git a/mobile/android/app/src/main/AndroidManifest.xml b/mobile/android/app/src/main/AndroidManifest.xml
index ade8cbc3f..a6fe727a4 100644
--- a/mobile/android/app/src/main/AndroidManifest.xml
+++ b/mobile/android/app/src/main/AndroidManifest.xml
@@ -9,6 +9,7 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
+ android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
inspect
+ WebView.setWebContentsDebuggingEnabled(true);
}
}
diff --git a/mobile/android/build.gradle b/mobile/android/build.gradle
index 43db8cffd..934dab54e 100644
--- a/mobile/android/build.gradle
+++ b/mobile/android/build.gradle
@@ -5,7 +5,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext {
buildToolsVersion = "31.0.0"
- minSdkVersion = 21
+ minSdkVersion = 26
compileSdkVersion = 31
targetSdkVersion = 31
diff --git a/mobile/html/Web.bundle/css/index.css b/mobile/html/Web.bundle/css/index.css
index 7fa15585f..3df760db2 100644
--- a/mobile/html/Web.bundle/css/index.css
+++ b/mobile/html/Web.bundle/css/index.css
@@ -61,8 +61,6 @@ input[type=number] {
.bottomBar {
position: fixed;
bottom: 0;
- width: 100%;
- height: 40px;
}
.amboss{
@@ -91,8 +89,6 @@ input[type=number] {
border-radius: 50%;
border: 2px solid #555;
filter: drop-shadow(1px 1px 1px #000000);
- height: 200px;
- width: 200px;
}
.profileAvatar {
@@ -128,13 +124,6 @@ input[type=number] {
box-shadow: inset 0px 0px 35px rgb(255, 255, 255);
}
-.bookAvatar {
- border-radius: 50%;
- transform: scaleX(-1);
- border: 0.3px solid #555;
- filter: drop-shadow(0.5px 0.5px 0.5px #000000);
-}
-
.MuiButton-textInherit {color : '#111111';}
::-webkit-scrollbar
@@ -153,11 +142,11 @@ input[type=number] {
background: rgba(0, 0, 0, 0.5);
}
+.MuiDataGrid-columnHeaders + div {
+ width: auto !important;
+}
+
@media (max-width: 929px) {
- .MuiDataGrid-columnHeaders + div {
- width: auto !important;
- }
-
.appCenter:has(>div.MuiGrid-root:first-child, >div.MuiBox-root:first-child) {
overflow-y: scroll;
margin-top: 12px;
diff --git a/mobile/html/Web.bundle/index.html b/mobile/html/Web.bundle/index.html
index bc115883c..6ed9f1da8 100644
--- a/mobile/html/Web.bundle/index.html
+++ b/mobile/html/Web.bundle/index.html
@@ -49,7 +49,6 @@