Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Update endpoint instructions

Prateek Sunal4bae781992e1
diff --git a/.gitignore b/.gitignore
index e56972a81c..4a799e41f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,8 @@ node_modules/
# Build artifacts
mobile/native/android/packages/rust/build/
mobile/native/darwin/Packages/Rust/build/
+mobile/native/darwin/Apps/ensu/build/
target/
+
+# Local ensu endpoint overrides (compile-time)
+mobile/native/darwin/Apps/ensu/ensu/Generated/EndpointConfig.swift
diff --git a/mobile/native/darwin/Apps/ensu/README.md b/mobile/native/darwin/Apps/ensu/README.md
index 89d3e79780..cbd7d561d4 100644
--- a/mobile/native/darwin/Apps/ensu/README.md
+++ b/mobile/native/darwin/Apps/ensu/README.md
@@ -1,21 +1,91 @@
# Ensu Apple Platforms
-## Build
+## Build (Terminal)
-Open the Xcode project:
+All commands below assume you run them from `darwin/Apps/ensu`.
+### Debug Build (Simulator)
```bash
-open darwin/Apps/ensu/ensu.xcodeproj
+cd darwin/Apps/ensu
+xcodebuild \
+ -project ensu.xcodeproj \
+ -scheme Ensu \
+ -configuration Debug \
+ -sdk iphonesimulator \
+ -destination 'platform=iOS Simulator,name=iPhone 15' \
+ -derivedDataPath build
```
+### Debug Build (Device)
+```bash
+cd darwin/Apps/ensu
+xcodebuild \
+ -project ensu.xcodeproj \
+ -scheme Ensu \
+ -configuration Debug \
+ -sdk iphoneos \
+ -destination 'generic/platform=iOS' \
+ -derivedDataPath build
+```
+
+### Release Build (Archive)
+```bash
+cd darwin/Apps/ensu
+xcodebuild \
+ -project ensu.xcodeproj \
+ -scheme Ensu \
+ -configuration Release \
+ -sdk iphoneos \
+ -destination 'generic/platform=iOS' \
+ -archivePath build/Ensu.xcarchive \
+ archive
+```
+
+To export an IPA, provide an `ExportOptions.plist` and run:
+```bash
+xcodebuild \
+ -exportArchive \
+ -archivePath build/Ensu.xcarchive \
+ -exportPath build/Export \
+ -exportOptionsPlist /path/to/ExportOptions.plist
+```
+
+## Installation (Terminal)
+
+### Debug (Simulator)
+```bash
+cd darwin/Apps/ensu
+xcrun simctl boot "iPhone 15" || true
+xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/Ensu.app
+xcrun simctl launch booted io.ente.ensu
+```
+
+### Debug (Physical Device)
+```bash
+cd darwin/Apps/ensu
+xcrun devicectl device list
+xcrun devicectl device install app \
+ --device <DEVICE_UDID> \
+ build/Build/Products/Debug-iphoneos/Ensu.app
+```
+
+### Release (IPA)
+Install the exported IPA via Apple Configurator or TestFlight after `xcodebuild -exportArchive`.
+
## Custom API Endpoint
-Set the `ENTE_API_ENDPOINT` value in the app’s Info.plist (or via an Xcode build setting) to override the default `https://api.ente.io`.
+Set the endpoint at build time using `ENTE_API_ENDPOINT`. If it is not set, the app defaults to `https://api.ente.io`.
-**Option A: Info.plist**
-- Add a new key `ENTE_API_ENDPOINT` with your endpoint URL as the value.
+```bash
+cd darwin/Apps/ensu
+ENTE_API_ENDPOINT="https://your-endpoint.example" \
+ xcodebuild \
+ -project ensu.xcodeproj \
+ -scheme Ensu \
+ -configuration Debug \
+ -sdk iphonesimulator \
+ -destination 'platform=iOS Simulator,name=iPhone 15' \
+ -derivedDataPath build
+```
-**Option B: Build Setting**
-- In Xcode, add a User-Defined Setting `ENTE_API_ENDPOINT` and reference it in Info.plist as `$(ENTE_API_ENDPOINT)`.
-If the key is missing or empty, the app defaults to `https://api.ente.io`.
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Info.plist b/mobile/native/darwin/Apps/ensu/ensu/Info.plist
index 572d0c9c40..818fc789a9 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Info.plist
+++ b/mobile/native/darwin/Apps/ensu/ensu/Info.plist
@@ -54,6 +54,9 @@
<string>Fonts/JetBrainsMono-Regular.ttf</string>
</array>
+ <key>NSPhotoLibraryUsageDescription</key>
+ <string>Allow access to select photos and images to attach to chat messages.</string>
+
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
index 56b84d8946..5aedd88cc7 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
@@ -17,17 +17,13 @@ struct NetworkConfiguration {
enum EnsuDeveloperSettings {
private static let endpointKey = "ensu.customEndpoint"
- private static let infoPlistKey = "ENTE_API_ENDPOINT"
static var currentEndpoint: URL? {
- if let stored = UserDefaults.standard.string(forKey: endpointKey),
- let url = URL(string: stored) {
- return url
+ if let buildEndpoint = endpointURL(from: BuildEndpointConfig.endpoint) {
+ return buildEndpoint
}
- if let plistValue = Bundle.main.object(forInfoDictionaryKey: infoPlistKey) as? String,
- !plistValue.isEmpty,
- let url = URL(string: plistValue) {
- return url
+ if let storedEndpoint = endpointURL(from: UserDefaults.standard.string(forKey: endpointKey)) {
+ return storedEndpoint
}
return nil
}
@@ -55,6 +51,12 @@ enum EnsuDeveloperSettings {
}
}
+ private static func endpointURL(from value: String?) -> URL? {
+ guard let value, !value.isEmpty else { return nil }
+ let normalized = normalize(value)
+ return URL(string: normalized)
+ }
+
static func normalize(_ value: String) -> String {
var trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)
while trimmed.hasSuffix("/") {
diff --git a/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh b/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh
index 9e43c1d1a8..152b32ce81 100755
--- a/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh
+++ b/mobile/native/darwin/Apps/ensu/scripts/build-rust.sh
@@ -26,6 +26,36 @@ if [ "${CONFIGURATION:-Debug}" = "Release" ]; then
PROFILE="release"
fi
+write_endpoint_config() {
+ endpoint_value="${ENTE_API_ENDPOINT:-}"
+
+ endpoint_value="$(printf "%s" "${endpoint_value}")"
+ endpoint_value="${endpoint_value%%$'\n'*}"
+ endpoint_value="$(echo "${endpoint_value}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
+
+ generated_file="${SRCROOT}/ensu/Generated/EndpointConfig.swift"
+ mkdir -p "$(dirname "${generated_file}")"
+
+ if [ -n "${endpoint_value}" ]; then
+ escaped_value="${endpoint_value//\\/\\\\}"
+ escaped_value="${escaped_value//\"/\\\"}"
+ endpoint_literal="\"${escaped_value}\""
+ else
+ endpoint_literal="nil"
+ fi
+
+ cat > "${generated_file}" <<EOF
+// This file is generated by scripts/build-rust.sh. Do not edit manually.
+import Foundation
+
+enum BuildEndpointConfig {
+ static let endpoint: String? = ${endpoint_literal}
+}
+EOF
+}
+
+write_endpoint_config
+
# Map Xcode platform+arch to Rust target triple.
# Note: For iOS simulator on arm64, Rust uses aarch64-apple-ios-sim.
rust_target_for() {