-
Notifications
You must be signed in to change notification settings - Fork 149
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
Android/iOS app. Torified webview in react-native. #42
Comments
Currently under development: Encountering issues that require help from more experienced developers:
Special thanks and compensation (Sats) available to anyone that can help the embedded Android app work well with native tor. For JS injection and message handling we could learn of what Hampus did for WebLN in Webview apps. https://github.com/hsjoberg/react-native-webln maybe even build a wrapper package "react-native-torified-webview" that can be helpful for other projects and be better maintained. Other things that must be done for a functional and useful Android App:
|
Bumping total rewards on this task x2 (from 1M to 2M Sats) |
Hello @Reckless-Satoshi ,I think I can start with fixing react-router |
Assigned you. This task is pretty hard for a newbie like me. Ongoing work with everything needed to build/develop the Android App is in this branch https://github.com/Reckless-Satoshi/robosats/tree/android-webview-app-ts check /mobile/setup.md for my findings on how to setup a react-native development environment and build the webview app. Will leave here some hints that @hsjoberg left on the Blixt wallet group to achieve a torified webview:
|
@Reckless-Satoshi I think the main point on loading the local bundle is based on this line https://github.com/Reckless-Satoshi/robosats/pull/170/files#diff-c92a46984ef937c6501f1fa10feebdf928270c5f2fbd7fe7b24aee34812a9c2cR24, but the URL doesn't seem to exist anymore 😅 Any other suggestion? do you think should I just start from scratch? |
I think this URL only was interesting because it was a general solution that would work in both Android and iOS. I managed to access the content on that URL exported as PDF here |
I have been working on this and I would like to share what I have learned so far and expose the actual situation I'm facing. I explored 2 different ways for doing this, each of them with their own issues, so I'll try to expose them here the best I can: Loading the JS through TorI have been trying to make this work, but looks like webview doesn't really likes to deal with directly Tor, there is still the possibility to overwrite the Http2 calls but as far I have seen, there is no clear solution for that. The JS load is something unrelated to the Tor API requests, so far it's working fine and I found way less problems than expected. That lead us to 2 posibilities: Load the JS from clearnet, call back-end through TorThis was the original approach. It actually works pretty well because I designed the Tor calls on a way it's independent from the JS source location. PROS
CONS
Build the JS inside the AppWebpack can be configured to deploy the front-end to the PROS
CONS
Let's have a talk! I would love to hear different oppinions |
Thanks a lot for this update and the work you are putting into getting the Android app done!
I believe bundling the react.JS app inside the Android app is the way to go. The fact that backend and Android app will have to be versioned and updated at the same time is already contemplated #241 . We will hardcode the version of the react.JS app, and fetch from /api/info the version of the backend. If there is a mistmatch on major+minor (x.x.0), a Dialog will show with an explanation on how to keep RoboSats android client updated. We can release small patches (-.-.x) that won't trigger the Update dialog (can be done whenever the Backend API is still fully compatible). What are the issues this approach has with the WebView? I was able to bundle the main.js with the app.apk, it worked except for the react-router (the bottom bar was there, but the UserGenPage did not render. What I did was to place main.js into |
For the record and answering @Reckless-Satoshi I'll leave here the issues I'm working on: Cookies not available on local filesreact-native-webview/react-native-webview#2643 (comment) It seems to be an issue on Working onUsing https://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-167fc1803bf1acdbd0d427666ac0f21ada0aecdae06acca7029fc8495c49fa7eR3 we can send and obtain the cookies information from Android's local storage. MUI Avatar not loadinghttps://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-d051bd00dd2196f76966e30471e3d9d9644b5026ef8d30e7f0b1bbe6113eebe9R206 Working onStop using MUI Avatar and use https://github.com/Reckless-Satoshi/robosats/blob/1771b4d18a4826f5aa36ece7953aeaa7d80138e2/frontend/src/components/Robots/RobotAvatar/index.tsx, which seems to work. We can do a External sourceshttps://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-a3ab21f543adced6d1570ef4288a66c0f02a7f1d606265b398a5c8bc5ec97f76R83 Working onDidn't tried yet but probably with Tor we can just obtain the Blob. Fetching internal filesRelated with previous issue, as an example the
react-native-webview/react-native-webview#1560 Working onSo far the only case is
|
I also found this Sifir-io/react-native-tor#30 (comment), which is true for my local, I just thought it was related to my connection. |
Excellent work! This "torification" is certainly proving to be way more challenging than expected (... and the expectation was for it to be very hard).
Ha! We can simply open an issue in react-native-tor repo and do nothing to fix it for the moment: Android app users won't be able to disable Stealth Invoices, not a big deal. However, we wanted to use more PUT on API v1, it's good to know this is a limitation.
Nasty, it reads as if BlueWallet devs gave up on react-native-tor ? The MUI As for the cookies issues I see you have some clue leading to possible solutions, awesome! 🚀 |
@Reckless-Satoshi I've found solution for Fetching internal files described above. I've had same problem with getting |
It might be a low hanging fruit to create a tiny react-native webview app wrapping the current webapp. It might also be possible to use react-native-tor https://github.com/Sifir-io/react-native-tor, so the user does not need TOR Browser nor Orbot, but only the .apk.
This could be a good start towards something more versatile and smartphone friendly.
The text was updated successfully, but these errors were encountered: