From 88f53605b2995f8731491addaca3944796326c83 Mon Sep 17 00:00:00 2001 From: Kevin McKee Date: Thu, 29 May 2025 17:01:29 -0700 Subject: [PATCH 1/3] SECURITY update --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index a0a85df..e1e9449 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -17,8 +17,8 @@ with the [details usually included with bug reports][issue-template]. #### When to report a vulnerability -* You think you have discovered a potential security vulnerability in VimViewer. -* You are unsure how a vulnerability affects VimViewer. +* You think you have discovered a potential security vulnerability in OAuthSample. +* You are unsure how a vulnerability affects OAuthSample. [issue-template]: https://github.com/codefiesta/OAuthSample/blob/main/.github/ISSUE_TEMPLATE/bug_report.md From ac5e7fcb2d19f9f2e1ab13cf1c28e5a001d4d699 Mon Sep 17 00:00:00 2001 From: Kevin McKee Date: Thu, 29 May 2025 17:03:01 -0700 Subject: [PATCH 2/3] Swiftlint --- .swiftlint.yml | 24 ++++++++++++++++++++++++ OAuthSample/ContentView.swift | 16 +++++++--------- OAuthSample/OAuthSampleApp.swift | 6 +++--- 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 .swiftlint.yml diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..0539802 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,24 @@ +only_rules: + - closing_brace + - colon + - comma + - duplicate_imports + - explicit_init + - file_header + - function_body_length + - legacy_constructor + - legacy_nsgeometry_functions + - legacy_constant + - modifier_order + - private_subject + - redundant_self_in_closure + - sorted_imports + - toggle_bool + - trailing_whitespace + - unneeded_break_in_switch + - unused_import + - weak_delegate + + # rule parameters +function_body_length: + - 225 # warning diff --git a/OAuthSample/ContentView.swift b/OAuthSample/ContentView.swift index 41e7c0d..a48f80d 100644 --- a/OAuthSample/ContentView.swift +++ b/OAuthSample/ContentView.swift @@ -9,15 +9,15 @@ import OAuthKit import SwiftUI struct ContentView: View { - + #if !os(tvOS) @Environment(\.openWindow) var openWindow - + @Environment(\.dismissWindow) private var dismissWindow #endif - + @Environment(\.oauth) var oauth: OAuth @@ -50,7 +50,7 @@ struct ContentView: View { handle(state: state) } } - + /// Displays a list of oauth providers. var providerList: some View { List(oauth.providers) { provider in @@ -60,23 +60,21 @@ struct ContentView: View { } } } - + /// Reacts to oauth state changes by opening or closing authorization windows. /// - Parameter state: the published state change private func handle(state: OAuth.State) { switch state { case .empty, .requestingAccessToken, .requestingDeviceCode: break - case .authorizing, .receivedDeviceCode: + case .authorizing, .receivedDeviceCode: #if !os(tvOS) openWindow(id: "oauth") #endif - break - case .authorized(_): + case .authorized: #if !os(tvOS) dismissWindow(id: "oauth") #endif - break } } } diff --git a/OAuthSample/OAuthSampleApp.swift b/OAuthSample/OAuthSampleApp.swift index 2d5527a..bd07fd7 100644 --- a/OAuthSample/OAuthSampleApp.swift +++ b/OAuthSample/OAuthSampleApp.swift @@ -5,12 +5,12 @@ // Created by Kevin McKee on 5/16/24. // -import SwiftUI import OAuthKit +import SwiftUI @main struct OAuthSampleApp: App { - + @Environment(\.oauth) var oauth: OAuth @@ -19,7 +19,7 @@ struct OAuthSampleApp: App { WindowGroup { ContentView() } - + #if !os(tvOS) WindowGroup(id: "oauth") { OAWebView() From d8fea1dd9f6a7794ebbc161da29d92502ed467af Mon Sep 17 00:00:00 2001 From: Kevin McKee Date: Thu, 29 May 2025 17:07:39 -0700 Subject: [PATCH 3/3] Fixing workflow --- .github/workflows/xcodebuild.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/xcodebuild.yml b/.github/workflows/xcodebuild.yml index 7b149f7..4a9cc77 100644 --- a/.github/workflows/xcodebuild.yml +++ b/.github/workflows/xcodebuild.yml @@ -28,12 +28,15 @@ jobs: run: swiftlint lint --config .swiftlint.yml # iOS build (default) - name: Build iOS - run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=iOS" + run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=iOS" # macOS build (if the PR has the label of 'os:macOS' applied) - name: Build macOS if: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }} - run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=macOS" + run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=macOS" # visionOS build (if the PR has the label of 'os:visionOS' applied) - name: Build visionOS if: ${{ contains(github.event.pull_request.labels.*.name, 'visionOS') }} - run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=visionOS" + run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=visionOS" + - name: Build tvOS + if: ${{ contains(github.event.pull_request.labels.*.name, 'tvOS') }} + run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=tvOS"