Merge branch 'main' into gtk-rpc

This commit is contained in:
David Zhong 2024-09-07 18:00:12 -07:00 committed by GitHub
commit b973481539
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 54 additions and 42 deletions

View file

@ -27,7 +27,9 @@ runs:
Apple/DerivedData 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

View file

@ -13,15 +13,18 @@ runs:
using: composite using: composite
steps: steps:
- shell: bash - shell: bash
env:
FASTLANE_OPT_OUT_USAGE: 'YES'
run: | run: |
APP_STORE_KEY=$(echo "${{ inputs.app-store-key }}" | jq -sR .)
cat << EOF > api-key.json cat << EOF > api-key.json
{ {
"key_id": "${{ inputs.app-store-key-id }}", "key_id": "${{ inputs.app-store-key-id }}",
"issuer_id": "${{ inputs.app-store-key-issuer-id }}", "issuer_id": "${{ inputs.app-store-key-issuer-id }}",
"key": "${{ inputs.app-store-key }}" "key": $APP_STORE_KEY
} }
EOF EOF
fastlane sigh download_all --api_key_path api-key.json --download_xcode_profiles fastlane sigh download_all --api_key_path api-key.json
rm -rf api-key.json rm -rf api-key.json

View file

@ -12,11 +12,8 @@ inputs:
archive-path: archive-path:
description: Xcode archive path description: Xcode archive path
required: true required: true
destination: export-options:
description: The Xcode export destination. This can either be "export" or "upload" description: The export options in JSON format
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
@ -29,8 +26,7 @@ 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
echo '{"destination":"${{ inputs.destination }}","method":"${{ inputs.method }}"}' \ echo '${{ inputs.export-options }}' | plutil -convert xml1 -o ExportOptions.plist -
| plutil -convert xml1 -o ExportOptions.plist -
xcodebuild \ xcodebuild \
-exportArchive \ -exportArchive \

View file

@ -21,14 +21,16 @@ jobs:
- x86_64-unknown-linux-gnu - x86_64-unknown-linux-gnu
targets: targets:
- aarch64-unknown-linux-gnu - aarch64-unknown-linux-gnu
- os: macos-12 - os: macos-13
platform: macOS (Intel) platform: macOS (Intel)
xcode: /Applications/Xcode_15.2.app
test-targets: test-targets:
- x86_64-apple-darwin - x86_64-apple-darwin
targets: targets:
- x86_64-apple-ios - x86_64-apple-ios
- os: macos-14 - os: macos-14
platform: macOS platform: macOS
xcode: /Applications/Xcode_16.0.app
test-targets: test-targets:
- aarch64-apple-darwin - aarch64-apple-darwin
targets: targets:
@ -42,7 +44,7 @@ jobs:
- aarch64-pc-windows-msvc - aarch64-pc-windows-msvc
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer DEVELOPER_DIR: ${{ matrix.xcode }}/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

View file

@ -13,13 +13,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- - platform: iOS
destination: generic/platform=iOS
platform: iOS
rust-targets: rust-targets:
- aarch64-apple-ios - aarch64-apple-ios
- destination: generic/platform=macOS - platform: macOS
platform: macOS
rust-targets: rust-targets:
- x86_64-apple-darwin - x86_64-apple-darwin
- aarch64-apple-darwin - aarch64-apple-darwin
@ -35,6 +32,12 @@ jobs:
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 Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
@ -47,7 +50,7 @@ jobs:
uses: ./.github/actions/archive uses: ./.github/actions/archive
with: with:
scheme: App scheme: App
destination: ${{ matrix.destination }} destination: generic/platform=${{ matrix.platform }}
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 }}
@ -61,6 +64,8 @@ jobs:
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: Notarize
if: ${{ matrix.platform == 'macOS' }} if: ${{ matrix.platform == 'macOS' }}
@ -96,10 +101,10 @@ jobs:
if: ${{ matrix.platform == 'iOS' }} if: ${{ matrix.platform == 'iOS' }}
uses: ./.github/actions/export uses: ./.github/actions/export
with: with:
method: app-store
destination: upload
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: |
{"method": "app-store", "destination": "upload"}
export-path: Release export-path: Release

View file

@ -2,7 +2,8 @@
import AppKit import AppKit
import SwiftUI import SwiftUI
@MainActor @main @main
@MainActor
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
private let quitItem: NSMenuItem = { private let quitItem: NSMenuItem = {
let quitItem = NSMenuItem( let quitItem = NSMenuItem(

View file

@ -42,7 +42,6 @@ struct BurrowView: View {
} }
private func addWireGuardNetwork() { private func addWireGuardNetwork() {
} }
private func authenticateWithSlack() async throws { private func authenticateWithSlack() async throws {

View file

@ -1,6 +1,6 @@
import AuthenticationServices import AuthenticationServices
import SwiftUI
import Foundation import Foundation
import SwiftUI
enum OAuth2 { enum OAuth2 {
enum Error: Swift.Error { enum Error: Swift.Error {
@ -35,7 +35,7 @@ enum OAuth2 {
} }
} }
public init( init(
authorizationEndpoint: URL, authorizationEndpoint: URL,
tokenEndpoint: URL, tokenEndpoint: URL,
redirectURI: URL, redirectURI: URL,
@ -125,7 +125,11 @@ enum OAuth2 {
var refreshToken: String? var refreshToken: String?
var credential: Credential { var credential: Credential {
.init(accessToken: accessToken, refreshToken: refreshToken, expirationDate: expiresIn.map { Date.init(timeIntervalSinceNow: $0) }) .init(
accessToken: accessToken,
refreshToken: refreshToken,
expirationDate: expiresIn.map { Date(timeIntervalSinceNow: $0) }
)
} }
} }
@ -203,7 +207,24 @@ enum OAuth2 {
} }
extension WebAuthenticationSession { extension WebAuthenticationSession {
func start(url: URL, redirectURI: URL) async throws -> URL { #if canImport(BrowserEngineKit)
@available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *)
fileprivate static func callback(for redirectURI: URL) throws -> ASWebAuthenticationSession.Callback {
switch redirectURI.scheme {
case "https":
guard let host = redirectURI.host else { throw OAuth2.Error.invalidRedirectURI }
return .https(host: host, path: redirectURI.path)
case "http":
throw OAuth2.Error.invalidRedirectURI
case .some(let scheme):
return .customScheme(scheme)
case .none:
throw OAuth2.Error.invalidRedirectURI
}
}
#endif
fileprivate func start(url: URL, redirectURI: URL) async throws -> URL {
#if canImport(BrowserEngineKit) #if canImport(BrowserEngineKit)
if #available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *) { if #available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *) {
return try await authenticate( return try await authenticate(
@ -231,23 +252,6 @@ extension WebAuthenticationSession {
return url return url
} }
} }
#if canImport(BrowserEngineKit)
@available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *)
fileprivate static func callback(for redirectURI: URL) throws -> ASWebAuthenticationSession.Callback {
switch redirectURI.scheme {
case "https":
guard let host = redirectURI.host else { throw OAuth2.Error.invalidRedirectURI }
return .https(host: host, path: redirectURI.path)
case "http":
throw OAuth2.Error.invalidRedirectURI
case .some(let scheme):
return .customScheme(scheme)
case .none:
throw OAuth2.Error.invalidRedirectURI
}
}
#endif
} }
extension View { extension View {