Connect to a server
How the Mobile App connects to a Pagis server and opens its Product App.
The Mobile App is the Pagis app for iOS and Android. It runs on an iPhone, on an iPad and on an Android phone. It shows the Product App of one Pagis server, and it bundles only the Connect screen and the Unreachable screen (ADR-0032). The app installs nothing, and the phone is not a Host.
Install the app
Each release of the iOS app goes to TestFlight. A maintainer of the project invites each tester, and the tester installs the app with the TestFlight app on an iPhone or an iPad. The App Store listing and the Google Play listing are not built.
The server that the app reaches
The app connects to a server only over https://. It reaches:
- A Server behind a proxy that holds TLS (Proxy).
- A Local Installation in Remote Access (Serve several People).
The app refuses an http:// address before it sends a request.
Connect
The Connect screen shows one field, Server address or sign-in link,
Connect, and Scan a sign-in link. The field takes the address of the server, such as
pagis.example.com, or a sign-in link of the server,
https://<host>/sign-in#<secret>. An address with no scheme means
https://. When you select Connect, the app does these checks in this
sequence:
- It reads the field. An empty address, an
http://address, an address with a user name or a password, and a sign-in link with no secret get a message. - It reads
GET /api/v1/healthat the origin of the server. When no Pagis server answers, the message tells you to check the address. When the server runs a release older than the oldest release that the app accepts, the message tells you to ask the administrator of the server to update it. The app accepts every newer release. - It reads
GET /api/v1/setup. When the server has no Administrator yet, the message names the administration page that finishes the setup.
Each message shows under the field. Each request goes to the origin of the server, follows no redirect, and holds no secret of a link.
When the checks pass, the app keeps the origin of the server, and nothing more. The secret of a link goes to no storage of the app. The app then signs you in:
- For an address, the app opens the server's sign-in page in the system browser. The browser shows the origin and TLS state, and the password manager matches the saved password to that server. You give your password, or paste a sign-in link when Remote Access requires one. The page returns to Pagis with a one-use sign-in link. Select Return to the app if the browser does not open Pagis. The app spends that link in its web view and opens the Product App. The browser keeps no Session of the server.
- For a sign-in link, the app opens the link. The page of the link posts the secret to the server and gets the Session. A link signs in one client, one time. Get a link as Connect with a sign-in link shows.
The return link lives five minutes. It is bound to a verifier that the app keeps in memory. The app checks the callback state, and the server accepts the link only with the correct verifier. A wrong callback or a closed browser signs nobody in. Select Connect again to start a new sign-in. On iOS, the browser Session is ephemeral and leaves no cookie in Safari. On Android, the Custom Tab requests ephemeral browsing. The sign-in page ends the Session of its Custom Tab before it returns to the app.
The Sessions list names the Session "Pagis on iPhone", "Pagis on iPad" or "Pagis on Android". Remove a Session of the app in Settings → Sessions, as any other Session.
Scan a sign-in link
On a browser or app that is signed in, open Settings → Sessions and select Sign in another browser or app. Then select Scan a sign-in link on the Connect screen, and point the camera at the QR code. At the first scan, the phone asks to let Pagis use the camera.
The app does the checks of a link that you paste, from step 2. A QR code that holds no sign-in link, such as the address of a server or other text, gets a message, and the app opens nothing. Scan the QR code in the app, and not with the camera of the phone: the camera opens the link in the system browser, which signs in the browser and not the app.
Stay signed in
The app keeps a copy of the Session, encrypted, for the notifications of the app. The copy follows the Session in the app. When you sign out, or when the server ends the Session, the app deletes the copy and opens the Connect screen. Connect to the server or scan a new sign-in link to sign in again.
Start the app again
The app opens the same server at each start, signed in while the Session lasts.
When the server does not load
When the app cannot load the server, it shows the Unreachable screen. For example, the name of the server does not resolve, the server does not answer, or TLS fails. The screen shows the address of the server and the error. The app keeps the server.
- Select Try again to open the server again.
- Select Change server to forget the server and the copy of the Session, and open the Connect screen.
Change server
Touch and hold the Pagis icon on the Home Screen, then select Change server. The app forgets the server and the copy of the Session, and opens the Connect screen.
What the app gives a page
The Mobile App gives the native functions of the app only to the main frame of the server's exact origin: the scheme, the host and the port must all match. A Widget frame and each other frame or origin get no answer.
Only the server's exact origin stays in the app. A link or a new window to
another origin opens in the system browser, also a link to another port or
another scheme of the same host, such as https://pagis.example.com:444 or
http://pagis.example.com.
The app gives the microphone only to the server's exact origin, for Dictation. A Widget frame and each other origin get no microphone, and no page gets the camera. The phone asks to let Pagis use the microphone once, at the first use of Dictation, and not again. The live screen and Listen-Live work as in a browser. On an iPhone, Listen-Live plays also when the ring/silent switch is on silent.
On Android, the app needs an Android System WebView that has a web message listener. On an older web view, the app shows a message to update Android System WebView in Google Play, and it opens no server.