Compare commits
10 Commits
f68fce83e6
...
0f1b6a6157
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f1b6a6157 | |||
| ba9bba1503 | |||
| 876db1751a | |||
| d173c08a0c | |||
| 9f33b5a332 | |||
| e9093b2822 | |||
| 1d2b6f2d87 | |||
| 94887f6cf7 | |||
| a083606b9e | |||
| f66cdcfa42 |
305
DEPLOYMENT_STATUS.md
Normal file
305
DEPLOYMENT_STATUS.md
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
# Deployment Status - SilverDROID
|
||||||
|
|
||||||
|
## ✅ Successfully Pushed to GitLab!
|
||||||
|
|
||||||
|
**Timestamp:** 2025-09-30 18:13:47 +02:00
|
||||||
|
**Commit:** c667765
|
||||||
|
**Branch:** main
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📍 Project URLs
|
||||||
|
|
||||||
|
**Project Homepage:**
|
||||||
|
```
|
||||||
|
https://gitlab.silverlabs.uk/silverlabs/silverdroid
|
||||||
|
```
|
||||||
|
|
||||||
|
**Pipeline Dashboard:**
|
||||||
|
```
|
||||||
|
https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/pipelines
|
||||||
|
```
|
||||||
|
|
||||||
|
**First Pipeline:**
|
||||||
|
```
|
||||||
|
https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/pipelines/205
|
||||||
|
```
|
||||||
|
|
||||||
|
**Repository:**
|
||||||
|
```
|
||||||
|
https://gitlab.silverlabs.uk/silverlabs/silverdroid.git
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 What Was Pushed
|
||||||
|
|
||||||
|
**41 files committed:**
|
||||||
|
- ✅ Complete Android project structure
|
||||||
|
- ✅ MainActivity configured for admin.dark.side
|
||||||
|
- ✅ WebView with WASM support
|
||||||
|
- ✅ Glassmorphism UI components
|
||||||
|
- ✅ Material Design 3 theme
|
||||||
|
- ✅ Room database layer
|
||||||
|
- ✅ `.gitlab-ci.yml` pipeline configuration
|
||||||
|
- ✅ Comprehensive documentation (12 files)
|
||||||
|
- ✅ Push automation scripts
|
||||||
|
|
||||||
|
**Total lines:** ~4,857 insertions
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚠️ Pipeline Status: Failed (Expected)
|
||||||
|
|
||||||
|
**Pipeline #205** failed immediately because:
|
||||||
|
- **No GitLab Runners are configured** for the project
|
||||||
|
|
||||||
|
This is **normal** for a new GitLab installation. You need to set up a Runner first.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 Next Step: Configure GitLab Runner
|
||||||
|
|
||||||
|
### Option 1: Register a New Runner
|
||||||
|
|
||||||
|
**On your GitLab server (or dedicated runner machine):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install GitLab Runner (if not already installed)
|
||||||
|
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
|
||||||
|
sudo apt-get install gitlab-runner
|
||||||
|
|
||||||
|
# Register the runner
|
||||||
|
sudo gitlab-runner register \
|
||||||
|
--url https://gitlab.silverlabs.uk \
|
||||||
|
--token <PROJECT_REGISTRATION_TOKEN> \
|
||||||
|
--executor docker \
|
||||||
|
--docker-image mingc/android-build-box:latest \
|
||||||
|
--description "Android Build Runner" \
|
||||||
|
--tag-list "android,docker" \
|
||||||
|
--run-untagged=true \
|
||||||
|
--locked=false
|
||||||
|
```
|
||||||
|
|
||||||
|
**Get the registration token:**
|
||||||
|
1. Go to: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/settings/ci_cd
|
||||||
|
2. Expand "Runners"
|
||||||
|
3. Copy the registration token
|
||||||
|
4. Use it in the command above
|
||||||
|
|
||||||
|
### Option 2: Use an Existing Runner
|
||||||
|
|
||||||
|
If you already have GitLab Runners:
|
||||||
|
|
||||||
|
1. Go to: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/settings/ci_cd
|
||||||
|
2. Expand "Runners"
|
||||||
|
3. Find "Available specific runners"
|
||||||
|
4. Click "Enable" for an existing runner
|
||||||
|
|
||||||
|
### Option 3: Use Shared Runners (If Available)
|
||||||
|
|
||||||
|
If your GitLab instance has shared runners:
|
||||||
|
|
||||||
|
1. Go to: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/settings/ci_cd
|
||||||
|
2. Expand "Runners"
|
||||||
|
3. Enable "Shared runners"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 After Runner is Configured
|
||||||
|
|
||||||
|
### Trigger a New Pipeline
|
||||||
|
|
||||||
|
**Option A: Push a new commit**
|
||||||
|
```bash
|
||||||
|
cd /mnt/c/Production/Source/SilverLABS/SilverDROID
|
||||||
|
echo "# Trigger pipeline" >> README.md
|
||||||
|
git add README.md
|
||||||
|
git commit -m "Trigger CI/CD pipeline with runner"
|
||||||
|
git push origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option B: Manual trigger via Web UI**
|
||||||
|
1. Go to: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/pipelines
|
||||||
|
2. Click "Run pipeline"
|
||||||
|
3. Select "main" branch
|
||||||
|
4. Click "Run pipeline"
|
||||||
|
|
||||||
|
**Option C: API trigger**
|
||||||
|
```bash
|
||||||
|
curl -X POST "https://gitlab.silverlabs.uk/api/v4/projects/10/pipeline" \
|
||||||
|
--header "PRIVATE-TOKEN: glpat-wqUcD7mg53F1mgM-N-PdiW86MQp1OjEH.01.0w074ox93" \
|
||||||
|
--data "ref=main"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Expected Pipeline Duration
|
||||||
|
|
||||||
|
Once a runner is available:
|
||||||
|
- **prepare:** ~1 minute (download dependencies)
|
||||||
|
- **test:** ~2 minutes (lint + unit tests)
|
||||||
|
- **build:** ~3-5 minutes (compile APKs)
|
||||||
|
- **deploy:** ~30 seconds (store artifacts)
|
||||||
|
|
||||||
|
**Total:** ~5-8 minutes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 What You'll Get
|
||||||
|
|
||||||
|
### Build Artifacts
|
||||||
|
|
||||||
|
Once the pipeline completes successfully:
|
||||||
|
|
||||||
|
**Debug APK:**
|
||||||
|
- Path: `app/build/outputs/apk/debug/app-debug.apk`
|
||||||
|
- Size: ~10-15 MB
|
||||||
|
- Download: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/jobs/artifacts/main/raw/app/build/outputs/apk/debug/app-debug.apk?job=build:debug
|
||||||
|
|
||||||
|
**Release APK:**
|
||||||
|
- Path: `app/build/outputs/apk/release/app-release-unsigned.apk`
|
||||||
|
- Size: ~8-10 MB
|
||||||
|
- Download: https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/jobs/artifacts/main/raw/app/build/outputs/apk/release/app-release-unsigned.apk?job=build:release
|
||||||
|
|
||||||
|
**Android App Bundle:**
|
||||||
|
- Path: `app/build/outputs/bundle/release/app-release.aab`
|
||||||
|
- Size: ~8-10 MB
|
||||||
|
- For: Google Play Store submission
|
||||||
|
|
||||||
|
### Test Reports
|
||||||
|
|
||||||
|
- **Lint Report:** HTML + XML format
|
||||||
|
- **Unit Tests:** JUnit XML format
|
||||||
|
- **Security Scan:** Dependency check report
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Current Project Status
|
||||||
|
|
||||||
|
### Git Status
|
||||||
|
- ✅ Repository initialized
|
||||||
|
- ✅ Remote configured
|
||||||
|
- ✅ Initial commit created
|
||||||
|
- ✅ Pushed to GitLab
|
||||||
|
- ✅ Project created successfully
|
||||||
|
|
||||||
|
### CI/CD Status
|
||||||
|
- ✅ `.gitlab-ci.yml` configured
|
||||||
|
- ⚠️ **Runner needed** - Pipeline waiting for executor
|
||||||
|
- ⏳ Pending first successful build
|
||||||
|
|
||||||
|
### App Status
|
||||||
|
- ✅ Android project complete
|
||||||
|
- ✅ MainActivity loads admin.dark.side
|
||||||
|
- ✅ WASM/PWA support enabled
|
||||||
|
- ✅ Glassmorphism UI implemented
|
||||||
|
- ⏳ APK needs to be built
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Immediate Action Required
|
||||||
|
|
||||||
|
**To get your APK, you must configure a GitLab Runner:**
|
||||||
|
|
||||||
|
1. **SSH into your GitLab server:**
|
||||||
|
```bash
|
||||||
|
ssh sysadmin@gitlab.silverlabs.uk
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install GitLab Runner** (if not installed):
|
||||||
|
```bash
|
||||||
|
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
|
||||||
|
sudo apt-get install gitlab-runner
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Register the runner** (see commands above)
|
||||||
|
|
||||||
|
4. **Verify runner is active:**
|
||||||
|
```bash
|
||||||
|
sudo gitlab-runner list
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Trigger a new pipeline** (see options above)
|
||||||
|
|
||||||
|
6. **Monitor the build:**
|
||||||
|
```
|
||||||
|
https://gitlab.silverlabs.uk/silverlabs/silverdroid/-/pipelines
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **Download APK** once complete
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔄 Alternative: Build Locally
|
||||||
|
|
||||||
|
If you can't configure a runner right now, build locally:
|
||||||
|
|
||||||
|
### Windows PowerShell
|
||||||
|
```powershell
|
||||||
|
cd C:\Production\Source\SilverLABS\SilverDROID
|
||||||
|
|
||||||
|
# First time: setup Gradle wrapper
|
||||||
|
# (Download gradle-8.9-bin.zip and extract, then run gradle wrapper)
|
||||||
|
|
||||||
|
# Build debug APK
|
||||||
|
.\gradlew.bat assembleDebug
|
||||||
|
|
||||||
|
# Output location
|
||||||
|
C:\Production\Source\SilverLABS\SilverDROID\app\build\outputs\apk\debug\app-debug.apk
|
||||||
|
```
|
||||||
|
|
||||||
|
### Android Studio
|
||||||
|
1. Open: `C:\Production\Source\SilverLABS\SilverDROID`
|
||||||
|
2. Wait for Gradle sync
|
||||||
|
3. Build → Build Bundle(s) / APK(s) → Build APK(s)
|
||||||
|
4. Find APK in: `app\build\outputs\apk\debug\`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📞 Support Resources
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
- **GITLAB_CICD_SETUP.md** - Complete runner setup guide
|
||||||
|
- **BUILD.md** - Local build instructions
|
||||||
|
- **QUICK_REFERENCE.md** - Command reference
|
||||||
|
|
||||||
|
### URLs
|
||||||
|
- **GitLab:** https://gitlab.silverlabs.uk
|
||||||
|
- **Project:** https://gitlab.silverlabs.uk/silverlabs/silverdroid
|
||||||
|
- **TeamCity:** https://cis1.silverlabs.uk
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
```bash
|
||||||
|
# Check runners
|
||||||
|
sudo gitlab-runner list
|
||||||
|
|
||||||
|
# Restart runner
|
||||||
|
sudo gitlab-runner restart
|
||||||
|
|
||||||
|
# View runner logs
|
||||||
|
sudo gitlab-runner --debug run
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Summary
|
||||||
|
|
||||||
|
**What's working:**
|
||||||
|
- ✅ Code pushed to GitLab successfully
|
||||||
|
- ✅ Project created and accessible
|
||||||
|
- ✅ CI/CD pipeline configured
|
||||||
|
- ✅ Complete Android app ready
|
||||||
|
|
||||||
|
**What's needed:**
|
||||||
|
- ⚠️ **GitLab Runner registration** (see above)
|
||||||
|
- ⏳ First successful pipeline run
|
||||||
|
- ⏳ APK artifacts download
|
||||||
|
|
||||||
|
**Next action:**
|
||||||
|
Configure a GitLab Runner, then re-run the pipeline to get your APK!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Status:** Ready for Runner Configuration
|
||||||
|
**Project ID:** 10
|
||||||
|
**Commit SHA:** c667765
|
||||||
|
**Created:** 2025-09-30 18:13:47
|
||||||
@@ -2,6 +2,7 @@ plugins {
|
|||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
id("org.jetbrains.kotlin.plugin.compose")
|
id("org.jetbrains.kotlin.plugin.compose")
|
||||||
|
id("org.jetbrains.kotlin.plugin.serialization") version "2.1.0"
|
||||||
id("com.google.devtools.ksp")
|
id("com.google.devtools.ksp")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,11 +11,11 @@ android {
|
|||||||
compileSdk = 35
|
compileSdk = 35
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "uk.silverlabs.silverdroid"
|
applicationId = "uk.silverlabs.appstore"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = (project.findProperty("versionCode") as String?)?.toInt() ?: 1
|
||||||
versionName = "1.0.0"
|
versionName = (project.findProperty("versionName") as String?) ?: "1.0.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
@@ -22,27 +23,19 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
|
||||||
create("release") {
|
|
||||||
// Using debug keystore for now - replace with your own keystore
|
|
||||||
storeFile = file("${System.getProperty("user.home")}/.android/debug.keystore")
|
|
||||||
storePassword = "android"
|
|
||||||
keyAlias = "androiddebugkey"
|
|
||||||
keyPassword = "android"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = true
|
// Temporarily disable minification for debugging
|
||||||
|
isMinifyEnabled = false
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
)
|
)
|
||||||
signingConfig = signingConfigs.getByName("release")
|
// Using debug signing for now - unsigned release
|
||||||
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +84,9 @@ dependencies {
|
|||||||
implementation("androidx.room:room-ktx:2.6.1")
|
implementation("androidx.room:room-ktx:2.6.1")
|
||||||
ksp("androidx.room:room-compiler:2.6.1")
|
ksp("androidx.room:room-compiler:2.6.1")
|
||||||
|
|
||||||
|
// WorkManager for background update checks
|
||||||
|
implementation("androidx.work:work-runtime-ktx:2.10.0")
|
||||||
|
|
||||||
// Coroutines
|
// Coroutines
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
|
||||||
|
|
||||||
|
|||||||
7
app/src/main/assets/config.json
Normal file
7
app/src/main/assets/config.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"appName": "SilverDesk Staging",
|
||||||
|
"appVersion": "1.0.0",
|
||||||
|
"targetUrl": "https://silverdesk-staging.silverlabs.uk/",
|
||||||
|
"showUrlBar": false,
|
||||||
|
"allowNavigation": true
|
||||||
|
}
|
||||||
@@ -7,43 +7,84 @@ import androidx.activity.enableEdgeToEdge
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import uk.silverlabs.silverdroid.config.RemoteConfigLoader
|
||||||
|
import uk.silverlabs.silverdroid.tor.TorManager
|
||||||
import uk.silverlabs.silverdroid.ui.theme.SilverDROIDTheme
|
import uk.silverlabs.silverdroid.ui.theme.SilverDROIDTheme
|
||||||
import uk.silverlabs.silverdroid.ui.webview.WasmWebView
|
import uk.silverlabs.silverdroid.ui.webview.WasmWebView
|
||||||
|
import uk.silverlabs.silverdroid.vpn.WireGuardManager
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SilverDROID - Direct Load Version
|
* SilverDROID - Configurable Android Browser
|
||||||
*
|
*
|
||||||
* This version loads https://admin.dark.side directly on launch,
|
* Loads configuration from assets/config.json to customize:
|
||||||
* bypassing the launcher screen.
|
* - Target URL and app branding
|
||||||
|
* - Optional WireGuard VPN connection
|
||||||
|
* - Optional Tor routing via Orbot
|
||||||
|
* - Custom themes and styling
|
||||||
*/
|
*/
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
// Direct load configuration
|
private lateinit var vpnManager: WireGuardManager
|
||||||
private val targetUrl = "https://admin.dark.side"
|
private lateinit var torManager: TorManager
|
||||||
private val appName = "Dark Side Admin"
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
|
|
||||||
// Load admin.dark.side directly
|
// Load configuration asynchronously with remote support
|
||||||
setContent {
|
lifecycleScope.launch {
|
||||||
SilverDROIDTheme {
|
val config = RemoteConfigLoader.loadConfigWithRemote(this@MainActivity)
|
||||||
Surface(
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
// Initialize VPN and Tor managers
|
||||||
color = MaterialTheme.colorScheme.background
|
vpnManager = WireGuardManager(this@MainActivity)
|
||||||
) {
|
torManager = TorManager(this@MainActivity)
|
||||||
WasmWebView(
|
|
||||||
url = targetUrl,
|
// Initialize Tor if configured
|
||||||
appName = appName,
|
config.tor?.let { torManager.initialize(it) }
|
||||||
onBackPressed = {
|
|
||||||
// Exit app on back press
|
setContent {
|
||||||
finish()
|
SilverDROIDTheme {
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
color = MaterialTheme.colorScheme.background
|
||||||
|
) {
|
||||||
|
// Auto-connect VPN/Tor if configured
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
config.vpn?.let { vpnConfig ->
|
||||||
|
if (vpnConfig.enabled && vpnConfig.autoConnect) {
|
||||||
|
vpnManager.connect(vpnConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.tor?.let { torConfig ->
|
||||||
|
if (torConfig.enabled && torConfig.autoConnect) {
|
||||||
|
torManager.connect()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
WasmWebView(
|
||||||
|
url = config.targetUrl,
|
||||||
|
appName = config.appName,
|
||||||
|
onBackPressed = {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
vpnManager.disconnect()
|
||||||
|
torManager.disconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package uk.silverlabs.silverdroid.config
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application configuration that can be customized per deployment
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class AppConfig(
|
||||||
|
// App branding
|
||||||
|
val appName: String = "SilverDROID",
|
||||||
|
val appVersion: String = "1.0.0",
|
||||||
|
|
||||||
|
// Target URL configuration
|
||||||
|
val targetUrl: String,
|
||||||
|
val showUrlBar: Boolean = false,
|
||||||
|
val allowNavigation: Boolean = true,
|
||||||
|
|
||||||
|
// Remote configuration
|
||||||
|
val remoteConfig: RemoteConfigSettings? = null,
|
||||||
|
|
||||||
|
// VPN configuration (optional)
|
||||||
|
val vpn: VpnConfig? = null,
|
||||||
|
|
||||||
|
// Tor configuration (optional)
|
||||||
|
val tor: TorConfig? = null,
|
||||||
|
|
||||||
|
// Theme customization
|
||||||
|
val theme: ThemeConfig = ThemeConfig()
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RemoteConfigSettings(
|
||||||
|
val enabled: Boolean = true,
|
||||||
|
val url: String,
|
||||||
|
val authToken: String? = null,
|
||||||
|
val userSpecific: Boolean = false,
|
||||||
|
val refreshInterval: Long = 3600000 // 1 hour in milliseconds
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class VpnConfig(
|
||||||
|
val enabled: Boolean = false,
|
||||||
|
val autoConnect: Boolean = true,
|
||||||
|
val privateKey: String,
|
||||||
|
val address: String,
|
||||||
|
val dns: List<String> = emptyList(),
|
||||||
|
val peers: List<PeerConfig>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class PeerConfig(
|
||||||
|
val publicKey: String,
|
||||||
|
val endpoint: String,
|
||||||
|
val allowedIps: List<String> = listOf("0.0.0.0/0"),
|
||||||
|
val persistentKeepalive: Int = 25
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TorConfig(
|
||||||
|
val enabled: Boolean = false,
|
||||||
|
val autoConnect: Boolean = true,
|
||||||
|
val useBridges: Boolean = false,
|
||||||
|
val bridges: List<String> = emptyList(),
|
||||||
|
val socksPort: Int = 9050,
|
||||||
|
val controlPort: Int = 9051
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ThemeConfig(
|
||||||
|
val primaryColor: String? = null,
|
||||||
|
val backgroundColor: String? = null,
|
||||||
|
val statusBarColor: String? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package uk.silverlabs.silverdroid.config
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads app configuration from assets/config.json
|
||||||
|
* Falls back to default configuration if file doesn't exist
|
||||||
|
*/
|
||||||
|
object ConfigLoader {
|
||||||
|
|
||||||
|
private const val CONFIG_FILE = "config.json"
|
||||||
|
|
||||||
|
private val json = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
isLenient = true
|
||||||
|
prettyPrint = true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadConfig(context: Context): AppConfig {
|
||||||
|
return try {
|
||||||
|
val configJson = context.assets.open(CONFIG_FILE).bufferedReader().use { it.readText() }
|
||||||
|
json.decodeFromString<AppConfig>(configJson)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
// File doesn't exist, return default config
|
||||||
|
getDefaultConfig()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Parsing error, log and return default
|
||||||
|
android.util.Log.e("ConfigLoader", "Error loading config", e)
|
||||||
|
getDefaultConfig()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDefaultConfig() = AppConfig(
|
||||||
|
appName = "SilverDROID",
|
||||||
|
targetUrl = "https://silverdesk-staging.silverlabs.uk/",
|
||||||
|
showUrlBar = false,
|
||||||
|
allowNavigation = true
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example configuration for reference
|
||||||
|
*/
|
||||||
|
fun getExampleConfig() = """
|
||||||
|
{
|
||||||
|
"appName": "SilverDesk Staging",
|
||||||
|
"appVersion": "1.0.0",
|
||||||
|
"targetUrl": "https://silverdesk-staging.silverlabs.uk/",
|
||||||
|
"showUrlBar": false,
|
||||||
|
"allowNavigation": true,
|
||||||
|
"vpn": {
|
||||||
|
"enabled": true,
|
||||||
|
"autoConnect": true,
|
||||||
|
"privateKey": "YOUR_PRIVATE_KEY_HERE",
|
||||||
|
"address": "10.0.0.2/24",
|
||||||
|
"dns": ["1.1.1.1", "1.0.0.1"],
|
||||||
|
"peers": [
|
||||||
|
{
|
||||||
|
"publicKey": "SERVER_PUBLIC_KEY_HERE",
|
||||||
|
"endpoint": "vpn.example.com:51820",
|
||||||
|
"allowedIps": ["0.0.0.0/0"],
|
||||||
|
"persistentKeepalive": 25
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tor": {
|
||||||
|
"enabled": false,
|
||||||
|
"autoConnect": false,
|
||||||
|
"useBridges": false,
|
||||||
|
"bridges": [],
|
||||||
|
"socksPort": 9050,
|
||||||
|
"controlPort": 9051
|
||||||
|
},
|
||||||
|
"theme": {
|
||||||
|
"primaryColor": "#1976D2",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"statusBarColor": "#1976D2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package uk.silverlabs.silverdroid.config
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
|
private const val TAG = "RemoteConfigLoader"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads configuration from remote AppStore server
|
||||||
|
*/
|
||||||
|
object RemoteConfigLoader {
|
||||||
|
|
||||||
|
private val json = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
isLenient = true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch configuration from remote URL with optional authentication
|
||||||
|
*/
|
||||||
|
suspend fun fetchConfig(
|
||||||
|
remoteSettings: RemoteConfigSettings,
|
||||||
|
userId: String? = null
|
||||||
|
): kotlin.Result<AppConfig> = withContext(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val url = buildConfigUrl(remoteSettings, userId)
|
||||||
|
Log.i(TAG, "Fetching config from: $url")
|
||||||
|
|
||||||
|
val connection = URL(url).openConnection() as HttpURLConnection
|
||||||
|
connection.requestMethod = "GET"
|
||||||
|
connection.connectTimeout = 10000
|
||||||
|
connection.readTimeout = 10000
|
||||||
|
|
||||||
|
// Add authentication if provided
|
||||||
|
remoteSettings.authToken?.let {
|
||||||
|
connection.setRequestProperty("Authorization", "Bearer $it")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add user ID if user-specific config
|
||||||
|
userId?.let {
|
||||||
|
connection.setRequestProperty("X-User-ID", it)
|
||||||
|
}
|
||||||
|
|
||||||
|
val responseCode = connection.responseCode
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
|
val response = connection.inputStream.bufferedReader().use { it.readText() }
|
||||||
|
val config = json.decodeFromString<AppConfig>(response)
|
||||||
|
|
||||||
|
Log.i(TAG, "Successfully loaded remote config for: ${config.appName}")
|
||||||
|
kotlin.Result.success(config)
|
||||||
|
} else {
|
||||||
|
val error = "HTTP $responseCode: ${connection.responseMessage}"
|
||||||
|
Log.e(TAG, "Failed to fetch config: $error")
|
||||||
|
kotlin.Result.failure(Exception(error))
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Error fetching remote config", e)
|
||||||
|
kotlin.Result.failure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun buildConfigUrl(settings: RemoteConfigSettings, userId: String?): String {
|
||||||
|
var url = settings.url
|
||||||
|
|
||||||
|
// Add user parameter if user-specific
|
||||||
|
if (settings.userSpecific && userId != null) {
|
||||||
|
url = if (url.contains("?")) {
|
||||||
|
"$url&userId=$userId"
|
||||||
|
} else {
|
||||||
|
"$url?userId=$userId"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load config with remote fallback
|
||||||
|
* 1. Try to load local config
|
||||||
|
* 2. If remote is configured, fetch from server
|
||||||
|
* 3. Merge remote with local (remote takes precedence)
|
||||||
|
*/
|
||||||
|
suspend fun loadConfigWithRemote(
|
||||||
|
context: Context,
|
||||||
|
userId: String? = null
|
||||||
|
): AppConfig {
|
||||||
|
// Load local config first
|
||||||
|
val localConfig = ConfigLoader.loadConfig(context)
|
||||||
|
|
||||||
|
// Check if remote config is enabled
|
||||||
|
val remoteSettings = localConfig.remoteConfig
|
||||||
|
if (remoteSettings == null || !remoteSettings.enabled) {
|
||||||
|
Log.i(TAG, "Remote config disabled, using local config")
|
||||||
|
return localConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch remote config
|
||||||
|
return fetchConfig(remoteSettings, userId).getOrElse { error ->
|
||||||
|
Log.w(TAG, "Remote config failed, falling back to local", error)
|
||||||
|
localConfig
|
||||||
|
}.also {
|
||||||
|
if (it != localConfig) {
|
||||||
|
Log.i(TAG, "Using remote configuration")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package uk.silverlabs.silverdroid.tor
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import uk.silverlabs.silverdroid.config.TorConfig
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages Tor connections via Orbot
|
||||||
|
* Note: Full Tor integration requires Orbot and netcipher libraries
|
||||||
|
* This is a stub for configuration support
|
||||||
|
*/
|
||||||
|
class TorManager(private val context: Context) {
|
||||||
|
|
||||||
|
private val _connectionState = MutableStateFlow(TorState.DISCONNECTED)
|
||||||
|
val connectionState: StateFlow<TorState> = _connectionState
|
||||||
|
|
||||||
|
private var torConfig: TorConfig? = null
|
||||||
|
|
||||||
|
fun initialize(config: TorConfig) {
|
||||||
|
this.torConfig = config
|
||||||
|
Log.i(TAG, "Tor configuration initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun connect(): Result<Unit> {
|
||||||
|
val config = torConfig ?: return Result.failure(Exception("Tor not configured"))
|
||||||
|
|
||||||
|
return try {
|
||||||
|
Log.i(TAG, "Tor configuration loaded")
|
||||||
|
Log.i(TAG, "SOCKS Port: ${config.socksPort}")
|
||||||
|
|
||||||
|
// TODO: Implement actual Tor/Orbot connection
|
||||||
|
_connectionState.value = TorState.CONNECTED
|
||||||
|
Log.w(TAG, "Tor stub - not actually connecting")
|
||||||
|
|
||||||
|
Result.success(Unit)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Failed to configure Tor", e)
|
||||||
|
_connectionState.value = TorState.ERROR
|
||||||
|
Result.failure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun disconnect() {
|
||||||
|
try {
|
||||||
|
_connectionState.value = TorState.DISCONNECTED
|
||||||
|
Log.i(TAG, "Tor disconnected")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Error disconnecting Tor", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSocksProxy(): String {
|
||||||
|
val config = torConfig ?: return "127.0.0.1:9050"
|
||||||
|
return "127.0.0.1:${config.socksPort}"
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "TorManager"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class TorState {
|
||||||
|
NOT_INSTALLED,
|
||||||
|
DISCONNECTED,
|
||||||
|
CONNECTING,
|
||||||
|
CONNECTED,
|
||||||
|
DISCONNECTING,
|
||||||
|
ERROR
|
||||||
|
}
|
||||||
@@ -22,7 +22,8 @@ fun WasmWebView(
|
|||||||
url: String,
|
url: String,
|
||||||
appName: String,
|
appName: String,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier,
|
||||||
|
jsInterface: AppStoreJsBridge? = null
|
||||||
) {
|
) {
|
||||||
var webView by remember { mutableStateOf<WebView?>(null) }
|
var webView by remember { mutableStateOf<WebView?>(null) }
|
||||||
var isLoading by remember { mutableStateOf(true) }
|
var isLoading by remember { mutableStateOf(true) }
|
||||||
@@ -113,7 +114,12 @@ fun WasmWebView(
|
|||||||
|
|
||||||
// User agent (modern)
|
// User agent (modern)
|
||||||
settings.userAgentString = settings.userAgentString +
|
settings.userAgentString = settings.userAgentString +
|
||||||
" SilverDROID/1.0 (PWA/WASM Launcher)"
|
" SilverAppStore/1.0 (AppStore Client)"
|
||||||
|
|
||||||
|
// Wire AppStore JS bridge so Blazor can call native install
|
||||||
|
jsInterface?.let {
|
||||||
|
addJavascriptInterface(it, AppStoreJsBridge.BRIDGE_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
// Enable wide viewport
|
// Enable wide viewport
|
||||||
settings.useWideViewPort = true
|
settings.useWideViewPort = true
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package uk.silverlabs.silverdroid.vpn
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import uk.silverlabs.silverdroid.config.VpnConfig
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages WireGuard VPN connections
|
||||||
|
* Note: Full WireGuard implementation requires native libraries
|
||||||
|
* This is a stub that logs configuration for future implementation
|
||||||
|
*/
|
||||||
|
class WireGuardManager(private val context: Context) {
|
||||||
|
|
||||||
|
private val _connectionState = MutableStateFlow(VpnState.DISCONNECTED)
|
||||||
|
val connectionState: StateFlow<VpnState> = _connectionState
|
||||||
|
|
||||||
|
suspend fun connect(vpnConfig: VpnConfig): Result<Unit> {
|
||||||
|
return try {
|
||||||
|
Log.i(TAG, "WireGuard VPN configuration loaded")
|
||||||
|
Log.i(TAG, "Address: ${vpnConfig.address}")
|
||||||
|
Log.i(TAG, "Peers: ${vpnConfig.peers.size}")
|
||||||
|
|
||||||
|
// TODO: Implement actual WireGuard connection
|
||||||
|
// For now, log that it would connect
|
||||||
|
_connectionState.value = VpnState.CONNECTED
|
||||||
|
Log.w(TAG, "WireGuard stub - not actually connecting")
|
||||||
|
|
||||||
|
Result.success(Unit)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Failed to configure VPN", e)
|
||||||
|
_connectionState.value = VpnState.ERROR
|
||||||
|
Result.failure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun disconnect() {
|
||||||
|
try {
|
||||||
|
_connectionState.value = VpnState.DISCONNECTED
|
||||||
|
Log.i(TAG, "WireGuard VPN disconnected")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Error disconnecting VPN", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "WireGuardManager"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class VpnState {
|
||||||
|
DISCONNECTED,
|
||||||
|
CONNECTING,
|
||||||
|
CONNECTED,
|
||||||
|
DISCONNECTING,
|
||||||
|
ERROR
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Dark Side Admin</string>
|
<string name="app_name">SilverSHELL AppStore</string>
|
||||||
<string name="launcher_title">Your Apps</string>
|
<string name="launcher_title">Your Apps</string>
|
||||||
<string name="add_pwa">Add App</string>
|
<string name="add_pwa">Add App</string>
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
|||||||
54
config.example.json
Normal file
54
config.example.json
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"_comment": "SilverDROID Configuration Example",
|
||||||
|
"_comment2": "Copy this file to app/src/main/assets/config.json and customize",
|
||||||
|
|
||||||
|
"appName": "SilverDesk Staging",
|
||||||
|
"appVersion": "1.0.0",
|
||||||
|
"targetUrl": "https://silverdesk-staging.silverlabs.uk/",
|
||||||
|
"showUrlBar": false,
|
||||||
|
"allowNavigation": true,
|
||||||
|
|
||||||
|
"remoteConfig": {
|
||||||
|
"_comment": "Optional remote configuration from AppStore",
|
||||||
|
"enabled": false,
|
||||||
|
"url": "https://appstore.silverlabs.uk/api/config/silverdroid",
|
||||||
|
"authToken": "YOUR_APPSTORE_TOKEN_HERE",
|
||||||
|
"userSpecific": true,
|
||||||
|
"refreshInterval": 3600000
|
||||||
|
},
|
||||||
|
|
||||||
|
"vpn": {
|
||||||
|
"_comment": "Optional WireGuard VPN configuration",
|
||||||
|
"enabled": false,
|
||||||
|
"autoConnect": true,
|
||||||
|
"privateKey": "YOUR_PRIVATE_KEY_HERE",
|
||||||
|
"address": "10.0.0.2/24",
|
||||||
|
"dns": ["1.1.1.1", "1.0.0.1"],
|
||||||
|
"peers": [
|
||||||
|
{
|
||||||
|
"publicKey": "SERVER_PUBLIC_KEY_HERE",
|
||||||
|
"endpoint": "vpn.silverlabs.uk:51820",
|
||||||
|
"allowedIps": ["0.0.0.0/0"],
|
||||||
|
"persistentKeepalive": 25
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"tor": {
|
||||||
|
"_comment": "Optional Tor routing via Orbot",
|
||||||
|
"_comment2": "Requires Orbot app to be installed",
|
||||||
|
"enabled": false,
|
||||||
|
"autoConnect": false,
|
||||||
|
"useBridges": false,
|
||||||
|
"bridges": [],
|
||||||
|
"socksPort": 9050,
|
||||||
|
"controlPort": 9051
|
||||||
|
},
|
||||||
|
|
||||||
|
"theme": {
|
||||||
|
"_comment": "Optional custom theming (hex colors)",
|
||||||
|
"primaryColor": "#1976D2",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"statusBarColor": "#1976D2"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user