Compare commits

...

13 Commits

Author SHA1 Message Date
Ian VanSchooten 4c6d9d0745 Build ios debug app, do not sign 2024-10-11 11:40:01 -04:00
Ian VanSchooten dfa0e7bd40 Fix rebase error 2024-10-11 11:39:38 -04:00
Ian VanSchooten 5ba3891eda Rename workflow 2024-10-11 11:39:38 -04:00
Ian VanSchooten 093d734094 Avoid incrementing version number 2024-10-11 11:39:38 -04:00
Ian VanSchooten cb8b44bd27 Use fastlane to build 2024-10-11 11:39:38 -04:00
Ian VanSchooten d26b25704d Add fastlane match token 2024-10-11 11:39:38 -04:00
Ian VanSchooten ed9aeff3e0 Add ios build step to ci 2024-10-11 11:39:38 -04:00
Ian VanSchooten 9f262ba5a7 Specify androidapi for gomobile 2024-10-11 11:39:38 -04:00
Ian VanSchooten 22a13b1a1c Add build workflow 2024-10-11 11:39:38 -04:00
Ian VanSchooten b2d7fe99a2 Simplify/fix dart formatting in CI 2024-10-11 11:39:38 -04:00
John Maguire 6d9bcc9ba1
Pop confirmation modal only for changed forms (#178) 2024-10-11 11:34:44 -04:00
Ian VanSchooten fcf21f6f6b
Fix issues with new xcode builds (#177)
John found an issue in gomobile that seems to be the culprit of one of these issues: https://github.com/golang/go/issues/53316#issuecomment-2407626810
2024-10-11 11:21:34 -04:00
John Maguire 998d0459ad
Fix Nebula reloading on managed update (#176) 2024-10-10 09:59:00 -04:00
11 changed files with 143 additions and 21 deletions

104
.github/workflows/smoke.yml vendored Normal file
View File

@ -0,0 +1,104 @@
# This workflow builds the iOS and Android apps, just to check they build without error
name: Smoke build
on:
push:
branches:
- main
pull_request:
jobs:
build-android:
name: Android
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: install dependencies
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build Android debug
run: flutter build appbundle --debug
build-ios:
name: iOS
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: Install the appstore connect key material
env:
AC_API_KEY_SECRET_BASE64: ${{ secrets.AC_API_KEY_SECRET_BASE64 }}
run: |
AC_API_KEY_SECRET_PATH="$RUNNER_TEMP/key.p8"
echo "APP_STORE_CONNECT_API_KEY_KEY_FILEPATH=$AC_API_KEY_SECRET_PATH" >> $GITHUB_ENV
echo -n "$AC_API_KEY_SECRET_BASE64" | base64 --decode --output "$AC_API_KEY_SECRET_PATH"
- name: Place Github token for fastlane match
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run:
echo "MATCH_GIT_BASIC_AUTHORIZATION=$(echo -n "defined-machine:${TOKEN}" | base64)" >> $GITHUB_ENV
- name: install dependencies
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build iOS
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
cd ios
pod install
fastlane checkBuild
cd -
# verify that the github token didn't make it into the output
mkdir -p build/app/test-ios
cp ios/MobileNebula.ipa build/app/test-ios
cd build/app/test-ios
unzip MobileNebula.ipa
if find . | xargs strings 2>/dev/null | grep -qF "${TOKEN}" ; then
echo "Token found in iOS build"
exit 1
fi

View File

@ -45,6 +45,7 @@ class DNUpdateWorker(ctx: Context, params: WorkerParameters) : Worker(ctx, param
// Reload Nebula if this is the currently active site
if (res == DNSiteUpdater.Result.CONFIG_UPDATED) {
Intent().also { intent ->
intent.setPackage(context.getPackageName())
intent.action = NebulaVpnService.ACTION_RELOAD
intent.putExtra("id", site.id)
context.sendBroadcast(intent)
@ -54,6 +55,7 @@ class DNUpdateWorker(ctx: Context, params: WorkerParameters) : Worker(ctx, param
// Update the UI on any change
if (res != DNSiteUpdater.Result.NOOP) {
Intent().also { intent ->
intent.setPackage(context.getPackageName())
intent.action = MainActivity.ACTION_REFRESH_SITES
context.sendBroadcast(intent)
}

View File

@ -11,6 +11,7 @@ import android.content.pm.PackageManager
import android.net.VpnService
import android.os.*
import android.util.Log
import androidx.core.content.ContextCompat
import androidx.work.*
import com.google.gson.Gson
import io.flutter.embedding.android.FlutterActivity
@ -98,12 +99,7 @@ class MainActivity: FlutterActivity() {
apiClient = APIClient(context)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(refreshReceiver, IntentFilter(ACTION_REFRESH_SITES), RECEIVER_NOT_EXPORTED)
} else {
@Suppress("UnspecifiedRegisterReceiverFlag")
registerReceiver(refreshReceiver, IntentFilter(ACTION_REFRESH_SITES))
}
ContextCompat.registerReceiver(context, refreshReceiver, IntentFilter(ACTION_REFRESH_SITES), RECEIVER_NOT_EXPORTED)
enqueueDNUpdater()
}

View File

@ -10,6 +10,7 @@ import android.net.*
import android.os.*
import android.system.OsConstants
import android.util.Log
import androidx.core.content.ContextCompat
import androidx.work.*
import mobileNebula.CIDR
import java.io.File
@ -213,12 +214,7 @@ class NebulaVpnService : VpnService() {
}
private fun registerReloadReceiver() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(reloadReceiver, IntentFilter(ACTION_RELOAD), RECEIVER_NOT_EXPORTED)
} else {
@Suppress("UnspecifiedRegisterReceiverFlag")
registerReceiver(reloadReceiver, IntentFilter(ACTION_RELOAD))
}
ContextCompat.registerReceiver(this, reloadReceiver, IntentFilter(ACTION_RELOAD), RECEIVER_NOT_EXPORTED)
}
private fun unregisterReloadReceiver() {

View File

@ -1,4 +1,5 @@
#include <stdint.h>
#include <sys/types.h>
/* <sys/kern_control.h> */
#define CTLIOCGINFO 0xc0644e03UL

View File

@ -18,6 +18,19 @@ default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :checkBuild do
build_app(
output_name: "MobileNebula.ipa",
workspace: "Runner.xcworkspace",
scheme: "Runner",
configuration: "Debug",
export_method: "development",
export_options: {
manageAppVersionAndBuildNumber: false
}
)
end
lane :build do
# Do some things like setting up a temporary keystore to host secrets in CI
setup_ci

View File

@ -39,7 +39,7 @@ class _FormPageState extends State<FormPage> {
changed = widget.changed || changed;
return PopScope<Object?>(
canPop: false,
canPop: !changed,
onPopInvokedWithResult: (bool didPop, Object? result) async {
if (didPop) {
return;

View File

@ -1,13 +1,15 @@
111MODULE = on
export GO111MODULE
unexport SWIFT_DEBUG_INFORMATION_VERSION
unexport SWIFT_DEBUG_INFORMATION_FORMAT
clean:
rm -rf mobileNebula.aar MobileNebula.xcframework
mobileNebula.aar: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile
gomobile bind -trimpath -v --target=android -androidapi 26
gomobile bind -trimpath -v --target=android -androidapi=26
MobileNebula.xcframework: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile

View File

@ -10,7 +10,7 @@ require (
github.com/DefinedNet/dnapi v0.0.0-20240611201323-4589547bd270
github.com/sirupsen/logrus v1.9.3
github.com/slackhq/nebula v1.9.3
golang.org/x/crypto v0.27.0
golang.org/x/crypto v0.28.0
gopkg.in/yaml.v2 v2.4.0
)
@ -34,13 +34,13 @@ require (
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 // indirect
github.com/vishvananda/netlink v1.2.1-beta.2 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
golang.org/x/mobile v0.0.0-20240909163608-642950227fb3 // indirect
golang.org/x/mobile v0.0.0-20241004191011-08a83c5af9f8 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/tools v0.25.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect

View File

@ -147,9 +147,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20240909163608-642950227fb3 h1:HOa20LMHFElnLsGI9j8/sxTIHpogkTuHZlyoIjl3kkw=
golang.org/x/mobile v0.0.0-20240909163608-642950227fb3/go.mod h1:5EJr05J3jS1A5hwVNxs4vC0pIRxtWmwM15D1ZxCj93s=
golang.org/x/mobile v0.0.0-20241004191011-08a83c5af9f8 h1:W8YtRRiKAvbIbqAh+xpWKecxEO8w1oaD6DrZhMyotF8=
golang.org/x/mobile v0.0.0-20241004191011-08a83c5af9f8/go.mod h1:snk1Mn2ZpdKCt90JPEsDh4sL3ReK520U2t0d7RHBnSU=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@ -167,6 +170,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -194,9 +198,11 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -207,6 +213,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=