iPhone client for network-computer: see and drive a remote Linux/Mac desktop over WebRTC, phone as trackpad and keyboard, desktop on a TV via AirPlay.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer-ios.git
HTTPS
https://gitstable.com/git/askrobots/network-computer-ios.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer-ios.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst First cut of the iPhone client cc1f67f 2 months ago History
Settings.swift · 1.5 KB · 31 lines
1import Foundation
2import Combine
3
4/// Connection settings. Non-secret fields in UserDefaults, secrets in the Keychain.
5final class Settings: ObservableObject {
6 static let shared = Settings()
7 private let d = UserDefaults.standard
8
9 @Published var rendezvousURL: String { didSet { d.set(rendezvousURL, forKey: "rendezvousURL") } }
10 @Published var user: String { didSet { d.set(user, forKey: "user") } }
11 @Published var hostName: String { didSet { d.set(hostName, forKey: "hostName") } }
12 @Published var trackpadMode: Bool { didSet { d.set(trackpadMode, forKey: "trackpadMode") } }
13 @Published var relayOnly: Bool { didSet { d.set(relayOnly, forKey: "relayOnly") } }
14 @Published var password: String { didSet { Keychain.set(password, for: "password") } }
15 @Published var pin: String { didSet { Keychain.set(pin, for: "pin") } }
16
17 private init() {
18 rendezvousURL = d.string(forKey: "rendezvousURL") ?? "http://192.168.0.1:8765"
19 user = d.string(forKey: "user") ?? "nc"
20 hostName = d.string(forKey: "hostName") ?? ""
21 trackpadMode = d.object(forKey: "trackpadMode") as? Bool ?? true
22 relayOnly = d.bool(forKey: "relayOnly")
23 password = Keychain.get("password")
24 pin = Keychain.get("pin")
25 }
26
27 var endpoint: SignalingClient.Endpoint? {
28 guard let url = URL(string: rendezvousURL.trimmingCharacters(in: .whitespaces)), url.host != nil else { return nil }
29 return .init(baseURL: url, user: user, password: password)
30 }
31}