macOS: Avoid deprecated file associations

Based on Chromium's Info.plist.

Fixes #7306, see #8416 for more possible improvements.
This commit is contained in:
Florian Bruhin 2024-12-09 16:41:24 +01:00
parent 946ec0ab25
commit 4918e6d8ff
1 changed files with 60 additions and 18 deletions

View File

@ -25,24 +25,66 @@ INFO_PLIST_UPDATES = {
"CFBundleURLName": "local file URL", "CFBundleURLName": "local file URL",
"CFBundleURLSchemes": ["file"] "CFBundleURLSchemes": ["file"]
}], }],
'CFBundleDocumentTypes': [{ 'CFBundleDocumentTypes': [
"CFBundleTypeExtensions": ["html", "htm"], {
"CFBundleTypeMIMETypes": ["text/html"], "CFBundleTypeIconFile": "document.icns",
"CFBundleTypeName": "HTML document", "CFBundleTypeName": name,
"CFBundleTypeOSTypes": ["HTML"], "CFBundleTypeRole": "Viewer",
"CFBundleTypeRole": "Viewer", "LSItemContentTypes": [content_type],
}, { }
"CFBundleTypeExtensions": ["xhtml"], for name, content_type in [
"CFBundleTypeMIMETypes": ["text/xhtml"], ("GIF image", "com.compuserve.gif"),
"CFBundleTypeName": "XHTML document", ("HTML document", "public.html"),
"CFBundleTypeRole": "Viewer", ("XHTML document", "public.xhtml"),
}, { ("JavaScript script", "com.netscape.javascript-source"),
"CFBundleTypeExtensions": ["mhtml"], ("JPEG image", "public.jpeg"),
"CFBundleTypeMIMETypes": ["multipart/related", "application/x-mimearchive", "message/rfc822"], ("MHTML document", "org.ietf.mhtml"),
"CFBundleTypeName": "MHTML document", ("HTML5 Audio (Ogg)", "org.xiph.ogg-audio"),
"CFBundleTypeRole": "Viewer", ("HTML5 Video (Ogg)", "org.xiph.oggv"),
}], ("PNG image", "public.png"),
("SVG document", "public.svg-image"),
("Plain text document", "public.text"),
("HTML5 Video (WebM)", "org.webmproject.webm"),
("WebP image", "org.webmproject.webp"),
("PDF Document", "com.adobe.pdf"),
]
],
'UTImportedTypeDeclarations': [
{
"UTTypeConformsTo": ["public.data", "public.content"],
"UTTypeDescription": "MIME HTML document",
"UTTypeIconFile": "document.icns",
"UTTypeIdentifier": "org.ietf.mhtml",
"UTTypeReferenceURL": "https://www.ietf.org/rfc/rfc2557",
"UTTypeTagSpecification": {
"com.apple.ostype": "MHTM",
"public.filename-extension": ["mht", "mhtml"],
"public.mime-type": ["multipart/related", "application/x-mimearchive"],
},
},
{
"UTTypeConformsTo": ["public.audio"],
"UTTypeDescription": "Ogg Audio",
"UTTypeIconFile": "document.icns",
"UTTypeIdentifier": "org.xiph.ogg-audio",
"UTTypeReferenceURL": "https://xiph.org/ogg/",
"UTTypeTagSpecification": {
"public.filename-extension": ["ogg", "oga"],
"public.mime-type": ["audio/ogg"],
},
},
{
"UTTypeConformsTo": ["public.movie"],
"UTTypeDescription": "Ogg Video",
"UTTypeIconFile": "document.icns",
"UTTypeIdentifier": "org.xiph.ogv",
"UTTypeReferenceURL": "https://xiph.org/ogg/",
"UTTypeTagSpecification": {
"public.filename-extension": ["ogm", "ogv"],
"public.mime-type": ["video/ogg"],
},
},
],
# https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos # https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos
# #
# Keys based on Google Chrome's .app, except Bluetooth keys which seem to # Keys based on Google Chrome's .app, except Bluetooth keys which seem to