Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ jobs:
swift --version
swift test --help

- name: Inject Version into Info.plist
run: |
VERSION="${{ github.event.inputs.version }}"
if [ -z "$VERSION" ]; then
VERSION="${{ github.ref_name }}"
fi
# Strip 'v' prefix if present for Info.plist compatibility
VERSION_CLEAN=$(echo $VERSION | sed 's/^v//')
echo "Injecting version $VERSION_CLEAN into Info.plist"
plutil -replace CFBundleShortVersionString -string "$VERSION_CLEAN" Sources/Browserly/Info.plist

- name: Build App
run: swift build -c release

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ A smart macOS menu bar app that routes URLs to the right browser based on custom
- **Domain rules** — route `github.com` to Chrome, `twitter.com` to Safari
- **Regex rules** — match any part of a URL with regular expressions
- **Source app rules** — route based on which app opened the link (e.g. Slack → Work Chrome)
- **URL Redirector Decoding** — automatically "sees through" Teams, Outlook, Proofpoint, and Slack link wrappers to apply rules to the final destination URL
- **URL Redirector Decoding** — automatically "sees through" Teams, Outlook, Proofpoint, and Slack link wrappers
- **Update Notifications** — stay informed when a new version is released on GitHub
- **Browser profiles** — target specific Chrome/Edge/Brave profiles
- **Incognito mode** — open matched URLs in private windows
- **Menu bar app** — lives in the menu bar, no Dock icon
Expand Down
3 changes: 3 additions & 0 deletions Sources/Browserly/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {

// Check for URL passed via command line arguments (first instance only)
processCommandLineArguments()

// Check for updates
UpdateManager.shared.checkForUpdates()
}

public func syncLaunchAtLogin() {
Expand Down
13 changes: 13 additions & 0 deletions Sources/Browserly/Core/Storage/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,18 @@ public class AppState {
}
}

// Update tracking
public var latestVersion: String? = nil
public var updateUrl: URL? = nil

public var currentVersion: String {
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.0.0"
}

public var isUpdateAvailable: Bool {
guard let latest = latestVersion else { return false }
return latest.compare(currentVersion, options: .numeric) == .orderedDescending
}

private init() {}
}
39 changes: 39 additions & 0 deletions Sources/Browserly/Core/System/UpdateManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Foundation

public class UpdateManager {
public static let shared = UpdateManager()

private let repoUrl = "https://api.github.com/repos/andyzasl/browserly/releases/latest"

private init() {}

struct GitHubRelease: Codable {
let tag_name: String
let html_url: String
}

public func checkForUpdates() {
guard let url = URL(string: repoUrl) else { return }

let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data, error == nil else {
print("Failed to check for updates: \(error?.localizedDescription ?? "No data")")
return
}

do {
let release = try JSONDecoder().decode(GitHubRelease.self, from: data)
let version = release.tag_name.replacingOccurrences(of: "v", with: "")

DispatchQueue.main.async {
AppState.shared.latestVersion = version
AppState.shared.updateUrl = URL(string: release.html_url)
}
} catch {
print("Failed to parse update info: \(error.localizedDescription)")
}
}

task.resume()
}
}
4 changes: 2 additions & 2 deletions Sources/Browserly/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>0.0.0-dev</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>0</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
Expand Down
32 changes: 32 additions & 0 deletions Sources/Browserly/UI/MenuBar/PopoverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ struct PopoverView: View {
@Bindable var bAppState = appState

VStack(alignment: .leading, spacing: 0) {
// --- UPDATE NOTIFICATION ---
if bAppState.isUpdateAvailable {
HStack {
Image(systemName: "arrow.up.circle.fill")
.foregroundColor(.blue)
Text("New version available: \(bAppState.latestVersion ?? "")")
.font(.system(size: 12, weight: .medium))
Spacer()
Button("Update") {
if let url = bAppState.updateUrl {
NSWorkspace.shared.open(url)
}
}
.buttonStyle(.borderedProminent)
.controlSize(.small)
}
.padding(.horizontal)
.padding(.vertical, 8)
.background(Color.blue.opacity(0.1))
Divider()
}

// --- HEADER ---
VStack(alignment: .leading, spacing: 12) {
HStack {
Expand Down Expand Up @@ -144,10 +166,20 @@ struct PopoverView: View {
}
}
.padding()

HStack {
Spacer()
Text("v\(appState.currentVersion)")
.font(.system(size: 9))
.foregroundColor(.secondary)
.padding(.trailing, 8)
.padding(.bottom, 4)
}
}
.frame(width: 350)
.onAppear {
historyManager.reloadHistory()
UpdateManager.shared.checkForUpdates()
}
}
}
Expand Down
Loading