Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
453dd2d116 | ||
|
|
a757ac7be9 |
8
.github/actions/archive/action.yml
vendored
|
|
@ -26,18 +26,18 @@ runs:
|
||||||
run: |
|
run: |
|
||||||
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
||||||
|
|
||||||
xcodebuild clean archive \
|
xcodebuild archive \
|
||||||
-allowProvisioningUpdates \
|
-allowProvisioningUpdates \
|
||||||
-allowProvisioningDeviceRegistration \
|
-allowProvisioningDeviceRegistration \
|
||||||
-skipPackagePluginValidation \
|
|
||||||
-skipMacroValidation \
|
|
||||||
-onlyUsePackageVersionsFromResolvedFile \
|
|
||||||
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
||||||
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
||||||
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
||||||
|
-onlyUsePackageVersionsFromResolvedFile \
|
||||||
-scheme '${{ inputs.scheme }}' \
|
-scheme '${{ inputs.scheme }}' \
|
||||||
-destination '${{ inputs.destination }}' \
|
-destination '${{ inputs.destination }}' \
|
||||||
-archivePath '${{ inputs.archive-path }}' \
|
-archivePath '${{ inputs.archive-path }}' \
|
||||||
-resultBundlePath BuildResults.xcresult
|
-resultBundlePath BuildResults.xcresult
|
||||||
|
|
||||||
|
./Tools/xcresulttool-github BuildResults.xcresult
|
||||||
|
|
||||||
rm -rf AuthKey_${{ inputs.app-store-key-id }}.p8
|
rm -rf AuthKey_${{ inputs.app-store-key-id }}.p8
|
||||||
|
|
|
||||||
14
.github/actions/build-for-testing/action.yml
vendored
|
|
@ -18,36 +18,32 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Xcode Cache
|
- name: Cache Swift Packages
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
Apple/PackageCache
|
Apple/PackageCache
|
||||||
Apple/SourcePackages
|
Apple/SourcePackages
|
||||||
Apple/DerivedData
|
|
||||||
key: ${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
|
key: ${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
|
|
||||||
${{ runner.os }}-${{ inputs.scheme }}-
|
${{ runner.os }}-${{ inputs.scheme }}-
|
||||||
${{ runner.os }}-
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: Apple
|
working-directory: Apple
|
||||||
run: |
|
run: |
|
||||||
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
||||||
|
|
||||||
xcodebuild build-for-testing \
|
xcodebuild clean build-for-testing \
|
||||||
-allowProvisioningUpdates \
|
-allowProvisioningUpdates \
|
||||||
-allowProvisioningDeviceRegistration \
|
-allowProvisioningDeviceRegistration \
|
||||||
-skipPackagePluginValidation \
|
|
||||||
-skipMacroValidation \
|
|
||||||
-onlyUsePackageVersionsFromResolvedFile \
|
|
||||||
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
||||||
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
||||||
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
||||||
|
-onlyUsePackageVersionsFromResolvedFile \
|
||||||
-clonedSourcePackagesDirPath SourcePackages \
|
-clonedSourcePackagesDirPath SourcePackages \
|
||||||
-packageCachePath $PWD/PackageCache \
|
-packageCachePath $PWD/PackageCache \
|
||||||
-derivedDataPath $PWD/DerivedData \
|
-skipPackagePluginValidation \
|
||||||
|
-skipMacroValidation \
|
||||||
-scheme '${{ inputs.scheme }}' \
|
-scheme '${{ inputs.scheme }}' \
|
||||||
-destination '${{ inputs.destination }}' \
|
-destination '${{ inputs.destination }}' \
|
||||||
-resultBundlePath BuildResults.xcresult
|
-resultBundlePath BuildResults.xcresult
|
||||||
|
|
|
||||||
30
.github/actions/download-profiles/action.yml
vendored
|
|
@ -1,30 +0,0 @@
|
||||||
name: Download Provisioning Profiles
|
|
||||||
inputs:
|
|
||||||
app-store-key:
|
|
||||||
description: App Store key in PEM PKCS#8 format
|
|
||||||
required: true
|
|
||||||
app-store-key-id:
|
|
||||||
description: App Store key ID
|
|
||||||
required: true
|
|
||||||
app-store-key-issuer-id:
|
|
||||||
description: App Store key issuer ID
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- shell: bash
|
|
||||||
env:
|
|
||||||
FASTLANE_OPT_OUT_USAGE: 'YES'
|
|
||||||
run: |
|
|
||||||
APP_STORE_KEY=$(echo "${{ inputs.app-store-key }}" | jq -sR .)
|
|
||||||
cat << EOF > api-key.json
|
|
||||||
{
|
|
||||||
"key_id": "${{ inputs.app-store-key-id }}",
|
|
||||||
"issuer_id": "${{ inputs.app-store-key-issuer-id }}",
|
|
||||||
"key": $APP_STORE_KEY
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fastlane sigh download_all --api_key_path api-key.json
|
|
||||||
|
|
||||||
rm -rf api-key.json
|
|
||||||
18
.github/actions/export/action.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Export
|
name: Notarize
|
||||||
inputs:
|
inputs:
|
||||||
app-store-key:
|
app-store-key:
|
||||||
description: App Store key in PEM PKCS#8 format
|
description: App Store key in PEM PKCS#8 format
|
||||||
|
|
@ -12,8 +12,11 @@ inputs:
|
||||||
archive-path:
|
archive-path:
|
||||||
description: Xcode archive path
|
description: Xcode archive path
|
||||||
required: true
|
required: true
|
||||||
export-options:
|
destination:
|
||||||
description: The export options in JSON format
|
description: The Xcode export destination. This can either be "export" or "upload"
|
||||||
|
required: true
|
||||||
|
method:
|
||||||
|
description: The Xcode export method. This can be one of app-store, validation, ad-hoc, package, enterprise, development, developer-id, or mac-application.
|
||||||
required: true
|
required: true
|
||||||
export-path:
|
export-path:
|
||||||
description: The path to export the archive to
|
description: The path to export the archive to
|
||||||
|
|
@ -21,20 +24,19 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- shell: bash
|
- id: notarize
|
||||||
|
shell: bash
|
||||||
working-directory: Apple
|
working-directory: Apple
|
||||||
run: |
|
run: |
|
||||||
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
||||||
|
|
||||||
echo '${{ inputs.export-options }}' | plutil -convert xml1 -o ExportOptions.plist -
|
echo '{"destination":"${{ inputs.destination }}","method":"${{ inputs.method }}"}' \
|
||||||
|
| plutil -convert xml1 -o ExportOptions.plist -
|
||||||
|
|
||||||
xcodebuild \
|
xcodebuild \
|
||||||
-exportArchive \
|
-exportArchive \
|
||||||
-allowProvisioningUpdates \
|
-allowProvisioningUpdates \
|
||||||
-allowProvisioningDeviceRegistration \
|
-allowProvisioningDeviceRegistration \
|
||||||
-skipPackagePluginValidation \
|
|
||||||
-skipMacroValidation \
|
|
||||||
-onlyUsePackageVersionsFromResolvedFile \
|
|
||||||
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
-authenticationKeyID ${{ inputs.app-store-key-id }} \
|
||||||
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
|
||||||
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
|
||||||
|
|
|
||||||
25
.github/actions/notarize/action.yml
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
name: Notarize
|
|
||||||
inputs:
|
|
||||||
app-store-key:
|
|
||||||
description: App Store key in PEM PKCS#8 format
|
|
||||||
required: true
|
|
||||||
app-store-key-id:
|
|
||||||
description: App Store key ID
|
|
||||||
required: true
|
|
||||||
app-store-key-issuer-id:
|
|
||||||
description: App Store key issuer ID
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- id: notarize
|
|
||||||
shell: bash
|
|
||||||
working-directory: Apple
|
|
||||||
run: |
|
|
||||||
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
|
|
||||||
|
|
||||||
ditto -c -k --keepParent Release/Burrow.app Upload.zip
|
|
||||||
xcrun notarytool submit --wait --issuer ${{ inputs.app-store-key-issuer-id }} --key-id ${{ inputs.app-store-key-id }} --key "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" Upload.zip
|
|
||||||
xcrun stapler staple Release/Burrow.app
|
|
||||||
|
|
||||||
rm -rf AuthKey_${{ inputs.app-store-key-id }}.p8 Release
|
|
||||||
|
|
@ -18,6 +18,9 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
- shell: bash
|
||||||
|
id: vars
|
||||||
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
- shell: bash
|
- shell: bash
|
||||||
working-directory: Apple
|
working-directory: Apple
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -25,10 +28,10 @@ runs:
|
||||||
-scheme '${{ inputs.scheme }}' \
|
-scheme '${{ inputs.scheme }}' \
|
||||||
-destination '${{ inputs.destination }}' \
|
-destination '${{ inputs.destination }}' \
|
||||||
${{ inputs.test-plan && '-testPlan ' }}${{ inputs.test-plan }} \
|
${{ inputs.test-plan && '-testPlan ' }}${{ inputs.test-plan }} \
|
||||||
-resultBundlePath "${{ inputs.artifact-prefix }}.xcresult"
|
-resultBundlePath "${{ inputs.artifact-prefix }}-${{ steps.vars.outputs.sha_short }}.xcresult"
|
||||||
- uses: kishikawakatsumi/xcresulttool@v1
|
- uses: kishikawakatsumi/xcresulttool@v1
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
path: Apple/${{ inputs.artifact-prefix }}.xcresult
|
path: Apple/${{ inputs.artifact-prefix }}-${{ steps.vars.outputs.sha_short }}.xcresult
|
||||||
title: ${{ inputs.check-name }}
|
title: ${{ inputs.check-name }}
|
||||||
show-passed-tests: false
|
show-passed-tests: false
|
||||||
|
|
|
||||||
10
.github/workflows/build-appimage.yml
vendored
|
|
@ -1,14 +1,8 @@
|
||||||
name: Build AppImage
|
name: Build AppImage
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
jobs:
|
jobs:
|
||||||
appimage:
|
appimage:
|
||||||
name: Build AppImage
|
name: Build AppImage
|
||||||
|
|
@ -23,7 +17,7 @@ jobs:
|
||||||
docker cp temp:/app/burrow-gtk/build-appimage/Burrow-x86_64.AppImage .
|
docker cp temp:/app/burrow-gtk/build-appimage/Burrow-x86_64.AppImage .
|
||||||
docker rm temp
|
docker rm temp
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
name: Upload to GitHub
|
|
||||||
with:
|
with:
|
||||||
name: AppImage
|
name: AppImage
|
||||||
path: Burrow-x86_64.AppImage
|
path: Burrow-x86_64.AppImage
|
||||||
|
|
||||||
|
|
|
||||||
17
.github/workflows/build-apple.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build Apple Apps
|
name: Apple Build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
@ -12,7 +12,7 @@ concurrency:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build App (${{ matrix.platform }})
|
name: Build App (${{ matrix.platform }})
|
||||||
runs-on: macos-14
|
runs-on: macos-13
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
rust-targets:
|
rust-targets:
|
||||||
- aarch64-apple-ios
|
- aarch64-apple-ios
|
||||||
- scheme: App
|
- scheme: App
|
||||||
destination: platform=iOS Simulator,OS=18.0,name=iPhone 15 Pro
|
destination: platform=iOS Simulator,OS=17.2,name=iPhone 15 Pro
|
||||||
platform: iOS Simulator
|
platform: iOS Simulator
|
||||||
sdk-name: iphonesimulator
|
sdk-name: iphonesimulator
|
||||||
rust-targets:
|
rust-targets:
|
||||||
|
|
@ -38,8 +38,7 @@ jobs:
|
||||||
- x86_64-apple-darwin
|
- x86_64-apple-darwin
|
||||||
- aarch64-apple-darwin
|
- aarch64-apple-darwin
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
|
||||||
PROTOC_PATH: /opt/homebrew/bin/protoc
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -54,10 +53,8 @@ jobs:
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
|
toolchain: stable
|
||||||
targets: ${{ join(matrix.rust-targets, ', ') }}
|
targets: ${{ join(matrix.rust-targets, ', ') }}
|
||||||
- name: Install Protobuf
|
|
||||||
shell: bash
|
|
||||||
run: brew install protobuf
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
uses: ./.github/actions/build-for-testing
|
uses: ./.github/actions/build-for-testing
|
||||||
|
|
@ -67,7 +64,7 @@ jobs:
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
||||||
- name: Run Unit Tests
|
- name: Xcode Unit Test
|
||||||
if: ${{ matrix.xcode-unit-test != '' }}
|
if: ${{ matrix.xcode-unit-test != '' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: ./.github/actions/test-without-building
|
uses: ./.github/actions/test-without-building
|
||||||
|
|
@ -77,7 +74,7 @@ jobs:
|
||||||
test-plan: ${{ matrix.xcode-unit-test }}
|
test-plan: ${{ matrix.xcode-unit-test }}
|
||||||
artifact-prefix: unit-tests-${{ matrix.sdk-name }}
|
artifact-prefix: unit-tests-${{ matrix.sdk-name }}
|
||||||
check-name: Xcode Unit Tests (${{ matrix.platform }})
|
check-name: Xcode Unit Tests (${{ matrix.platform }})
|
||||||
- name: Run UI Tests
|
- name: Xcode UI Test
|
||||||
if: ${{ matrix.xcode-ui-test != '' }}
|
if: ${{ matrix.xcode-ui-test != '' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: ./.github/actions/test-without-building
|
uses: ./.github/actions/test-without-building
|
||||||
|
|
|
||||||
4
.github/workflows/build-docker.yml
vendored
|
|
@ -6,9 +6,6 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "*"
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
|
|
@ -36,7 +33,6 @@ jobs:
|
||||||
images: ghcr.io/${{ github.repository }}
|
images: ghcr.io/${{ github.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=sha
|
type=sha
|
||||||
type=match,pattern=builds/(.*),group=1
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
|
|
|
||||||
10
.github/workflows/build-rpm.yml
vendored
|
|
@ -1,11 +1,16 @@
|
||||||
on: workflow_dispatch
|
|
||||||
name: Build RPM
|
name: Build RPM
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build RPM
|
name: Build RPM
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Install RPM
|
- name: Install RPM
|
||||||
run: cargo install cargo-generate-rpm
|
run: cargo install cargo-generate-rpm
|
||||||
|
|
@ -15,3 +20,4 @@ jobs:
|
||||||
strip -s target/release/burrow
|
strip -s target/release/burrow
|
||||||
- name: Build RPM
|
- name: Build RPM
|
||||||
run: cargo generate-rpm -p burrow
|
run: cargo generate-rpm -p burrow
|
||||||
|
|
||||||
|
|
|
||||||
23
.github/workflows/build-rust.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build Rust Crate
|
name: Rust Build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
@ -21,21 +21,15 @@ jobs:
|
||||||
- x86_64-unknown-linux-gnu
|
- x86_64-unknown-linux-gnu
|
||||||
targets:
|
targets:
|
||||||
- aarch64-unknown-linux-gnu
|
- aarch64-unknown-linux-gnu
|
||||||
- os: macos-13
|
- os: macos-12
|
||||||
platform: macOS (Intel)
|
platform: macOS
|
||||||
xcode: /Applications/Xcode_15.2.app
|
|
||||||
test-targets:
|
test-targets:
|
||||||
- x86_64-apple-darwin
|
- x86_64-apple-darwin
|
||||||
targets:
|
targets:
|
||||||
- x86_64-apple-ios
|
|
||||||
- os: macos-14
|
|
||||||
platform: macOS
|
|
||||||
xcode: /Applications/Xcode_16.0.app
|
|
||||||
test-targets:
|
|
||||||
- aarch64-apple-darwin
|
- aarch64-apple-darwin
|
||||||
targets:
|
|
||||||
- aarch64-apple-ios
|
- aarch64-apple-ios
|
||||||
- aarch64-apple-ios-sim
|
- aarch64-apple-ios-sim
|
||||||
|
- x86_64-apple-ios
|
||||||
- os: windows-2022
|
- os: windows-2022
|
||||||
platform: Windows
|
platform: Windows
|
||||||
test-targets:
|
test-targets:
|
||||||
|
|
@ -44,11 +38,10 @@ jobs:
|
||||||
- aarch64-pc-windows-msvc
|
- aarch64-pc-windows-msvc
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||||
RUST_BACKTRACE: short
|
RUST_BACKTRACE: short
|
||||||
PROTOC_VERSION: 3.25.1
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -61,14 +54,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y ${{ join(matrix.packages, ' ') }}
|
sudo apt-get install -y ${{ join(matrix.packages, ' ') }}
|
||||||
- name: Configure LLVM
|
- name: Install Windows Deps
|
||||||
if: matrix.os == 'windows-2022'
|
if: matrix.os == 'windows-2022'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH
|
run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH
|
||||||
- name: Install protoc
|
|
||||||
uses: taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: protoc@${{ env.PROTOC_VERSION }}
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
7
.github/workflows/lint-git.yml
vendored
|
|
@ -8,14 +8,13 @@ jobs:
|
||||||
name: Git Lint
|
name: Git Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Install
|
- name: Install Gitlint
|
||||||
shell: bash
|
shell: bash
|
||||||
run: python -m pip install gitlint
|
run: python -m pip install gitlint
|
||||||
- name: Lint
|
- name: Run Gitlint
|
||||||
shell: bash
|
shell: bash
|
||||||
run: gitlint --commits "${{ github.event.pull_request.base.sha }}..HEAD"
|
run: gitlint --commits "${{ github.event.pull_request.base.sha }}..HEAD"
|
||||||
|
|
|
||||||
9
.github/workflows/lint-swift.yml
vendored
|
|
@ -1,5 +1,8 @@
|
||||||
name: Swift Lint
|
name: Swift Lint
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
@ -11,6 +14,8 @@ jobs:
|
||||||
image: ghcr.io/realm/swiftlint:latest
|
image: ghcr.io/realm/swiftlint:latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: swiftlint lint --strict --reporter github-actions-logging
|
run: swiftlint lint --reporter github-actions-logging
|
||||||
|
|
|
||||||
112
.github/workflows/release-apple.yml
vendored
|
|
@ -1,119 +1,65 @@
|
||||||
name: Release (Apple)
|
name: Build Apple Release
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- created
|
- created
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.platform }} Release
|
name: Build ${{ matrix.configuration['platform'] }} Release
|
||||||
runs-on: macos-14
|
runs-on: macos-13
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
configuration:
|
||||||
- platform: iOS
|
- scheme: App (iOS)
|
||||||
rust-targets:
|
destination: generic/platform=iOS
|
||||||
- aarch64-apple-ios
|
platform: iOS
|
||||||
- platform: macOS
|
method: ad-hoc
|
||||||
rust-targets:
|
artifact-file: Apple/Release/Burrow.ipa
|
||||||
- x86_64-apple-darwin
|
- scheme: App (macOS)
|
||||||
- aarch64-apple-darwin
|
destination: generic/platform=macOS
|
||||||
|
platform: macOS
|
||||||
|
method: mac-application
|
||||||
|
artifact-file: Burrow.app.txz
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
|
||||||
PROTOC_PATH: /opt/homebrew/bin/protoc
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
submodules: recursive
|
||||||
- name: Import Certificate
|
- name: Import Certificate
|
||||||
uses: ./.github/actions/import-cert
|
uses: ./.github/actions/import-cert
|
||||||
with:
|
with:
|
||||||
certificate: ${{ secrets.DEVELOPER_CERT }}
|
certificate: ${{ secrets.DEVELOPER_CERT }}
|
||||||
password: ${{ secrets.DEVELOPER_CERT_PASSWORD }}
|
password: ${{ secrets.DEVELOPER_CERT_PASSWORD }}
|
||||||
- name: Download Provisioning Profiles
|
|
||||||
uses: ./.github/actions/download-profiles
|
|
||||||
with:
|
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
|
||||||
- name: Install Provisioning Profiles
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles/
|
|
||||||
cp -f Apple/Profiles/* ~/Library/MobileDevice/Provisioning\ Profiles/
|
|
||||||
- name: Install Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: ${{ join(matrix.rust-targets, ', ') }}
|
|
||||||
- name: Install Protobuf
|
|
||||||
shell: bash
|
|
||||||
run: brew install protobuf
|
|
||||||
- name: Configure Version
|
|
||||||
id: version
|
|
||||||
shell: bash
|
|
||||||
run: echo "BUILD_NUMBER=$(Tools/version.sh)" >> $GITHUB_OUTPUT
|
|
||||||
- name: Archive
|
- name: Archive
|
||||||
uses: ./.github/actions/archive
|
uses: ./.github/actions/archive
|
||||||
with:
|
with:
|
||||||
scheme: App
|
scheme: ${{ matrix.configuration['scheme'] }}
|
||||||
destination: generic/platform=${{ matrix.platform }}
|
destination: ${{ matrix.configuration['destination'] }}
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
||||||
archive-path: Burrow.xcarchive
|
archive-path: Burrow.xcarchive
|
||||||
- name: Export
|
- name: Export Locally
|
||||||
uses: ./.github/actions/export
|
uses: ./.github/actions/export
|
||||||
with:
|
with:
|
||||||
method: ${{ matrix.platform == 'macOS' && 'developer-id' || 'ad-hoc' }}
|
method: ${{ matrix.configuration['method'] }}
|
||||||
destination: export
|
destination: export
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
||||||
archive-path: Burrow.xcarchive
|
archive-path: Burrow.xcarchive
|
||||||
export-options: |
|
|
||||||
{"teamID":"P6PV2R9443","destination":"export","method":"developer-id","provisioningProfiles":{"com.hackclub.burrow":"Burrow Developer ID","com.hackclub.burrow.network":"Burrow Network Developer ID"},"signingCertificate":"Developer ID Application","signingStyle":"manual"}
|
|
||||||
export-path: Release
|
export-path: Release
|
||||||
- name: Notarize
|
- name: Compress
|
||||||
if: ${{ matrix.platform == 'macOS' }}
|
if: ${{ matrix.configuration['platform'] == 'macOS' }}
|
||||||
uses: ./.github/actions/notarize
|
|
||||||
with:
|
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
|
||||||
- name: Compress (iOS)
|
|
||||||
if: ${{ matrix.platform == 'iOS' }}
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: tar --options xz:compression-level=9 -C Apple/Release -cJf Burrow.app.txz ./
|
||||||
cp Apple/Release/Burrow.ipa Burrow.ipa
|
- name: Attach Artifact
|
||||||
aa archive -a lzma -b 8m -d Apple -subdir Burrow.xcarchive -o Burrow-${{ matrix.platform }}.xcarchive.aar
|
uses: SierraSoftworks/gh-releases@v1.0.6
|
||||||
rm -rf Apple/Release
|
|
||||||
- name: Compress (macOS)
|
|
||||||
if: ${{ matrix.platform == 'macOS' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
aa archive -a lzma -b 8m -d Apple/Release -subdir Burrow.app -o Burrow.app.aar
|
|
||||||
aa archive -a lzma -b 8m -d Apple -subdir Burrow.xcarchive -o Burrow-${{ matrix.platform }}.xcarchive.aar
|
|
||||||
rm -rf Apple/Release
|
|
||||||
- name: Upload to GitHub
|
|
||||||
uses: SierraSoftworks/gh-releases@v1.0.7
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
release_tag: ${{ github.ref_name }}
|
overwrite: 'false'
|
||||||
overwrite: 'true'
|
files: ${{ matrix.configuration['artifact-file'] }}
|
||||||
files: |
|
|
||||||
${{ matrix.platform == 'macOS' && 'Burrow.aap.aar' || 'Burrow.ipa' }}
|
|
||||||
Burrow-${{ matrix.platform }}.xcarchive.aar
|
|
||||||
- name: Upload to App Store Connect
|
|
||||||
if: ${{ matrix.platform == 'iOS' }}
|
|
||||||
uses: ./.github/actions/export
|
|
||||||
with:
|
|
||||||
app-store-key: ${{ secrets.APPSTORE_KEY }}
|
|
||||||
app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }}
|
|
||||||
app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }}
|
|
||||||
archive-path: Burrow.xcarchive
|
|
||||||
export-options: |
|
|
||||||
{"method": "app-store", "destination": "upload"}
|
|
||||||
export-path: Release
|
|
||||||
|
|
|
||||||
23
.github/workflows/release-if-needed.yaml
vendored
|
|
@ -1,23 +0,0 @@
|
||||||
name: Create Release If Needed
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 10 * * *'
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
jobs:
|
|
||||||
create:
|
|
||||||
name: Create Release If Needed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- shell: bash
|
|
||||||
run: |
|
|
||||||
if [[ $(Tools/version.sh status) == "dirty" ]]; then
|
|
||||||
gh workflow run release-now.yml
|
|
||||||
fi
|
|
||||||
29
.github/workflows/release-linux.yml
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
name: Release (Linux)
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- created
|
|
||||||
jobs:
|
|
||||||
appimage:
|
|
||||||
name: Build AppImage
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: docker
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Build AppImage
|
|
||||||
run: |
|
|
||||||
docker build -t appimage-builder . -f burrow-gtk/build-aux/Dockerfile
|
|
||||||
docker create --name temp appimage-builder
|
|
||||||
docker cp temp:/app/burrow-gtk/build-appimage/Burrow-x86_64.AppImage .
|
|
||||||
docker rm temp
|
|
||||||
- name: Attach Artifacts
|
|
||||||
uses: SierraSoftworks/gh-releases@v1.0.7
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
release_tag: ${{ github.ref_name }}
|
|
||||||
overwrite: "true"
|
|
||||||
files: |
|
|
||||||
Burrow-x86_64.AppImage
|
|
||||||
17
.github/workflows/release-now.yml
vendored
|
|
@ -1,17 +0,0 @@
|
||||||
name: Create Release
|
|
||||||
on: workflow_dispatch
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
jobs:
|
|
||||||
create:
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
|
||||||
name: Create Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- shell: bash
|
|
||||||
run: Tools/version.sh increment
|
|
||||||
9
.gitignore
vendored
|
|
@ -1,17 +1,8 @@
|
||||||
# Xcode
|
# Xcode
|
||||||
xcuserdata
|
xcuserdata
|
||||||
|
|
||||||
# Swift
|
|
||||||
Apple/Package/.swiftpm/
|
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
target/
|
target/
|
||||||
.env
|
|
||||||
|
|
||||||
.DS_STORE
|
.DS_STORE
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
tmp/
|
|
||||||
|
|
||||||
*.db
|
|
||||||
*.sock
|
|
||||||
|
|
@ -30,6 +30,7 @@ opt_in_rules:
|
||||||
- function_default_parameter_at_end
|
- function_default_parameter_at_end
|
||||||
- ibinspectable_in_extension
|
- ibinspectable_in_extension
|
||||||
- identical_operands
|
- identical_operands
|
||||||
|
- implicitly_unwrapped_optional
|
||||||
- indentation_width
|
- indentation_width
|
||||||
- joined_default_parameter
|
- joined_default_parameter
|
||||||
- last_where
|
- last_where
|
||||||
|
|
|
||||||
20
.vscode/settings.json
vendored
|
|
@ -8,19 +8,11 @@
|
||||||
"editor.acceptSuggestionOnEnter": "on",
|
"editor.acceptSuggestionOnEnter": "on",
|
||||||
"rust-analyzer.restartServerOnConfigChange": true,
|
"rust-analyzer.restartServerOnConfigChange": true,
|
||||||
"rust-analyzer.cargo.features": "all",
|
"rust-analyzer.cargo.features": "all",
|
||||||
"rust-analyzer.rustfmt.extraArgs": ["+nightly"],
|
"rust-analyzer.rustfmt.extraArgs": [
|
||||||
"[rust]": {
|
"+nightly"
|
||||||
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
|
||||||
},
|
|
||||||
"rust-analyzer.inlayHints.typeHints.enable": false,
|
|
||||||
"rust-analyzer.linkedProjects": [
|
|
||||||
"./burrow/Cargo.toml"
|
|
||||||
],
|
],
|
||||||
"[yaml]": {
|
"[rust]": {
|
||||||
"editor.insertSpaces": true,
|
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||||
"editor.tabSize": 2,
|
},
|
||||||
"editor.autoIndent": "advanced",
|
"rust-analyzer.inlayHints.typeHints.enable": false
|
||||||
"diffEditor.ignoreTrimWhitespace": false,
|
|
||||||
"editor.formatOnSave": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,11 +2,6 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.developer.associated-domains</key>
|
|
||||||
<array>
|
|
||||||
<string>applinks:burrow.rs?mode=developer</string>
|
|
||||||
<string>webcredentials:burrow.rs?mode=developer</string>
|
|
||||||
</array>
|
|
||||||
<key>com.apple.developer.networking.networkextension</key>
|
<key>com.apple.developer.networking.networkextension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>packet-tunnel-provider</string>
|
<string>packet-tunnel-provider</string>
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,6 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.developer.associated-domains</key>
|
|
||||||
<array>
|
|
||||||
<string>applinks:burrow.rs?mode=developer</string>
|
|
||||||
<string>webcredentials:burrow.rs?mode=developer</string>
|
|
||||||
</array>
|
|
||||||
<key>com.apple.developer.networking.networkextension</key>
|
<key>com.apple.developer.networking.networkextension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>packet-tunnel-provider</string>
|
<string>packet-tunnel-provider</string>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
import AppKit
|
import AppKit
|
||||||
import BurrowUI
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@main
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
@NSApplicationMain
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
private let quitItem: NSMenuItem = {
|
private let quitItem: NSMenuItem = {
|
||||||
let quitItem = NSMenuItem(
|
let quitItem = NSMenuItem(
|
||||||
|
|
|
||||||
63
Apple/App/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "16x16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "16x16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "32x32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "32x32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "128x128"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "128x128"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "256x256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "256x256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "512x512"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
|
@ -1,7 +1,6 @@
|
||||||
#if !os(macOS)
|
|
||||||
import BurrowUI
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
@MainActor
|
@MainActor
|
||||||
@main
|
@main
|
||||||
struct BurrowApp: App {
|
struct BurrowApp: App {
|
||||||
|
|
|
||||||
26
Apple/App/BurrowView.swift
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct BurrowView: View {
|
||||||
|
var body: some View {
|
||||||
|
NavigationStack {
|
||||||
|
VStack {
|
||||||
|
NetworkCarouselView()
|
||||||
|
Spacer()
|
||||||
|
TunnelStatusView()
|
||||||
|
TunnelButton()
|
||||||
|
.padding(.bottom)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.navigationTitle("Networks")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
struct NetworkView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
BurrowView()
|
||||||
|
.environment(\.tunnel, PreviewTunnel())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23091" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23091"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22689"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
public struct MenuItemToggleView: View {
|
struct MenuItemToggleView: View {
|
||||||
@Environment(\.tunnel)
|
@Environment(\.tunnel)
|
||||||
var tunnel: Tunnel
|
var tunnel: Tunnel
|
||||||
|
|
||||||
public var body: some View {
|
var body: some View {
|
||||||
HStack {
|
HStack {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text("Burrow")
|
Text("Burrow")
|
||||||
|
|
@ -30,13 +30,10 @@ public struct MenuItemToggleView: View {
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.frame(minWidth: 300, minHeight: 32, maxHeight: 32)
|
.frame(minWidth: 300, minHeight: 32, maxHeight: 32)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Tunnel {
|
extension Tunnel {
|
||||||
@MainActor fileprivate var toggleDisabled: Bool {
|
fileprivate var toggleDisabled: Bool {
|
||||||
switch status {
|
switch status {
|
||||||
case .disconnected, .permissionRequired, .connected, .disconnecting:
|
case .disconnected, .permissionRequired, .connected, .disconnecting:
|
||||||
false
|
false
|
||||||
|
|
@ -45,7 +42,7 @@ extension Tunnel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor var toggleIsOn: Binding<Bool> {
|
var toggleIsOn: Binding<Bool> {
|
||||||
Binding {
|
Binding {
|
||||||
switch status {
|
switch status {
|
||||||
case .connecting, .reasserting, .connected:
|
case .connecting, .reasserting, .connected:
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import NetworkExtension
|
import NetworkExtension
|
||||||
|
|
||||||
extension NEVPNManager: @unchecked @retroactive Sendable {
|
extension NEVPNManager {
|
||||||
func remove() async throws {
|
func remove() async throws {
|
||||||
_ = try await withUnsafeThrowingContinuation { continuation in
|
_ = try await withUnsafeThrowingContinuation { continuation in
|
||||||
removeFromPreferences(completionHandler: completion(continuation))
|
removeFromPreferences(completionHandler: completion(continuation))
|
||||||
|
|
@ -14,7 +14,7 @@ extension NEVPNManager: @unchecked @retroactive Sendable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NETunnelProviderManager: @unchecked @retroactive Sendable {
|
extension NETunnelProviderManager {
|
||||||
class var managers: [NETunnelProviderManager] {
|
class var managers: [NETunnelProviderManager] {
|
||||||
get async throws {
|
get async throws {
|
||||||
try await withUnsafeThrowingContinuation { continuation in
|
try await withUnsafeThrowingContinuation { continuation in
|
||||||
|
|
@ -34,7 +34,7 @@ private func completion(_ continuation: UnsafeContinuation<Void, Error>) -> (Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func completion<T: Sendable>(_ continuation: UnsafeContinuation<T, Error>) -> (T?, Error?) -> Void {
|
private func completion<T>(_ continuation: UnsafeContinuation<T, Error>) -> (T?, Error?) -> Void {
|
||||||
return { value, error in
|
return { value, error in
|
||||||
if let error {
|
if let error {
|
||||||
continuation.resume(throwing: error)
|
continuation.resume(throwing: error)
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
import BurrowCore
|
import BurrowShared
|
||||||
import NetworkExtension
|
import NetworkExtension
|
||||||
|
|
||||||
@Observable
|
@Observable
|
||||||
public final class NetworkExtensionTunnel: Tunnel {
|
class NetworkExtensionTunnel: Tunnel {
|
||||||
@MainActor public private(set) var status: TunnelStatus = .unknown
|
@MainActor private(set) var status: TunnelStatus = .unknown
|
||||||
@MainActor private var error: NEVPNError?
|
private var error: NEVPNError?
|
||||||
|
|
||||||
private let logger = Logger.logger(for: Tunnel.self)
|
private let logger = Logger.logger(for: Tunnel.self)
|
||||||
private let bundleIdentifier: String
|
private let bundleIdentifier: String
|
||||||
private let configurationChanged: Task<Void, Error>
|
private var tasks: [Task<Void, Error>] = []
|
||||||
private let statusChanged: Task<Void, Error>
|
|
||||||
|
|
||||||
// Each manager corresponds to one entry in the Settings app.
|
// Each manager corresponds to one entry in the Settings app.
|
||||||
// Our goal is to maintain a single manager, so we create one if none exist and delete any extra.
|
// Our goal is to maintain a single manager, so we create one if none exist and delete any extra.
|
||||||
@MainActor private var managers: [NEVPNManager]? {
|
private var managers: [NEVPNManager]? {
|
||||||
didSet { Task { await updateStatus() } }
|
didSet { Task { await updateStatus() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor private var currentStatus: TunnelStatus {
|
private var currentStatus: TunnelStatus {
|
||||||
guard let managers = managers else {
|
guard let managers = managers else {
|
||||||
guard let error = error else {
|
guard let error = error else {
|
||||||
return .unknown
|
return .unknown
|
||||||
|
|
@ -42,40 +41,35 @@ public final class NetworkExtensionTunnel: Tunnel {
|
||||||
return manager.connection.tunnelStatus
|
return manager.connection.tunnelStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(bundleIdentifier: String) {
|
convenience init() {
|
||||||
|
self.init(Constants.networkExtensionBundleIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
init(_ bundleIdentifier: String) {
|
||||||
self.bundleIdentifier = bundleIdentifier
|
self.bundleIdentifier = bundleIdentifier
|
||||||
|
|
||||||
let center = NotificationCenter.default
|
let center = NotificationCenter.default
|
||||||
let tunnel: OSAllocatedUnfairLock<NetworkExtensionTunnel?> = .init(initialState: .none)
|
let configurationChanged = Task { [weak self] in
|
||||||
configurationChanged = Task {
|
for try await _ in center.notifications(named: .NEVPNConfigurationChange).map({ _ in () }) {
|
||||||
for try await _ in center.notifications(named: .NEVPNConfigurationChange) {
|
await self?.update()
|
||||||
try Task.checkCancellation()
|
|
||||||
await tunnel.withLock { $0 }?.update()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusChanged = Task {
|
let statusChanged = Task { [weak self] in
|
||||||
for try await _ in center.notifications(named: .NEVPNStatusDidChange) {
|
for try await _ in center.notifications(named: .NEVPNStatusDidChange).map({ _ in () }) {
|
||||||
try Task.checkCancellation()
|
await self?.updateStatus()
|
||||||
await tunnel.withLock { $0 }?.updateStatus()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tunnel.withLock { $0 = self }
|
tasks = [configurationChanged, statusChanged]
|
||||||
|
|
||||||
Task { await update() }
|
Task { await update() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private func update() async {
|
private func update() async {
|
||||||
do {
|
do {
|
||||||
let result = try await NETunnelProviderManager.managers
|
managers = try await NETunnelProviderManager.managers
|
||||||
await MainActor.run {
|
|
||||||
managers = result
|
|
||||||
status = currentStatus
|
|
||||||
}
|
|
||||||
await self.updateStatus()
|
await self.updateStatus()
|
||||||
} catch let vpnError as NEVPNError {
|
} catch let vpnError as NEVPNError {
|
||||||
await MainActor.run {
|
|
||||||
error = vpnError
|
error = vpnError
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to update VPN configurations: \(error)")
|
logger.error("Failed to update VPN configurations: \(error)")
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +82,12 @@ public final class NetworkExtensionTunnel: Tunnel {
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure() async throws {
|
func configure() async throws {
|
||||||
let managers = try await NETunnelProviderManager.managers
|
if managers == nil {
|
||||||
|
await update()
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let managers = managers else { return }
|
||||||
|
|
||||||
if managers.count > 1 {
|
if managers.count > 1 {
|
||||||
try await withThrowingTaskGroup(of: Void.self, returning: Void.self) { group in
|
try await withThrowingTaskGroup(of: Void.self, returning: Void.self) { group in
|
||||||
for manager in managers.suffix(from: 1) {
|
for manager in managers.suffix(from: 1) {
|
||||||
|
|
@ -111,9 +110,9 @@ public final class NetworkExtensionTunnel: Tunnel {
|
||||||
try await manager.save()
|
try await manager.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func start() {
|
func start() {
|
||||||
|
guard let manager = managers?.first else { return }
|
||||||
Task {
|
Task {
|
||||||
guard let manager = try await NETunnelProviderManager.managers.first else { return }
|
|
||||||
do {
|
do {
|
||||||
if !manager.isEnabled {
|
if !manager.isEnabled {
|
||||||
manager.isEnabled = true
|
manager.isEnabled = true
|
||||||
|
|
@ -126,14 +125,12 @@ public final class NetworkExtensionTunnel: Tunnel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func stop() {
|
func stop() {
|
||||||
Task {
|
guard let manager = managers?.first else { return }
|
||||||
guard let manager = try await NETunnelProviderManager.managers.first else { return }
|
|
||||||
manager.connection.stopVPNTunnel()
|
manager.connection.stopVPNTunnel()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func enable() {
|
func enable() {
|
||||||
Task {
|
Task {
|
||||||
do {
|
do {
|
||||||
try await configure()
|
try await configure()
|
||||||
|
|
@ -144,8 +141,7 @@ public final class NetworkExtensionTunnel: Tunnel {
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
configurationChanged.cancel()
|
tasks.forEach { $0.cancel() }
|
||||||
statusChanged.cancel()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
88
Apple/App/NetworkView.swift
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct NetworkView<Content: View>: View {
|
||||||
|
var color: Color
|
||||||
|
var content: () -> Content
|
||||||
|
|
||||||
|
private var gradient: LinearGradient {
|
||||||
|
LinearGradient(
|
||||||
|
colors: [
|
||||||
|
color.opacity(0.8),
|
||||||
|
color
|
||||||
|
],
|
||||||
|
startPoint: .init(x: 0.2, y: 0),
|
||||||
|
endPoint: .init(x: 0.8, y: 1)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
content()
|
||||||
|
.frame(maxWidth: .infinity, minHeight: 175, maxHeight: 175)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.fill(gradient)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.fill(.white)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.shadow(color: .black.opacity(0.1), radius: 3.0, x: 0, y: 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AddNetworkView: View {
|
||||||
|
var body: some View {
|
||||||
|
Text("Add Network")
|
||||||
|
.frame(maxWidth: .infinity, minHeight: 175, maxHeight: 175)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.stroke(style: .init(lineWidth: 2, dash: [6]))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NetworkView where Content == AnyView {
|
||||||
|
init(network: any Network) {
|
||||||
|
color = network.backgroundColor
|
||||||
|
content = { AnyView(network.label) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NetworkCarouselView: View {
|
||||||
|
var networks: [any Network] = [
|
||||||
|
HackClub(id: "1"),
|
||||||
|
HackClub(id: "2"),
|
||||||
|
WireGuard(id: "4"),
|
||||||
|
HackClub(id: "5"),
|
||||||
|
]
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ScrollView(.horizontal) {
|
||||||
|
LazyHStack {
|
||||||
|
ForEach(networks, id: \.id) { network in
|
||||||
|
NetworkView(network: network)
|
||||||
|
.containerRelativeFrame(.horizontal, count: 10, span: 7, spacing: 0, alignment: .center)
|
||||||
|
.scrollTransition(.interactive, axis: .horizontal) { content, phase in
|
||||||
|
content
|
||||||
|
.scaleEffect(1.0 - abs(phase.value) * 0.1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AddNetworkView()
|
||||||
|
}
|
||||||
|
.scrollTargetLayout()
|
||||||
|
}
|
||||||
|
.scrollClipDisabled()
|
||||||
|
.scrollIndicators(.hidden)
|
||||||
|
.defaultScrollAnchor(.center)
|
||||||
|
.scrollTargetBehavior(.viewAligned)
|
||||||
|
.containerRelativeFrame(.horizontal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
struct NetworkCarouselView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
NetworkCarouselView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
import BurrowCore
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct HackClub: Network {
|
struct HackClub: Network {
|
||||||
typealias NetworkType = Burrow_WireGuardNetwork
|
var id: String
|
||||||
static let type: Burrow_NetworkType = .hackClub
|
|
||||||
|
|
||||||
var id: Int32
|
|
||||||
var backgroundColor: Color { .init("HackClub") }
|
var backgroundColor: Color { .init("HackClub") }
|
||||||
|
|
||||||
@MainActor var label: some View {
|
var label: some View {
|
||||||
GeometryReader { reader in
|
GeometryReader { reader in
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Image("HackClub")
|
Image("HackClub")
|
||||||
10
Apple/App/Networks/Network.swift
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
protocol Network {
|
||||||
|
associatedtype Label: View
|
||||||
|
|
||||||
|
var id: String { get }
|
||||||
|
var backgroundColor: Color { get }
|
||||||
|
|
||||||
|
var label: Label { get }
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
import BurrowCore
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct WireGuard: Network {
|
struct WireGuard: Network {
|
||||||
typealias NetworkType = Burrow_WireGuardNetwork
|
var id: String
|
||||||
static let type: BurrowCore.Burrow_NetworkType = .wireGuard
|
|
||||||
|
|
||||||
var id: Int32
|
|
||||||
var backgroundColor: Color { .init("WireGuard") }
|
var backgroundColor: Color { .init("WireGuard") }
|
||||||
|
|
||||||
@MainActor var label: some View {
|
var label: some View {
|
||||||
GeometryReader { reader in
|
GeometryReader { reader in
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
HStack {
|
HStack {
|
||||||
50
Apple/App/Tunnel.swift
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
protocol Tunnel {
|
||||||
|
var status: TunnelStatus { get }
|
||||||
|
|
||||||
|
func start()
|
||||||
|
func stop()
|
||||||
|
func enable()
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TunnelStatus: Equatable, Hashable {
|
||||||
|
case unknown
|
||||||
|
case permissionRequired
|
||||||
|
case disabled
|
||||||
|
case connecting
|
||||||
|
case connected(Date)
|
||||||
|
case disconnecting
|
||||||
|
case disconnected
|
||||||
|
case reasserting
|
||||||
|
case invalid
|
||||||
|
case configurationReadWriteFailed
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TunnelKey: EnvironmentKey {
|
||||||
|
static let defaultValue: any Tunnel = NetworkExtensionTunnel()
|
||||||
|
}
|
||||||
|
|
||||||
|
extension EnvironmentValues {
|
||||||
|
var tunnel: any Tunnel {
|
||||||
|
get { self[TunnelKey.self] }
|
||||||
|
set { self[TunnelKey.self] = newValue }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
@Observable
|
||||||
|
class PreviewTunnel: Tunnel {
|
||||||
|
var status: TunnelStatus = .permissionRequired
|
||||||
|
|
||||||
|
func start() {
|
||||||
|
status = .connected(.now)
|
||||||
|
}
|
||||||
|
func stop() {
|
||||||
|
status = .disconnected
|
||||||
|
}
|
||||||
|
func enable() {
|
||||||
|
status = .disconnected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -4,24 +4,21 @@ struct TunnelButton: View {
|
||||||
@Environment(\.tunnel)
|
@Environment(\.tunnel)
|
||||||
var tunnel: any Tunnel
|
var tunnel: any Tunnel
|
||||||
|
|
||||||
private var action: Action? { tunnel.action }
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
if let action = tunnel.action {
|
||||||
Button {
|
Button {
|
||||||
if let action {
|
|
||||||
tunnel.perform(action)
|
tunnel.perform(action)
|
||||||
}
|
|
||||||
} label: {
|
} label: {
|
||||||
Text(action.description)
|
Text(action.description)
|
||||||
}
|
}
|
||||||
.disabled(action.isDisabled)
|
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.buttonStyle(.floating)
|
.buttonStyle(.floating)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension Tunnel {
|
extension Tunnel {
|
||||||
@MainActor fileprivate var action: TunnelButton.Action? {
|
fileprivate var action: TunnelButton.Action? {
|
||||||
switch status {
|
switch status {
|
||||||
case .permissionRequired, .invalid:
|
case .permissionRequired, .invalid:
|
||||||
.enable
|
.enable
|
||||||
|
|
@ -43,21 +40,12 @@ extension TunnelButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TunnelButton.Action? {
|
extension TunnelButton.Action {
|
||||||
var description: LocalizedStringKey {
|
var description: LocalizedStringKey {
|
||||||
switch self {
|
switch self {
|
||||||
case .enable: "Enable"
|
case .enable: "Enable"
|
||||||
case .start: "Start"
|
case .start: "Start"
|
||||||
case .stop: "Stop"
|
case .stop: "Stop"
|
||||||
case .none: "Start"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var isDisabled: Bool {
|
|
||||||
if case .none = self {
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ struct TunnelStatusView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TunnelStatus: CustomStringConvertible {
|
extension TunnelStatus: CustomStringConvertible {
|
||||||
public var description: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .unknown:
|
case .unknown:
|
||||||
"Unknown"
|
"Unknown"
|
||||||
|
|
@ -1,123 +1,86 @@
|
||||||
{
|
{
|
||||||
"originHash" : "fa512b990383b7e309c5854a5279817052294a8191a6d3c55c49cfb38e88c0c3",
|
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "grpc-swift",
|
"identity" : "collectionconcurrencykit",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/grpc/grpc-swift.git",
|
"location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "6a90b7e77e29f9bda6c2b3a4165a40d6c02cfda1",
|
"revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
|
||||||
"version" : "1.23.0"
|
"version" : "0.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-async-algorithms",
|
"identity" : "cryptoswift",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-async-algorithms.git",
|
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "6ae9a051f76b81cc668305ceed5b0e0a7fd93d20",
|
"revision" : "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c",
|
||||||
"version" : "1.0.1"
|
"version" : "1.8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-atomics",
|
"identity" : "sourcekitten",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-atomics.git",
|
"location" : "https://github.com/jpsim/SourceKitten.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
|
"revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
|
||||||
"version" : "1.2.0"
|
"version" : "0.34.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-collections",
|
"identity" : "swift-argument-parser",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-collections.git",
|
"location" : "https://github.com/apple/swift-argument-parser.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "9bf03ff58ce34478e66aaee630e491823326fd06",
|
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
|
||||||
"version" : "1.1.3"
|
"version" : "1.2.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-http-types",
|
"identity" : "swift-syntax",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-http-types",
|
"location" : "https://github.com/apple/swift-syntax.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "ae67c8178eb46944fd85e4dc6dd970e1f3ed6ccd",
|
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
|
||||||
"version" : "1.3.0"
|
"version" : "509.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-log",
|
"identity" : "swiftlint",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-log.git",
|
"location" : "https://github.com/realm/SwiftLint.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
|
"branch" : "main",
|
||||||
"version" : "1.6.1"
|
"revision" : "7595ad3fafc1a31086dc40ba01fd898bf6b42d5f"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-nio",
|
"identity" : "swiftytexttable",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-nio.git",
|
"location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "9746cf80e29edfef2a39924a66731249223f42a3",
|
"revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
|
||||||
"version" : "2.72.0"
|
"version" : "0.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-nio-extras",
|
"identity" : "swxmlhash",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-nio-extras.git",
|
"location" : "https://github.com/drmohundro/SWXMLHash.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "d1ead62745cc3269e482f1c51f27608057174379",
|
"revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
|
||||||
"version" : "1.24.0"
|
"version" : "7.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-nio-http2",
|
"identity" : "yams",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-nio-http2.git",
|
"location" : "https://github.com/jpsim/Yams.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "b5f7062b60e4add1e8c343ba4eb8da2e324b3a94",
|
"revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
|
||||||
"version" : "1.34.0"
|
"version" : "5.0.6"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"identity" : "swift-nio-ssl",
|
|
||||||
"kind" : "remoteSourceControl",
|
|
||||||
"location" : "https://github.com/apple/swift-nio-ssl.git",
|
|
||||||
"state" : {
|
|
||||||
"revision" : "7b84abbdcef69cc3be6573ac12440220789dcd69",
|
|
||||||
"version" : "2.27.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"identity" : "swift-nio-transport-services",
|
|
||||||
"kind" : "remoteSourceControl",
|
|
||||||
"location" : "https://github.com/apple/swift-nio-transport-services.git",
|
|
||||||
"state" : {
|
|
||||||
"revision" : "38ac8221dd20674682148d6451367f89c2652980",
|
|
||||||
"version" : "1.21.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"identity" : "swift-protobuf",
|
|
||||||
"kind" : "remoteSourceControl",
|
|
||||||
"location" : "https://github.com/apple/swift-protobuf.git",
|
|
||||||
"state" : {
|
|
||||||
"revision" : "edb6ed4919f7756157fe02f2552b7e3850a538e5",
|
|
||||||
"version" : "1.28.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"identity" : "swift-system",
|
|
||||||
"kind" : "remoteSourceControl",
|
|
||||||
"location" : "https://github.com/apple/swift-system.git",
|
|
||||||
"state" : {
|
|
||||||
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
|
|
||||||
"version" : "1.3.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version" : 3
|
"version" : 2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1600"
|
LastUpgradeVersion = "1520"
|
||||||
version = "1.7">
|
version = "1.7">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES"
|
buildImplicitDependencies = "YES">
|
||||||
buildArchitectures = "Automatic">
|
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry
|
<BuildActionEntry
|
||||||
buildForTesting = "YES"
|
buildForTesting = "YES"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1600"
|
LastUpgradeVersion = "1520"
|
||||||
wasCreatedForAppExtension = "YES"
|
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES"
|
buildImplicitDependencies = "YES">
|
||||||
buildArchitectures = "Automatic">
|
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry
|
<BuildActionEntry
|
||||||
buildForTesting = "YES"
|
buildForTesting = "YES"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
LD_EXPORT_SYMBOLS = NO
|
|
||||||
SKIP_INSTALL = NO
|
SKIP_INSTALL = NO
|
||||||
|
MERGED_BINARY_TYPE = manual
|
||||||
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
|
LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks
|
||||||
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks
|
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks
|
||||||
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor
|
||||||
|
|
||||||
|
ENABLE_PREVIEWS = YES
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,61 @@
|
||||||
#include "Identity.xcconfig"
|
#include "Identity.xcconfig"
|
||||||
#include "Debug.xcconfig"
|
|
||||||
#include "Version.xcconfig"
|
|
||||||
|
|
||||||
SDKROOT = auto
|
SDKROOT = auto
|
||||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES
|
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES
|
||||||
|
|
||||||
SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx
|
SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx
|
||||||
SWIFT_VERSION = 6.0
|
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0
|
||||||
MACOSX_DEPLOYMENT_TARGET = 14.0
|
MACOSX_DEPLOYMENT_TARGET = 14.0
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO
|
||||||
SUPPORTS_MACCATALYST = NO
|
SUPPORTS_MACCATALYST = NO
|
||||||
|
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO
|
||||||
PRODUCT_NAME = $(TARGET_NAME:c99extidentifier)
|
PRODUCT_NAME = $(TARGET_NAME:c99extidentifier)
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_IDENTIFIER).$(PRODUCT_NAME)
|
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_IDENTIFIER).$(PRODUCT_NAME)
|
||||||
|
CURRENT_PROJECT_VERSION = 1
|
||||||
MARKETING_VERSION = 0.1
|
MARKETING_VERSION = 0.1
|
||||||
|
|
||||||
SKIP_INSTALL = YES
|
SKIP_INSTALL = YES
|
||||||
|
|
||||||
CODE_SIGN_IDENTITY = Apple Development
|
CODE_SIGN_IDENTITY = Apple Development
|
||||||
|
|
||||||
GENERATE_INFOPLIST_FILE = YES
|
|
||||||
INFOPLIST_FILE = Configuration/Info.plist
|
INFOPLIST_FILE = Configuration/Info.plist
|
||||||
|
GENERATE_INFOPLIST_FILE = YES
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = Copyright © 2023-2024 Hack Club
|
INFOPLIST_KEY_NSHumanReadableCopyright = Copyright © 2023-2024 Hack Club
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = Burrow
|
INFOPLIST_KEY_CFBundleDisplayName = Burrow
|
||||||
|
|
||||||
ENABLE_APP_SANDBOX[sdk=macosx*] = YES
|
|
||||||
|
|
||||||
ENABLE_BITCODE = NO
|
ENABLE_BITCODE = NO
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO
|
|
||||||
|
ENABLE_APP_SANDBOX[sdk=macosx*] = YES
|
||||||
|
ENABLE_HARDENED_RUNTIME[sdk=macosx*] = YES
|
||||||
COMBINE_HIDPI_IMAGES = YES
|
COMBINE_HIDPI_IMAGES = YES
|
||||||
EAGER_LINKING = YES
|
COPY_PHASE_STRIP = NO
|
||||||
|
|
||||||
FUSE_BUILD_SCRIPT_PHASES = YES
|
FUSE_BUILD_SCRIPT_PHASES = YES
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES
|
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES
|
|
||||||
ENABLE_DEBUG_DYLIB = NO
|
|
||||||
|
|
||||||
APP_GROUP_IDENTIFIER = group.$(APP_BUNDLE_IDENTIFIER)
|
APP_GROUP_IDENTIFIER = group.$(APP_BUNDLE_IDENTIFIER)
|
||||||
APP_GROUP_IDENTIFIER[sdk=macosx*] = $(DEVELOPMENT_TEAM).$(APP_BUNDLE_IDENTIFIER)
|
APP_GROUP_IDENTIFIER[sdk=macosx*] = $(DEVELOPMENT_TEAM).$(APP_BUNDLE_IDENTIFIER)
|
||||||
NETWORK_EXTENSION_BUNDLE_IDENTIFIER = $(APP_BUNDLE_IDENTIFIER).network
|
NETWORK_EXTENSION_BUNDLE_IDENTIFIER = $(APP_BUNDLE_IDENTIFIER).network
|
||||||
|
|
||||||
// https://github.com/grpc/grpc-swift/issues/683#issuecomment-1130118953
|
// Swift
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/CNIOAtomics.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/CNIODarwin.modulemap -Xcc -fmodule-map-file=$(GENERATED_MODULEMAP_DIR)/CGRPCZlib.modulemap
|
SWIFT_VERSION = 5.0
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES
|
||||||
|
|
||||||
|
// Release
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = -Osize
|
||||||
|
LLVM_LTO = YES
|
||||||
|
DEAD_CODE_STRIPPING = YES
|
||||||
|
VALIDATE_PRODUCT = YES
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
ONLY_ACTIVE_ARCH[config=Debug] = YES
|
||||||
|
DEBUG_INFORMATION_FORMAT[config=Debug] = dwarf
|
||||||
|
ENABLE_TESTABILITY[config=Debug] = YES
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Debug] = DEBUG
|
||||||
|
SWIFT_COMPILATION_MODE[config=Debug] = singlefile
|
||||||
|
LLVM_LTO[config=Debug] = NO
|
||||||
|
DEAD_CODE_STRIPPING[config=Debug] = NO
|
||||||
|
VALIDATE_PRODUCT[config=Debug] = NO
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
@_implementationOnly import CConstants
|
|
||||||
import OSLog
|
|
||||||
|
|
||||||
public enum Constants {
|
|
||||||
enum Error: Swift.Error {
|
|
||||||
case invalidAppGroupIdentifier
|
|
||||||
}
|
|
||||||
|
|
||||||
public static let bundleIdentifier = AppBundleIdentifier
|
|
||||||
public static let appGroupIdentifier = AppGroupIdentifier
|
|
||||||
public static let networkExtensionBundleIdentifier = NetworkExtensionBundleIdentifier
|
|
||||||
|
|
||||||
public static var socketURL: URL {
|
|
||||||
get throws {
|
|
||||||
try groupContainerURL.appending(component: "burrow.sock", directoryHint: .notDirectory)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static var databaseURL: URL {
|
|
||||||
get throws {
|
|
||||||
try groupContainerURL.appending(component: "burrow.db", directoryHint: .notDirectory)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static var groupContainerURL: URL {
|
|
||||||
get throws { try _groupContainerURL.get() }
|
|
||||||
}
|
|
||||||
private static let _groupContainerURL: Result<URL, Error> = {
|
|
||||||
switch FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) {
|
|
||||||
case .some(let url): .success(url)
|
|
||||||
case .none: .failure(.invalidAppGroupIdentifier)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Logger {
|
|
||||||
@_dynamicReplacement(for: subsystem)
|
|
||||||
public static var subsystem: String { Constants.bundleIdentifier }
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// Release
|
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
|
||||||
SWIFT_COMPILATION_MODE = wholemodule
|
|
||||||
SWIFT_OPTIMIZATION_LEVEL = -Osize
|
|
||||||
LLVM_LTO = YES
|
|
||||||
DEAD_CODE_STRIPPING = YES
|
|
||||||
STRIP_INSTALLED_PRODUCT = YES
|
|
||||||
STRIP_SWIFT_SYMBOLS = YES
|
|
||||||
COPY_PHASE_STRIP = NO
|
|
||||||
VALIDATE_PRODUCT = YES
|
|
||||||
ENABLE_MODULE_VERIFIER = YES
|
|
||||||
|
|
||||||
// Debug
|
|
||||||
ONLY_ACTIVE_ARCH[config=Debug] = YES
|
|
||||||
DEBUG_INFORMATION_FORMAT[config=Debug] = dwarf
|
|
||||||
ENABLE_TESTABILITY[config=Debug] = YES
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS[config=Debug] = DEBUG=1 $(inherited)
|
|
||||||
SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone
|
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Debug] = DEBUG
|
|
||||||
SWIFT_COMPILATION_MODE[config=Debug] = singlefile
|
|
||||||
LLVM_LTO[config=Debug] = NO
|
|
||||||
DEAD_CODE_STRIPPING[config=Debug] = NO
|
|
||||||
VALIDATE_PRODUCT[config=Debug] = NO
|
|
||||||
STRIP_INSTALLED_PRODUCT[config=Debug] = NO
|
|
||||||
STRIP_SWIFT_SYMBOLS[config=Debug] = NO
|
|
||||||
ENABLE_MODULE_VERIFIER[config=Debug] = NO
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
LD_EXPORT_SYMBOLS = NO
|
MERGED_BINARY_TYPE = manual
|
||||||
|
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -disable-autolink-framework -Xfrontend UIKit -Xfrontend -disable-autolink-framework -Xfrontend AppKit -Xfrontend -disable-autolink-framework -Xfrontend SwiftUI
|
|
||||||
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @executable_path/../../Frameworks
|
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @executable_path/../../Frameworks
|
||||||
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks
|
LD_RUNPATH_SEARCH_PATHS[sdk=macos*] = $(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
PRODUCT_NAME = Burrow$(TARGET_NAME:c99extidentifier)
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_IDENTIFIER).$(TARGET_NAME:c99extidentifier)
|
|
||||||
APPLICATION_EXTENSION_API_ONLY = YES
|
|
||||||
SWIFT_INSTALL_OBJC_HEADER = NO
|
|
||||||
SWIFT_SKIP_AUTOLINKING_FRAMEWORKS = YES
|
|
||||||
SWIFT_SKIP_AUTOLINKING_LIBRARIES = YES
|
|
||||||
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks
|
|
||||||
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks
|
|
||||||
|
|
||||||
DYLIB_INSTALL_NAME_BASE = @rpath
|
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1
|
|
||||||
DYLIB_CURRENT_VERSION = 1
|
|
||||||
VERSIONING_SYSTEM =
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
import GRPC
|
|
||||||
import NIOTransportServices
|
|
||||||
|
|
||||||
public typealias TunnelClient = Burrow_TunnelAsyncClient
|
|
||||||
public typealias NetworksClient = Burrow_NetworksAsyncClient
|
|
||||||
|
|
||||||
public protocol Client {
|
|
||||||
init(channel: GRPCChannel)
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Client {
|
|
||||||
public static func unix(socketURL: URL) -> Self {
|
|
||||||
let group = NIOTSEventLoopGroup()
|
|
||||||
let configuration = ClientConnection.Configuration.default(
|
|
||||||
target: .unixDomainSocket(socketURL.path),
|
|
||||||
eventLoopGroup: group
|
|
||||||
)
|
|
||||||
return Self(channel: ClientConnection(configuration: configuration))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TunnelClient: Client {
|
|
||||||
public init(channel: any GRPCChannel) {
|
|
||||||
self.init(channel: channel, defaultCallOptions: .init(), interceptors: .none)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension NetworksClient: Client {
|
|
||||||
public init(channel: any GRPCChannel) {
|
|
||||||
self.init(channel: channel, defaultCallOptions: .init(), interceptors: .none)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../../../proto/burrow.proto
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"invocations": [
|
|
||||||
{
|
|
||||||
"protoFiles": [
|
|
||||||
"burrow.proto",
|
|
||||||
],
|
|
||||||
"server": false,
|
|
||||||
"visibility": "public"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"invocations": [
|
|
||||||
{
|
|
||||||
"protoFiles": [
|
|
||||||
"burrow.proto",
|
|
||||||
],
|
|
||||||
"visibility": "public"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
60
Apple/NetworkExtension/Client.swift
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
import BurrowShared
|
||||||
|
import Foundation
|
||||||
|
import Network
|
||||||
|
|
||||||
|
final class Client {
|
||||||
|
let connection: NWConnection
|
||||||
|
|
||||||
|
private let logger = Logger.logger(for: Client.self)
|
||||||
|
private var generator = SystemRandomNumberGenerator()
|
||||||
|
|
||||||
|
convenience init() throws {
|
||||||
|
self.init(url: try Constants.socketURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
init(url: URL) {
|
||||||
|
let endpoint: NWEndpoint
|
||||||
|
if url.isFileURL {
|
||||||
|
endpoint = .unix(path: url.path(percentEncoded: false))
|
||||||
|
} else {
|
||||||
|
endpoint = .url(url)
|
||||||
|
}
|
||||||
|
|
||||||
|
let parameters = NWParameters.tcp
|
||||||
|
parameters.defaultProtocolStack
|
||||||
|
.applicationProtocols
|
||||||
|
.insert(NWProtocolFramer.Options(definition: NewlineProtocolFramer.definition), at: 0)
|
||||||
|
connection = NWConnection(to: endpoint, using: parameters)
|
||||||
|
connection.start(queue: .global())
|
||||||
|
}
|
||||||
|
|
||||||
|
func request<U: Decodable>(_ request: any Request, type: U.Type = U.self) async throws -> U {
|
||||||
|
do {
|
||||||
|
var copy = request
|
||||||
|
copy.id = generator.next(upperBound: UInt.max)
|
||||||
|
let content = try JSONEncoder().encode(copy)
|
||||||
|
logger.debug("> \(String(decoding: content, as: UTF8.self))")
|
||||||
|
|
||||||
|
try await self.connection.send(content: content)
|
||||||
|
let (response, _, _) = try await connection.receiveMessage()
|
||||||
|
|
||||||
|
logger.debug("< \(String(decoding: response, as: UTF8.self))")
|
||||||
|
return try JSONDecoder().decode(U.self, from: response)
|
||||||
|
} catch {
|
||||||
|
logger.error("\(error, privacy: .public)")
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
connection.cancel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Constants {
|
||||||
|
static var socketURL: URL {
|
||||||
|
get throws {
|
||||||
|
try groupContainerURL.appending(component: "burrow.sock", directoryHint: .notDirectory)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
Apple/NetworkExtension/DataTypes.swift
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
|
enum BurrowError: Error {
|
||||||
|
case addrDoesntExist
|
||||||
|
case resultIsError
|
||||||
|
case cantParseResult
|
||||||
|
case resultIsNone
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol Request: Codable where Command: Codable {
|
||||||
|
associatedtype Command
|
||||||
|
|
||||||
|
var id: UInt { get set }
|
||||||
|
var command: Command { get set }
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BurrowSingleCommand: Request {
|
||||||
|
var id: UInt
|
||||||
|
var command: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BurrowRequest<T>: Request where T: Codable {
|
||||||
|
var id: UInt
|
||||||
|
var command: T
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BurrowStartRequest: Codable {
|
||||||
|
struct TunOptions: Codable {
|
||||||
|
let name: String?
|
||||||
|
let no_pi: Bool
|
||||||
|
let tun_excl: Bool
|
||||||
|
let tun_retrieve: Bool
|
||||||
|
let address: [String]
|
||||||
|
}
|
||||||
|
struct StartOptions: Codable {
|
||||||
|
let tun: TunOptions
|
||||||
|
}
|
||||||
|
let Start: StartOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Response<T>: Decodable where T: Decodable {
|
||||||
|
var id: UInt
|
||||||
|
var result: T
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BurrowResult<T>: Codable where T: Codable {
|
||||||
|
var Ok: T?
|
||||||
|
var Err: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ServerConfigData: Codable {
|
||||||
|
struct InternalConfig: Codable {
|
||||||
|
let address: [String]
|
||||||
|
let name: String?
|
||||||
|
let mtu: Int32?
|
||||||
|
}
|
||||||
|
let ServerConfig: InternalConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
32
Apple/NetworkExtension/NWConnection+Async.swift
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import Foundation
|
||||||
|
import Network
|
||||||
|
|
||||||
|
extension NWConnection {
|
||||||
|
// swiftlint:disable:next large_tuple
|
||||||
|
func receiveMessage() async throws -> (Data, NWConnection.ContentContext?, Bool) {
|
||||||
|
try await withUnsafeThrowingContinuation { continuation in
|
||||||
|
receiveMessage { completeContent, contentContext, isComplete, error in
|
||||||
|
if let error {
|
||||||
|
continuation.resume(throwing: error)
|
||||||
|
} else {
|
||||||
|
guard let completeContent = completeContent else {
|
||||||
|
fatalError("Both error and completeContent were nil")
|
||||||
|
}
|
||||||
|
continuation.resume(returning: (completeContent, contentContext, isComplete))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func send(content: Data) async throws {
|
||||||
|
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
|
||||||
|
send(content: content, completion: .contentProcessed { error in
|
||||||
|
if let error {
|
||||||
|
continuation.resume(throwing: error)
|
||||||
|
} else {
|
||||||
|
continuation.resume(returning: ())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
Apple/NetworkExtension/NewlineProtocolFramer.swift
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
import Foundation
|
||||||
|
import Network
|
||||||
|
|
||||||
|
final class NewlineProtocolFramer: NWProtocolFramerImplementation {
|
||||||
|
private static let delimeter: UInt8 = 10 // `\n`
|
||||||
|
|
||||||
|
static let definition = NWProtocolFramer.Definition(implementation: NewlineProtocolFramer.self)
|
||||||
|
static let label = "Lines"
|
||||||
|
|
||||||
|
init(framer: NWProtocolFramer.Instance) { }
|
||||||
|
|
||||||
|
func start(framer: NWProtocolFramer.Instance) -> NWProtocolFramer.StartResult { .ready }
|
||||||
|
func stop(framer: NWProtocolFramer.Instance) -> Bool { true }
|
||||||
|
|
||||||
|
func wakeup(framer: NWProtocolFramer.Instance) { }
|
||||||
|
func cleanup(framer: NWProtocolFramer.Instance) { }
|
||||||
|
|
||||||
|
func handleInput(framer: NWProtocolFramer.Instance) -> Int {
|
||||||
|
while true {
|
||||||
|
var result: [Data] = []
|
||||||
|
let parsed = framer.parseInput(minimumIncompleteLength: 1, maximumLength: 16_000) { buffer, _ in
|
||||||
|
guard let buffer else { return 0 }
|
||||||
|
var lines = buffer
|
||||||
|
.split(separator: Self.delimeter, omittingEmptySubsequences: false)
|
||||||
|
.map { Data($0) }
|
||||||
|
guard lines.count > 1 else { return 0 }
|
||||||
|
_ = lines.popLast()
|
||||||
|
|
||||||
|
result = lines
|
||||||
|
return lines.reduce(lines.count) { $0 + $1.count }
|
||||||
|
}
|
||||||
|
|
||||||
|
guard parsed && !result.isEmpty else { break }
|
||||||
|
|
||||||
|
for line in result {
|
||||||
|
framer.deliverInput(data: line, message: .init(instance: framer), isComplete: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleOutput(
|
||||||
|
framer: NWProtocolFramer.Instance,
|
||||||
|
message: NWProtocolFramer.Message,
|
||||||
|
messageLength: Int,
|
||||||
|
isComplete: Bool
|
||||||
|
) {
|
||||||
|
do {
|
||||||
|
try framer.writeOutputNoCopy(length: messageLength)
|
||||||
|
framer.writeOutput(data: [Self.delimeter])
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,74 +1,84 @@
|
||||||
import AsyncAlgorithms
|
import BurrowShared
|
||||||
import BurrowConfiguration
|
|
||||||
import BurrowCore
|
|
||||||
import libburrow
|
import libburrow
|
||||||
import NetworkExtension
|
import NetworkExtension
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class PacketTunnelProvider: NEPacketTunnelProvider {
|
class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||||
enum Error: Swift.Error {
|
|
||||||
case missingTunnelConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
private let logger = Logger.logger(for: PacketTunnelProvider.self)
|
private let logger = Logger.logger(for: PacketTunnelProvider.self)
|
||||||
|
|
||||||
private var client: TunnelClient {
|
|
||||||
get throws { try _client.get() }
|
|
||||||
}
|
|
||||||
private let _client: Result<TunnelClient, Swift.Error> = Result {
|
|
||||||
try TunnelClient.unix(socketURL: Constants.socketURL)
|
|
||||||
}
|
|
||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
do {
|
do {
|
||||||
libburrow.spawnInProcess(
|
libburrow.spawnInProcess(socketPath: try Constants.socketURL.path)
|
||||||
socketPath: try Constants.socketURL.path(percentEncoded: false),
|
|
||||||
databasePath: try Constants.databaseURL.path(percentEncoded: false)
|
|
||||||
)
|
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to spawn networking thread: \(error)")
|
logger.error("Failed to spawn: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func startTunnel(options: [String: NSObject]? = nil) async throws {
|
override func startTunnel(options: [String: NSObject]? = nil) async throws {
|
||||||
do {
|
do {
|
||||||
let configuration = try await Array(client.tunnelConfiguration(.init()).prefix(1)).first
|
let client = try Client()
|
||||||
guard let settings = configuration?.settings else {
|
|
||||||
throw Error.missingTunnelConfiguration
|
let command = BurrowRequest(id: 0, command: "ServerConfig")
|
||||||
|
let data = try await client.request(command, type: Response<BurrowResult<ServerConfigData>>.self)
|
||||||
|
|
||||||
|
let encoded = try JSONEncoder().encode(data.result)
|
||||||
|
self.logger.log("Received final data: \(String(decoding: encoded, as: UTF8.self))")
|
||||||
|
guard let serverconfig = data.result.Ok else {
|
||||||
|
throw BurrowError.resultIsError
|
||||||
}
|
}
|
||||||
try await setTunnelNetworkSettings(settings)
|
guard let tunNs = generateTunSettings(from: serverconfig) else {
|
||||||
_ = try await client.tunnelStart(.init())
|
throw BurrowError.addrDoesntExist
|
||||||
logger.log("Started tunnel with network settings: \(settings)")
|
}
|
||||||
|
try await self.setTunnelNetworkSettings(tunNs)
|
||||||
|
self.logger.info("Set remote tunnel address to \(tunNs.tunnelRemoteAddress)")
|
||||||
|
|
||||||
|
let startRequest = BurrowRequest(
|
||||||
|
id: .random(in: (.min)..<(.max)),
|
||||||
|
command: BurrowStartRequest(
|
||||||
|
Start: BurrowStartRequest.StartOptions(
|
||||||
|
tun: BurrowStartRequest.TunOptions(
|
||||||
|
name: nil, no_pi: false, tun_excl: false, tun_retrieve: true, address: []
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
let response = try await client.request(startRequest, type: Response<BurrowResult<String>>.self)
|
||||||
|
self.logger.log("Received start server response: \(String(describing: response.result))")
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to start tunnel: \(error)")
|
self.logger.error("Failed to start tunnel: \(error)")
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func stopTunnel(with reason: NEProviderStopReason) async {
|
override func stopTunnel(with reason: NEProviderStopReason) async {
|
||||||
do {
|
do {
|
||||||
_ = try await client.tunnelStop(.init())
|
let client = try Client()
|
||||||
logger.log("Stopped client")
|
let command = BurrowRequest(id: 0, command: "Stop")
|
||||||
|
let data = try await client.request(command, type: Response<BurrowResult<String>>.self)
|
||||||
|
self.logger.log("Stopped client.")
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to stop tunnel: \(error)")
|
self.logger.error("Failed to stop tunnel: \(error)")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Burrow_TunnelConfigurationResponse {
|
private func generateTunSettings(from: ServerConfigData) -> NETunnelNetworkSettings? {
|
||||||
fileprivate var settings: NEPacketTunnelNetworkSettings {
|
let cfig = from.ServerConfig
|
||||||
let ipv6Addresses = addresses.filter { IPv6Address($0) != nil }
|
let nst = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "1.1.1.1")
|
||||||
|
var v4Addresses = [String]()
|
||||||
let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "1.1.1.1")
|
var v6Addresses = [String]()
|
||||||
settings.mtu = NSNumber(value: mtu)
|
for addr in cfig.address {
|
||||||
settings.ipv4Settings = NEIPv4Settings(
|
if IPv4Address(addr) != nil {
|
||||||
addresses: addresses.filter { IPv4Address($0) != nil },
|
v6Addresses.append(addr)
|
||||||
subnetMasks: ["255.255.255.0"]
|
}
|
||||||
)
|
if IPv6Address(addr) != nil {
|
||||||
settings.ipv6Settings = NEIPv6Settings(
|
v4Addresses.append(addr)
|
||||||
addresses: ipv6Addresses,
|
}
|
||||||
networkPrefixLengths: ipv6Addresses.map { _ in 64 }
|
}
|
||||||
)
|
nst.ipv4Settings = NEIPv4Settings(addresses: v4Addresses, subnetMasks: v4Addresses.map { _ in
|
||||||
return settings
|
"255.255.255.0"
|
||||||
|
})
|
||||||
|
nst.ipv6Settings = NEIPv6Settings(addresses: v6Addresses, networkPrefixLengths: v6Addresses.map { _ in 64 })
|
||||||
|
logger.log("Initialized ipv4 settings: \(nst.ipv4Settings)")
|
||||||
|
return nst
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,10 @@ CARGO_ARGS+=("--lib")
|
||||||
|
|
||||||
# Pass the configuration (Debug or Release) through to cargo
|
# Pass the configuration (Debug or Release) through to cargo
|
||||||
if [[ $SWIFT_ACTIVE_COMPILATION_CONDITIONS == *DEBUG* ]]; then
|
if [[ $SWIFT_ACTIVE_COMPILATION_CONDITIONS == *DEBUG* ]]; then
|
||||||
CARGO_TARGET_SUBDIR="debug"
|
CARGO_DIR="debug"
|
||||||
else
|
else
|
||||||
CARGO_ARGS+=("--release")
|
CARGO_ARGS+=("--release")
|
||||||
CARGO_TARGET_SUBDIR="release"
|
CARGO_DIR="release"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -x "$(command -v rustup)" ]]; then
|
if [[ -x "$(command -v rustup)" ]]; then
|
||||||
|
|
@ -68,16 +68,13 @@ else
|
||||||
CARGO_PATH="$(dirname $(readlink -f $(which cargo))):/usr/bin"
|
CARGO_PATH="$(dirname $(readlink -f $(which cargo))):/usr/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROTOC=$(readlink -f $(which protoc))
|
|
||||||
CARGO_PATH="$(dirname $PROTOC):$CARGO_PATH"
|
|
||||||
|
|
||||||
# Run cargo without the various environment variables set by Xcode.
|
# Run cargo without the various environment variables set by Xcode.
|
||||||
# Those variables can confuse cargo and the build scripts it runs.
|
# Those variables can confuse cargo and the build scripts it runs.
|
||||||
env -i PATH="$CARGO_PATH" PROTOC="$PROTOC" CARGO_TARGET_DIR="${CONFIGURATION_TEMP_DIR}/target" IPHONEOS_DEPLOYMENT_TARGET="$IPHONEOS_DEPLOYMENT_TARGET" MACOSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET" cargo build "${CARGO_ARGS[@]}"
|
env -i PATH="$CARGO_PATH" cargo build "${CARGO_ARGS[@]}"
|
||||||
|
|
||||||
mkdir -p "${BUILT_PRODUCTS_DIR}"
|
mkdir -p "${BUILT_PRODUCTS_DIR}"
|
||||||
|
|
||||||
# Use `lipo` to merge the architectures together into BUILT_PRODUCTS_DIR
|
# Use `lipo` to merge the architectures together into BUILT_PRODUCTS_DIR
|
||||||
/usr/bin/xcrun --sdk $PLATFORM_NAME lipo \
|
/usr/bin/xcrun --sdk $PLATFORM_NAME lipo \
|
||||||
-create $(printf "${CONFIGURATION_TEMP_DIR}/target/%q/${CARGO_TARGET_SUBDIR}/libburrow.a " "${RUST_TARGETS[@]}") \
|
-create $(printf "${PROJECT_DIR}/../target/%q/${CARGO_DIR}/libburrow.a " "${RUST_TARGETS[@]}") \
|
||||||
-output "${BUILT_PRODUCTS_DIR}/libburrow.a"
|
-output "${BUILT_PRODUCTS_DIR}/libburrow.a"
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
__attribute__((__swift_name__("spawnInProcess(socketPath:databasePath:)")))
|
__attribute__((__swift_name__("spawnInProcess(socketPath:)")))
|
||||||
extern void spawn_in_process(const char * __nullable socket_path, const char * __nullable db_path);
|
extern void spawn_in_process(const char * __nullable path);
|
||||||
|
|
|
||||||
23
Apple/Shared/Constants.swift
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
@_implementationOnly import Constants
|
||||||
|
|
||||||
|
public enum Constants {
|
||||||
|
enum Error: Swift.Error {
|
||||||
|
case invalidAppGroupIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
public static let bundleIdentifier = AppBundleIdentifier
|
||||||
|
public static let appGroupIdentifier = AppGroupIdentifier
|
||||||
|
public static let networkExtensionBundleIdentifier = NetworkExtensionBundleIdentifier
|
||||||
|
|
||||||
|
public static var groupContainerURL: URL {
|
||||||
|
get throws { try _groupContainerURL.get() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static let _groupContainerURL: Result<URL, Error> = {
|
||||||
|
guard let groupContainerURL = FileManager.default
|
||||||
|
.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) else {
|
||||||
|
return .failure(.invalidAppGroupIdentifier)
|
||||||
|
}
|
||||||
|
return .success(groupContainerURL)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module CConstants {
|
module Constants {
|
||||||
header "Constants.h"
|
header "Constants.h"
|
||||||
export *
|
export *
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ import os
|
||||||
extension Logger {
|
extension Logger {
|
||||||
private static let loggers: OSAllocatedUnfairLock<[String: Logger]> = OSAllocatedUnfairLock(initialState: [:])
|
private static let loggers: OSAllocatedUnfairLock<[String: Logger]> = OSAllocatedUnfairLock(initialState: [:])
|
||||||
|
|
||||||
public dynamic static var subsystem: String { "com.hackclub.burrow" }
|
public static let subsystem = Constants.bundleIdentifier
|
||||||
|
|
||||||
public static func logger(for type: Any.Type) -> Logger {
|
public static func logger(for type: Any.Type) -> Logger {
|
||||||
let category = String(describing: type)
|
let category = String(describing: type)
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Framework.xcconfig"
|
PRODUCT_NAME = BurrowShared
|
||||||
|
MERGEABLE_LIBRARY = YES
|
||||||
|
|
||||||
SWIFT_INCLUDE_PATHS = $(PROJECT_DIR)/Configuration/Constants
|
SWIFT_INCLUDE_PATHS = $(PROJECT_DIR)/Shared/Constants
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = APP_BUNDLE_IDENTIFIER=$(APP_BUNDLE_IDENTIFIER) APP_GROUP_IDENTIFIER=$(APP_GROUP_IDENTIFIER) NETWORK_EXTENSION_BUNDLE_IDENTIFIER=$(NETWORK_EXTENSION_BUNDLE_IDENTIFIER)
|
GCC_PREPROCESSOR_DEFINITIONS = APP_BUNDLE_IDENTIFIER=$(APP_BUNDLE_IDENTIFIER) APP_GROUP_IDENTIFIER=$(APP_GROUP_IDENTIFIER) NETWORK_EXTENSION_BUNDLE_IDENTIFIER=$(NETWORK_EXTENSION_BUNDLE_IDENTIFIER)
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 684 B |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |