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

Port Loqui to Cordova #944

Open
TitanNano opened this issue Feb 6, 2016 · 54 comments
Open

Port Loqui to Cordova #944

TitanNano opened this issue Feb 6, 2016 · 54 comments

Comments

@TitanNano
Copy link
Contributor

Hello Everyone,

Firefox OS is dying and by now it's not clear what's going to happen with it in the future. It might become a community driven project under a new name, but who knows....

So my idea is to continue our project by shifting our main platform to Cordova which will alow us to run our Application on Android and iOS.
There is a plugin to use the chrome.socket.tcp API and we would just need to write a shim to translate it to the TCPSocket API from Mozilla so CoSeMe could use it.

Of course we also need to wrap some other APIs, but the TCP socket would be our main problem.
An other issue we would be facing is that we need to make our CSS work with WebKit and Blink.

I'd be happy about some feedback, anyone interested to continue the project like this?

@cmeerw
Copy link
Contributor

cmeerw commented Feb 6, 2016

The main issue I am seeing is that CoSeMe still doesn't support end-to-end encryption and that's going to be a big problem in the very near future. There is a real risk that CoSeMe will stop working by the time any progress has been made on porting it to Cordova. (And if CoSeMe gains encryption support there is a risk that Facebook won't like the competition on the other platforms where there is an official WhatsApp client).

@TitanNano
Copy link
Contributor Author

yes I'm aware of that. But were still providing a fine XMPP client for Mobile Phones, aren't we? So even if we need to drop WhatsApp support, it could be worth to continue the project?

@03927e9c
Copy link

03927e9c commented Feb 7, 2016

The only reason I use Loqui is beause I can use Firefox OS. I don't mess with Android or any other OS. Just my 2 cents.

@TitanNano
Copy link
Contributor Author

@03927e9c do you have any plans which OS you are going to use after Mozilla finally killed FxOS?

@cmeerw
Copy link
Contributor

cmeerw commented Feb 17, 2016

ok, so axolotl support seems to be possible in JavaScript... (as mentioned in #659)

@Honk2
Copy link
Contributor

Honk2 commented Feb 28, 2016

Yes, the official support for FirefosOS will end soon. But I still like it and am willing to use it as long as possible. If it can be avoided, I will not use Android/Windowes or iOS, ever.
The only reason for me to use loqui is the WhatsApp support. Most people, and this includes also my family and friends, are using WhatsApp. Does anyone know how may users use loqui for another messenger than WhatsApp?
And of cause, cmeerw it right, Facebook will not accept any competition on platforms, supported by themself. Therefore it is not a good idea to shift to cordova, in my opinion. Loqui is a great WhatsApp client and I think on mid and long term, it can only survive on platforms that lack an official WhatsApp client while giving these platforms a boost, because there is a good WhatsApp client available..
So my whish is to continue with loqui and implement encryption, maybe my next phone will be UbuntuTouch, which is allready supported by loqui (according to the build output). Maybe also Sailfish could be supported to get another community involved?
If you did not notice yet: WhatsApp announced to drop support for several platforms by end of 2016. Maybe this is the deadline until when encryption is needed.

@03927e9c
Copy link

03927e9c commented Mar 6, 2016

ill use pidgin

@cmeerw
Copy link
Contributor

cmeerw commented May 4, 2016 via email

@Gioyik
Copy link
Member

Gioyik commented May 5, 2016

@cmeerw Ubuntu use the render provided by Qt, if I am not wrong it is Webkit, but don't trust on me.

Do you have an email? I would like to talk a few things with you :)

@cmeerw
Copy link
Contributor

cmeerw commented May 5, 2016

@Gioyik I believe Qt actually switched to Blink (same as Chrome/Chromium).

My email is cmeerw@cmeerw.org

@cmeerw
Copy link
Contributor

cmeerw commented May 6, 2016

I have added Chrome as a new target... So far text messages in WhatsApp (with encryption support) seem to work reasonably well. Unfortunately, STARTTLS for XMPP connections is even more broken in Chrome than in Firefox. User interface appears to be mostly fine in Chrome...

@cmeerw
Copy link
Contributor

cmeerw commented Jun 22, 2016

Just added a cordova target to the build, in dist/cordova you can then do

cordova platform add ubuntu
cordova run ubuntu

to run the basic application (but as usual, only XMPP via WebSockets works for now).

So I guess we will just need a few plugins to access some native facilities (like raw TCP sockets).

@cmeerw
Copy link
Contributor

cmeerw commented Sep 13, 2016

Ok, so I have added some support to fallback to a WebSocket proxy if there is no raw TCP socket support (like on Ubuntu Touch). But this means, that a small WebSocket proxy server is needed - I have made on at http://svn.cmeerw.net/src/nginetd/trunk/ , you just need to build wssrv-tcp and then (on Ubuntu) launch the webapp-container via wssrv-tcp:

wssrv-tcp -d -b 127.0.0.1 -- webapp-container --app-id=loqui.im --user-agent-string="WhatsApp/2.16.9 S40Version/14.26 Device/Nokia302" www/index.html

This should give you some very basic (but working) WhatsApp on Ubuntu (except that you don't have any contacts, but you can receive messages and respond)...

@nfsprodriver
Copy link
Member

How do I build wssrv-tcp?

@cmeerw
Copy link
Contributor

cmeerw commented Sep 21, 2016

make wssrv-tcp

@nfsprodriver
Copy link
Member

I just tried. udns.h seems to be missing...

@cmeerw
Copy link
Contributor

cmeerw commented Sep 21, 2016 via email

@nfsprodriver
Copy link
Member

Ah, thanks! I thought it's missing in the directory. I'll try to resolve the dependencies...

@nfsprodriver
Copy link
Member

Well, I got around with this and when I try to start the app, it closes instantly and via terminal/ssh I get this output:

wssrv-tcp -d -b bananapim2:443 -- webapp-container --app-id=loqui.im --user-agent-string="WhatsApp/2.16.10 S40Version/14.26 Device/Nokia302" www/index.html
[Async_Worker] starting epoll_wait tid=3063501888
[Async_Worker] done epoll_wait tid=3063501888
[Async_Worker] got event 4, operation=16, data=0xbefd6054
[Async_Resolver] on_send
[Async_Resolver] process timeout=-1
[Async_Worker] starting epoll_wait tid=3063501888
Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'
UbuntuClientIntegration: connection to Mir server failed. Check that a Mir server is
running, and the correct socket is being used and is accessible. The shell may have
rejected the incoming connection, so check its log file
[Async_Handler] posted CANCEL for worker threads
[Async_Worker] done epoll_wait tid=3063501888
[Async_Worker] got event 16, operation=1, data=0x3c590
[Async_Handler] all worker threads have terminated

So I know about the trouble launching apps via terminal/ssh on Ubuntu Touch, but what WebSocket server/port should I choose?

@cmeerw
Copy link
Contributor

cmeerw commented Sep 21, 2016 via email

@nfsprodriver
Copy link
Member

At my Linux Mint 18 64bit it's working (except the decrypt errors). On my Ubuntu Phone it doesn't. Previously I had problems by getting some libs, which are available since xenial only so I used the serveral files for the vivid based phone. Maybe that's incompatible.

@SanderKlootwijk
Copy link

Hi nfsprovider, I would like to test LoquiIM on Ubuntu Touch, but when you enable read-write mode and just edit the LoquiIM files, will the OTA-Updates still be available?

@nfsprodriver
Copy link
Member

The one thing has nothing to do with the other thing so, yes. But be warned working in a writable root filesystem. By the way, after reboot the filesystem is read only again. After OTA-Updates you may do the steps again because some changes will be overwritten or removed during an update.

@gabriel-lucas
Copy link

gabriel-lucas commented Oct 18, 2016

Hello @nfsprodriver I followed your steps and managed to get Loqui installed in my Ubuntu phone but I´m facing and issue.

When I try to register my mobile phone I get the SMS with the code correctly but it get stuck verifying the mobile phone and code numbers. I managed to run it from the adb shell so I can get the trace log:

These are the two messages that look important:
Refused to set unsafe header "User-Agent"
{"status":"fail","reason":"missing"}

I checked this website but no luck. https://github.com/mgp25/Chat-API/wiki/WhatsApp-Registration-Flow

qml: JS Request: https://v.whatsapp.net/v2/register?cc=XX&in=XXXXXXXX&code=XX&id=XXXXX ~ at Logger.CoSeMe.namespace.Logger.log (file:///opt/click.ubuntu.com/com.ubuntu.loqui.im.loqui/0.5.9/www/scripts/mozillahispano/coseme.js:3477:10) [http]
qml: JS Refused to set unsafe header "User-Agent"

qml: JS {"status":"fail","reason":"missing"} ~ at Logger.CoSeMe.namespace.Logger.log (file:///opt/click.ubuntu.com/com.ubuntu.loqui.im.loqui/0.5.9/www/scripts/mozillahispano/coseme.js:3477:10) [http]

The personal data has been replaced with XXXX

@aesedepece ¿me ayudas con esto?

@nfsprodriver
Copy link
Member

Have you launched it with the right User Agent? It must be the ...2.16.10... one.

@gabriel-lucas
Copy link

hi @nfsprodriver thanks for your answer!

I take the user agent from whatsapp file.
--user-agent-string="WhatsApp/2.16.10 S40Version/14.26 Device/Nokia302"

is this correct?

@SanderKlootwijk
Copy link

Hi,

Here is a small list of my experiences so far. I've tested a Whatsapp account on Ubuntu Touch and the following things work:

  • Send messages to people or groups;
  • edit settings like "Name" and "Status";
  • edit all the settings in the "Settings" menu;
  • enable developer options;
  • receive pictures (although you can't view them properly, they are all blurry);
  • deleting, hiding, muting and enabling OTR chats.

What doesn't work:

  • Notifications;
  • add new contacts (people have to send you a message before you can send messages to them);
  • contacts integration;
  • editing profile picture;
  • send pictures;
  • send location;
  • send contact;
  • send speech message;
  • send file.

Also the other account types like Facebook and Hangouts doesn't work.

@nfsprodriver
Copy link
Member

Seems you got more things working than me. Have you done anything different?

@nfsprodriver
Copy link
Member

@gabriel-lucas Yes it should be ;)

@gabriel-lucas
Copy link

No idea why it fails. Neither, opening it from terminal through adb shell or directly from the Loqui icon works.

Do you know any way I can debug or search for a solution to this?

cheers!

@nfsprodriver
Copy link
Member

What I can say now is to use the whatsapp file to launch the app. Be sure you've loaded the wssrv-tcp into the /bin/ directory, made it executable (sudo chmod +x) and installed all necessary dependencies (-> instructions).

@gabriel-lucas
Copy link

ls -l /bin/wssrv-tcp
-rwxr-xr-x 1 root root 2908776 Oct 18 00:03 /bin/wssrv-tcp


$sudo apt-get install libudns-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libudns-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


ls -l /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
lrwxrwxrwx 1 root root 19 Aug 20 2014 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 -> libstdc++.so.6.0.20


ls -l whatsapp
-rwxrwxr-x 1 phablet phablet 263 Oct 18 16:28 whatsapp


cat whatsapp
wssrv-tcp -d -b 127.0.0.1 -- webapp-container --app-id=loqui.im --user-agent-string="WhatsApp/2.16.10 S40Version/14.26 Device/Nokia302" /opt/click.ubuntu.com/com.ubuntu.loqui.im.loqui/0.5.9/www/index.html --store-session-cookies --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop


The problem is registering, could it be that the account might be blocked or something similar?

@SanderKlootwijk
Copy link

@nfsprodriver I guess that you haven't found out yet how to open the menu. It's a bit buggy but I can open it by following the next steps:

  • Hold the pencil icon for a few seconds;
  • tap somewhere in the blank space under your chats.

The menu will slide-in from the left side of the screen. Here you can access your (profile) settings and accounts.

@nfsprodriver
Copy link
Member

Great, thanks!!!

@cmeerw
Copy link
Contributor

cmeerw commented Oct 18, 2016 via email

@SanderKlootwijk
Copy link

@cmeerw Swiping right doesn't seem to work on Ubuntu Touch ;(

@nfsprodriver
Copy link
Member

@cmeerw Can you integrate all dependencies into wssrv-tcp like udnv and libstdc++ to make the installation as easy as possible?

@cmeerw
Copy link
Contributor

cmeerw commented Oct 19, 2016

@nfsprodriver I am surprised that there isn't a system libstdc++ available... Surely anything using Qt must also depend on libstdc++...
Even if there isn't a system one, the so file can probably be packaged with the wssrv-tcp...
It's just a bit difficult to find the best solution without having a device myself...

@nfsprodriver
Copy link
Member

nfsprodriver commented Oct 19, 2016

The thing is, I compile it on a Bananapi Ubuntu 16.04 arm with all the dependencies and use the compiled file in Ubuntu Touch, where I need to install libudns-dev and libstdc++. Second one isn't available for arm 15.04, so I use the 16.04 one from the Bananapi.

@pharaone
Copy link
Contributor

Thanks for the Ubuntu touch port, I love it!

@cmeerw
Copy link
Contributor

cmeerw commented Oct 29, 2016

But please do not publish it as something for end users, it's not ready yet as can be seen by #1156 - please work on fixing it first!

@TronFortyTwo
Copy link
Contributor

I'm not a developer of this program but I'd like to write something here. First of all I want to thank you all for all your work. I think is a good think to port it to Ubuntu Touch, and i found publish the app in the Open Store a good solution to open the app to developers and enthusiasts even if is a heavy work in progress.

@cmeerw
Copy link
Contributor

cmeerw commented Oct 30, 2016

Some design discussion points I hope to get some feedback from Ubuntu Touch devs:

Main problem is that LoquiIM needs some non-standard APIs, with the most important one being opening TCP connections - I think the others are then access to the phone address book and ability to read/write files on the local filesystem (oh, and some way to prevent the CPU from going back to sleep when it shouldn't)

Question is what is the best (and easiest) way to make these APIs available on Ubuntu Touch? For the moment I have written a simple WebSocket server that can be started on the device and that translates from a WebSocket connection to a plain TCP connection.

One other option could be Cordova, but I am not entirely sure yet how well that really is supported on Ubuntu Touch (it definitely doesn't have a TCP plugin) and I have issues with their plugin API which seems to essentially pass Javascript code as strings around that then gets executed - this seems like a disaster waiting to happen and is probably not ideal for something like TCP sockets or files where significant amounts of data can be transferred.

Is there any other way to access native APIs from HTML5 apps? Maybe something that provides a sane plugin interface? (yes, I really dislike Cordova)

So what would be the recommended way to solve this? Are there any existing examples of HTML5 web apps on Ubuntu Touch that need some native API access?

@TronFortyTwo
Copy link
Contributor

I made some research and Ubuntu Touch seem supports Cordova, but about TCP I haven't found any documentation...

@pharaone
Copy link
Contributor

pharaone commented Oct 30, 2016

@cmeerw
Copy link
Contributor

cmeerw commented Oct 30, 2016 via email

@sap-nocops
Copy link
Contributor

Hi,
I'm an ubuntu touch user and a developer also.
I'd really love to have this app on ubuntu and I'd love to help.
Let me know if I can help somehow with testing and coding

@nfsprodriver
Copy link
Member

Hello! Good to hear from your engagement. The first things I would think of are Contact Import, Notifications, Content Hub and the Noise Protocol cmeerw already working on. Maybe we can get rid of the DECRYPT ERRORS before finishing the implementation?

@pharaone
Copy link
Contributor

Any news?

@petermalcom
Copy link

i cant see my loqui app in market place pliz help mee

On 13 November 2016 at 12:56, Emanuele Antonio Faraone <
notifications@github.com> wrote:

Any news?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#944 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ATx0JKgAF8xD3HAbxjJWQA3NKkl0rrBLks5q9t7ogaJpZM4HU1eO
.

@nfsprodriver
Copy link
Member

I opened an issue about the tcp socket server for Ubuntu Touch. Everything about that should be discussed there: #1181 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests