Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit abc0b7c

Browse files
committed
fix: VPN should only attempt to start if its from the appstore
1 parent e1b89a5 commit abc0b7c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Protokolle/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1515
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1616
// Override point for customization after application launch.
1717
_createDocumentsDirectory()
18-
tunnel.startVPN()
18+
if Bundle.main.appStoreReceiptExists { tunnel.startVPN() }
1919
return true
2020
}
2121

Protokolle/Extensions/Bundle+keys.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation.NSBundle
99

1010
extension Bundle {
1111
/// Get the name of the app
12-
public var name: String {
12+
var name: String {
1313
if let displayName = object(forInfoDictionaryKey: "CFBundleDisplayName") as? String {
1414
return displayName
1515
}
@@ -18,18 +18,21 @@ extension Bundle {
1818
}
1919
return object(forInfoDictionaryKey: "CFBundleExecutable") as? String ?? ""
2020
}
21-
2221
/// Get the "short" version of the app
23-
public var version: String {
22+
var version: String {
2423
if let version = object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {
2524
return version
2625
}
2726

2827
return object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? ""
2928
}
30-
29+
/// Check if this app is from the App Store
30+
var appStoreReceiptExists: Bool {
31+
guard let receiptURL = Self.main.appStoreReceiptURL else { return false }
32+
return FileManager.default.fileExists(atPath: receiptURL.path)
33+
}
3134
/// Get the icon of the app
32-
public var iconFileName: String? {
35+
var iconFileName: String? {
3336
if
3437
let icons = object(forInfoDictionaryKey: "CFBundleIcons") as? [String: Any],
3538
let primary = icons["CFBundlePrimaryIcon"] as? [String: Any],

0 commit comments

Comments
 (0)