syncloud / platform

Run popular services on your device with one click
https://syncloud.org
GNU General Public License v3.0
401 stars 41 forks source link

Linux smartphone Syncloud activation app #487

Closed klmhsb42 closed 1 year ago

klmhsb42 commented 4 years ago

As there are Linux smartphones like PINEPHONE and Librem 5 coming up, it might make sense to offer the Syncloud activation app on those devices, too.

klmhsb42 commented 4 years ago

OpenStore for Ubuntu Touch: https://open-store.io/

klmhsb42 commented 3 years ago

Probably just a low-priority issue, but just to let you know that I have a pinephone beta device and would be able to test it. I don't have time/knowledge to develop at the moment.

cyberb commented 3 years ago

Mobile app only feature is to find device IP and ooen a browser. for you. So if you have a browser for pinephone then you are fine. Does pinephone support Android apps? The bigger problem is actually having all the client apps like Nextcloud, RocketChat ...

klmhsb42 commented 3 years ago

For myself, I can deal with the workaround. For the browser you need to know the IP first. Android apps can't be run drirectly on the Linux OS but in Anbox. However, it didn't work for me on mobian yet.

I think Syncloud mobile app is very convenient and maybe there are similar GUI utilities on Linux which could be forked and simplified. Just out of curiosity: How do you detect the IPs of the syncloud devices only and not just of all devices in the network?

Mail, files, contacts, xmpp, matrix clients work so far I guess. Direct apps like nextcloud talk are not there. Telegram works pretty reliably. You can save urls like sub.device.syncloud.it as web app.

cyberb commented 3 years ago

Just out of curiosity: How do you detect the IPs of the syncloud devices only and not just of all devices in the network?

Each Suncloud device runs an avahi daemon which uses mdns (zeroconf, bonjour) to announce itself, so any mdns client can do it. https://www.avahi.org/

klmhsb42 commented 2 years ago

I'm using ubuntu touch on a volla phone as my daily driver since months now and I started to port apps using qml (I've a basic understanding). I started to play around to create a frame for a potential syncloud app inspired by your android version. How would it be possible to authenticate against syncloud.it and to get a token? Is there an API? I've seen it would be also possible via the webinterface https://stackoverflow.com/questions/58921220/qt5-qml-automatic-authentication-username-and-password-with-on-a-third-party-de

cyberb commented 2 years ago

If you are trying to port Syncloud Android app to Ubuntu Phone you probably just need to do what app does: https://github.com/syncloud/android/blob/master/syncloud/src/main/java/org/syncloud/android/core/redirect/RedirectService.kt#L22

I would just port as is to whatever UI framework phone uses (qml, java script, snap)

klmhsb42 commented 2 years ago

I would just port as is to whatever UI framework phone uses (qml, java script, snap)

looks like you would have to pack a java compiler with it

I have the following thing, but it returns the following after inserting my credentials

qml: code: 500 qml: {"success":false,"message":"unable to get a user"}

function makeRequest()
    {
    var fetch={};
    fetch["some"]="requestcontent";
    var postData = JSON.stringify(fetch);
    var doc = new XMLHttpRequest();
    doc.onreadystatechange = function() {
        if (doc.readyState == doc.DONE) {

            console.debug("code: " + doc.status);
            var serverResponse = doc.responseText;
            console.log(serverResponse);

            var result = JSON.parse(serverResponse);

        }
    }

    var user=username.text
    var pass=password.text

    doc.open("POST", "https://api.syncloud.it/user");
    doc.setRequestHeader('Content-type', 'application/json');
    doc.setRequestHeader( 'Authorization', 'Basic ' + user+':'+pass);
    //doc.setRequestHeader( 'Authorization', 'Basic ' + Qt.btoa( user + ':' + pass ) )

    doc.withCredentials = true;

    doc.send(postData);
    }
klmhsb42 commented 2 years ago

sounds like it can't get the user string from 'Basic ' + user+':'+pass

cyberb commented 2 years ago

looks like you would have to pack a java compiler with it

No, I mean port the logic as to whatever panguage it is.

doc.setRequestHeader( 'Authorization', 'Basic ' + user+':'+pass);

This is wrong because this not what is happening in android, we just post json for this class:

class UserCredentials(
    val email: String,
    val password: String
)

Which translates to this json:

{
    "email": "user@example.com",
    "password": "secret"
)

We are not using basic authenrication.

klmhsb42 commented 2 years ago

I can login successfully. I just uploaded my current stuff https://github.com/klmhsb42/syncloud-ub-touch so anybody can follow updates...

klmhsb42 commented 2 years ago

If this app works, it can also be build for ubuntu desktop in future easily, I guess...

cyberb commented 2 years ago

great! do you have any screenshots (I have no running ubuntu touch at the moment)? also do you want to add any CI (travis, gh actions ...) so each commit produces a package for testing/publishing? do you want me to create a repo under syncloud for you like syncloud/ubuntu-touch?

cyberb commented 2 years ago

and of cause unit tests? :)

klmhsb42 commented 2 years ago

do you have any screenshots

done (see my repo .rmd file)

I have no running ubuntu touch at the moment

you can also build on desktop, and in a convenient way using qtcreator (see my repo .rmd file)

do you want to add any CI (travis, gh actions ...)

and of cause unit tests? :)

never worked with that/heard about it, but sounds interesting ;)

do you want me to create a repo under syncloud for you like syncloud/ubuntu-touch?

yes, would be nice

klmhsb42 commented 2 years ago

right now I get the json from server and can read it with the console log. Next step would be to save it and to display the output in the UI and to refresh it.

Each Suncloud device runs an avahi daemon which uses mdns (zeroconf, bonjour) to announce itself, so any mdns client can do it. https://www.avahi.org/

If this is implemented, the app can be published I guess

cyberb commented 2 years ago

https://github.com/syncloud/ubuntu-touch You have maintainer permissions, that means you can push directly.

cyberb commented 1 year ago

I guess no progress on ununtu touch means we can remove it for now to reduce confusion.