mirror of
https://github.com/mue/mue.git
synced 2026-07-19 06:54:10 +02:00
- Added shebang to commit-msg.sh for better script execution. - Updated Dockerfile to use a specific version of the bun image. - Improved logging format in SafariWebExtensionHandler.swift for better readability. - Simplified CSS variable for text color in Style.css. - Refactored ViewController.swift to enhance readability and maintainability. - Improved conditional checks in ModalTopBar.jsx and Tooltip.jsx for better clarity. - Updated SCSS files to use comments consistently and removed redundant lines. - Enhanced error handling and background loading logic in backgroundLoader.js. - Refactored useBackgroundEvents.js and useBackgroundLoader.js for better readability. - Cleaned up quicklinks components and utilities for improved code quality. - Added empty error.scss file for future styling. - Updated toast.scss and index.scss with consistent comment styles. - Improved number formatting logic in formatNumber.js for better clarity.
48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
//
|
|
// SafariWebExtensionHandler.swift
|
|
// Mue Extension
|
|
//
|
|
// Created by David Ralph on 02/01/2026.
|
|
//
|
|
|
|
import SafariServices
|
|
import os.log
|
|
|
|
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|
|
|
func beginRequest(with context: NSExtensionContext) {
|
|
let request = context.inputItems.first as? NSExtensionItem
|
|
|
|
let profile: UUID?
|
|
if #available(iOS 17.0, macOS 14.0, *) {
|
|
profile = request?.userInfo?[SFExtensionProfileKey] as? UUID
|
|
} else {
|
|
profile = request?.userInfo?["profile"] as? UUID
|
|
}
|
|
|
|
let message: Any?
|
|
if #available(iOS 15.0, macOS 11.0, *) {
|
|
message = request?.userInfo?[SFExtensionMessageKey]
|
|
} else {
|
|
message = request?.userInfo?["message"]
|
|
}
|
|
|
|
os_log(
|
|
.default,
|
|
"Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)",
|
|
String(describing: message),
|
|
profile?.uuidString ?? "none"
|
|
)
|
|
|
|
let response = NSExtensionItem()
|
|
if #available(iOS 15.0, macOS 11.0, *) {
|
|
response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ]
|
|
} else {
|
|
response.userInfo = [ "message": [ "echo": message ] ]
|
|
}
|
|
|
|
context.completeRequest(returningItems: [ response ], completionHandler: nil)
|
|
}
|
|
|
|
}
|