Search | Sailfish OS | Running | PineTime | All Posts

(Sail)Slack on SailfishOS

July 27, 2020 — Nico Cartron

A quick explanation/workaround on how to make Openrepos' Sailslack on SailfishOS work


What's the problem

There are currently 2 Slack applications available for SailfishOS:

  • Slackfish - available on the official Jolla store, but login does not work
  • Sailslack avaible on Openrepos, with the same login issue.

However, someone posted a workaround explaining how to make Sailslack work.

So let's break this down.

The issue

If you've tried Sailslack before, you'll have noticed that the issue has to do with the login part - it is impossible to click on the "Accept/Agree" button when trying to log in to Slack.

The workaround explains that this is due to the Qt WebView being too old, and that the only (easy) fix would be to update the Qt version - so depending on Jolla.

How to fix it

So to fix this issue, you'll have to go under the hood (i.e. connect via SSH to your SFOS phone):

  • SSH to your device (ssh nemo@<IP addres>)
  • switch to root user with devel-su
  • go into the /usr/share/harbour-sailslack/qml/pages folder
  • edit the LoginPage.qml file (it's recommended to make a copy before)

    • the last 3 second to last lines (59 to 62) look like this:

       function isSuccessUrl(url) {  
           return url.toString().indexOf('error=') === -1 && url.toString().indexOf('state=' + page.processId) !== -1  
       }
      
    • insert the following code just before the last closing curly bracket ('}'):

      property url tmpUrl: "http://localhost:3000/oauth/callback?code="  
      Component.onCompleted: {  
          console.log("startUrl", startUrl)  
          //authenticator.fetchAccessToken(page.tmpUrl)  
      }
      

      (Note: these are 5 different lines)

    • you can also download the modified file from here if you wish to :)

  • switch back to normal nemo user (by doing Control + d)

  • start Sailslack still from SSH: harbour-sailslack
  • this will launch Sailslack on your phone
  • in the Sailslack app, pulldown and select "Sign into a Workspace"
  • kill the app with a Control + c
  • this will display some lines in the SSH terminal, one of them containing startUrl
  • copy that Url, and paste it in your PC's browser, then press accept button,
  • this will then redirect to another Url, starting with http://localhost:3000,
  • copy the part after code=,
  • switch again to root (devel-su),
  • and paste it into the LoginPage.qml, in the line property url tmpUrl
  • (beware that Url is only valid for 10 minutes, so if you take more than that, you'll have to redo the whole process)
  • Then uncomment the line starting with //authenticator.fetchAccessToken
  • you should now have something like that in this file:

      property url tmpUrl: "http://localhost:3000/oauth/callback?code=15023450262.3274539243569.121dc7f2698cvf201d20&state="
      Component.onCompleted: {
        console.log("startUrl", startUrl)
        authenticator.fetchAccessToken(page.tmpUrl)
      }
    

    (Note: these are 5 different lines)

  • start again the app, this time from the phone itself, and it now should work!

Huge thanks to the user decon for finding this workaround and posting it on Openrepos!

Tags: SailfishOS, Tips


I don't have any commenting system, but email me (nicolas at ncartron dot org) your comments!
If you like my work, you can buy me a coffee!