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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
echo ::set-output name=TXZ_PATH::$(make where-txz 2>/dev/null | tail -n1)
- name: Build All Apps
run: |
make allapps
make XCODE=1 allapps
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
- name: Create Package
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bundle_untracked ?= 0
appnames = $(patsubst $(macpin_sites)/%,%.app,$(wildcard $(macpin_sites)/*))

usage help:
@printf '\nusage:\tmake (V=1) <target>\n\ntargets:\n%s'
@printf '\nusage:\tmake (V=1) (XCODE=1) <target>\n\ntargets:\n%s'
@printf '\t%s\n' allapps reinstall uninstall test test.app sites/*

include eXcode.mk
Expand Down Expand Up @@ -129,6 +129,7 @@ GH_RELEASE_JSON = '{"tag_name": "v$(VERSION)","target_commitish": "master","name

$(xcassets)/%.xcassets: $(macpin_sites)/%/icon.png
$(swiftrun_mac) iconify $(icontypes) $< $@
iconutil --convert icns $@/Icon.iconset

$(xcassets)/%.xcassets: templates/xcassets/$(platform)/%/*.png
for i in $^; do $(swiftrun_mac) iconify --imageset $$i $@; done
Expand Down Expand Up @@ -258,6 +259,7 @@ $(appdir)/%.app/Assets.car: $(xcassets)/%.xcassets $(xcassets)/icons8.xcassets
xcrun actool --output-format human-readable-text --notices --warnings --print-contents --output-partial-info-plist $@.plist \
--platform $(sdk) --minimum-deployment-target $(target_ver_ios) --target-device iphone --target-device ipad --app-icon AppIcon \
--compress-pngs --compile $(dir $@) $(realpath $(filter %.xcassets, $^)) > /dev/null
cp $(realpath $(filter %.xcassets, $^)/Icon.icns) $(dir $@)/
test -f $@ || { echo "error: $@ was not created by actool!" && cat $@.plist && exit 1; }

$(appdir)/%.app/LaunchScreen.nib: templates/$(platform)/LaunchScreen.xib
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Custom URL schemes can also be registered to launch a MacPin App from any other

## Included Apps in the [Release](https://github.com/kfix/MacPin/releases)

### selfhosterings
* [Home Assistant.app](https://my.home-assistant.io)

### Gooblers
* [Google Drive.app](https://drive.google.com)
* [Google Photos.app](https://photos.google.com)
Expand All @@ -38,7 +41,7 @@ Custom URL schemes can also be registered to launch a MacPin App from any other

### MetaVerses
* [Facebook.app](https://m.facebook.com/home.php) (mobile version!)
* [Messenger.app](https://www.messenger.com/hangouts)
* [Messenger.app](https://www.messenger.com/)
* [WhatsApp.app](https://web.whatsapp.com)

### et cetera
Expand Down Expand Up @@ -95,7 +98,8 @@ app.on('AppFinishedLaunching', function() {
```

## Hacking MacPin
Building `main` branch requires [macOS 13 "Ventura" with Xcode 14+](https://developer.apple.com/xcode/system-requirements/).
Building `main` branch requires [macOS 13 "Ventura" with Xcode 14+](https://developer.apple.com/xcode/system-requirements/).
Later versions of macOS can build with the [Command Line Tools](https://developer.apple.com/documentation/xcode/installing-the-command-line-tools#Install-the-Command-Line-Tools-package-in-Terminal).

All other branches are obsolete & archived for users locked on older macOS (hardware),
but they will recieve no updates.
Expand Down
6 changes: 6 additions & 0 deletions Sources/MacPin/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ final class MPWebView: WKWebView, WebViewScriptExports {
configuration.processPool = configuration.processPool ?? (MPWebView.self.sharedWebProcessPool)!
}

// if makeInsecure:
//configuration.processPool._registerURLSchemeAsSecure("http")
//configuration.processPool._registerURLSchemeAsBypassingContentSecurityPolicy("http")
//configuration.processPool._registerURLSchemeAsBypassingContentSecurityPolicy("https")

self.init(frame: CGRect.zero, configuration: configuration) // This is the real init()
// its an ObjC++ ctor which is why we couldn't override its impl to do these defaultings

Expand All @@ -702,6 +707,7 @@ final class MPWebView: WKWebView, WebViewScriptExports {
if let context = context {
"http".withCString { http in
WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(context, WKStringCreateWithUTF8CString(http)) // FIXME: makeInsecure() toggle!
WKContextRegisterURLSchemeAsSecure(context, WKStringCreateWithUTF8CString(http)) // FIXME: makeInsecure() toggle!
}
"https".withCString { https in
WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(context, WKStringCreateWithUTF8CString(https))
Expand Down
7 changes: 1 addition & 6 deletions eXcode.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,11 @@ verbose ?=
###################
# swift scaffolding
###################
# https://github.com/apple/swift-driver
ifeq (1,$(CLTOOLS))
ifneq (1,$(XCODE))
sdkpath := /$(shell pkgutil --volume / --only-dirs --regexp --files com.apple.pkg.CLTools.* | grep -m1 -E SDKs/MacOSX\\d+.*.sdk$$)
$(info [$(eXcode)] $$(sdkpath) := $(sdkpath))
swiftc := /$(shell pkgutil --volume / --only-dirs --files com.apple.pkg.CLTools_Executables | grep -m1 usr/bin$$)/swiftc -sdk $(sdk) -target $(arch)-$(target_$(platform)) $(verbose)

# not a thing anymore
#swiftbuildbin := /$(patsubst %-build,%,$(shell pkgutil --volume / --only-files --files com.apple.pkg.CLTools_Executables | grep -m1 bin/swift-build$$))
swiftbuildbin := /usr/bin/swift
### XXX: appears CLTools doesn't ship SPM libraries yet, so Package.swift can't be compiled
else
sdkpath := $(shell xcrun --show-sdk-path --sdk $(sdk))
swiftc := xcrun -sdk $(sdk) swiftc -target $(arch)-$(target_$(platform)) $(verbose)
Expand Down
5 changes: 5 additions & 0 deletions modules/WebKitPrivates/WKProcessPoolPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
//- (void)_automationCapabilitiesDidChange WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
//- (void)_setAutomationSession:(_WKAutomationSession *)automationSession WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);

- (void)_registerURLSchemeAsCanDisplayOnlyIfCanRequest:(NSString *)scheme WK_API_AVAILABLE(macos(10.14), ios(12.0));
- (void)_registerURLSchemeAsSecure:(NSString *)scheme WK_API_AVAILABLE(macos(12.0), ios(15.0));
- (void)_registerURLSchemeAsBypassingContentSecurityPolicy:(NSString *)scheme WK_API_AVAILABLE(macos(12.0), ios(15.0));
- (void)_setDomainRelaxationForbiddenForURLScheme:(NSString *)scheme WK_API_AVAILABLE(macos(12.0), ios(15.0));

// Test only. Returns web processes running web pages (does not include web processes running service workers)
- (size_t)_webPageContentProcessCount WK_API_AVAILABLE(macos(10.13.4), ios(11.3));

Expand Down
10 changes: 4 additions & 6 deletions sites/Facebook/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
var delegate = {}; // our delegate to receive events from the webview app
var fbTab, fb = {
url: "https://m.facebook.com/home.php",
preinject: ['unpreloader'], // this prevents buffering every video in a feed. If you have a fast Mac and Internet, comment out this line
useSystemAppearance: true,
//preinject: ['unpreloader'], // this prevents buffering every video in a feed. If you have a fast Mac and Internet, comment out this line
//postinject: ['styler'], agent: "Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B410 Safari/600.1.4"
agent: "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2311.38 Mobile Safari/537.36" //news-feed on Chromedroid is full-width
//agent: "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2311.38 Mobile Safari/537.36" //news-feed on Chromedroid is full-width
};
fbTab = $.browser.tabSelected = new $.WebView(fb);
$.browser.addShortcut("Facebook Home", fb);
Expand All @@ -21,9 +22,6 @@ delegate.setAgent = function(agent) { $.browser.tabSelected.userAgent = agent; }
$.browser.addShortcut('UA: Android 5 / Chrome 36', ["setAgent", "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.2311.38 Mobile Safari/537.36"]);
// FB sets margin-* to be 0 on a bunch of elements (header jewels) for chr36

let enDarken = require('enDarken.js');
$.browser.addShortcut('Dark Mode', [], enDarken);

function search(query) {
$.browser.tabSelected = fbTab;
//fbTab.load_url("https://m.facebook.com/graphsearch/str/" + query + "/keywords_top?ref=content_filter&source=typeahead")
Expand Down Expand Up @@ -58,7 +56,7 @@ delegate.handleUserInputtedInvalidURL = function(query) {
};

delegate.AppFinishedLaunching = function() {
$.app.registerURLScheme('facebook');
//$.app.registerURLScheme('facebook');
//$.app.registerURLScheme('fb'); // claimed by AddressBookUrlForwarder.app http://apple.stackexchange.com/a/105047
//`open -a AddressBookUrlForwarder.app fb://profile/4` to see the Zuckster in safari ...

Expand Down
5 changes: 2 additions & 3 deletions sites/Google_Calendar/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var delegate = {}; // our delegate to receive events from the webview app
var calTab, calendar = {
transparent: false,
useSystemAppearance: true,
url: "https://calendar.google.com"
};
var calendarAlt = Object.assign({}, calendar, {url: "https://calendar.google.com/calendar/b/1"});
Expand Down Expand Up @@ -144,6 +145,7 @@ delegate.decideNavigationForURL = function(url, tab) {
!addr.startsWith("//www.youtube.com") && // yt vids are usually embedded players
!addr.startsWith("//youtube.googleapis.com/embed/") &&
!addr.startsWith("//www.google.com/a/") &&
!addr.startsWith("//ogs.google.com") &&
!addr.startsWith("//myaccount.google.com") &&
!addr.startsWith("//www.google.com/tools/feedback/content_frame") &&
!addr.startsWith("//www.google.com/settings")
Expand Down Expand Up @@ -174,8 +176,6 @@ delegate.handleDragAndDroppedURLs = function(urls) {
}
}

let enDarken = require('enDarken.js');

delegate.AppFinishedLaunching = function() {
//$.app.registerURLScheme('gcalendar');
//$.app.registerUTI('dyn.???'); // *.ical
Expand All @@ -197,7 +197,6 @@ delegate.AppFinishedLaunching = function() {
);
}

$.browser.addShortcut('Paint It Black', [], enDarken);

};
delegate; //return this to macpin
9 changes: 3 additions & 6 deletions sites/Google_Chat/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ let browser = new BrowserWindow();

const chat = {
url: "https://chat.google.com",
useSystemAppearance: true
};
let chatTab = new WebView(chat); // start loading right way, its a big Closure app
let chatTab = new WebView(chat); // start loading right way, its a big app

function unhideApp(tab) {
if (tab) browser.tabSelected = tab;
browser.unhideApp();
};

const enDarken = require('enDarken.js');

const setAgent = function(agent, tab) { tab.userAgent = agent; };
// looks like a reload has to be done for this to take full effect.

app.on("decideNavigationForClickedURL", function(url, tab, mainFrame) {
if (
!url.startsWith("https://accounts.google.com")
&& !url.startsWith("https://hangouts.google.com")
&& !url.startsWith("https://ogs.google.com")
&& !url.startsWith("https://www.google.com/a/")
&& !url.startsWith("https://g.co")
) { // open all links externally except those above
Expand Down Expand Up @@ -57,11 +56,9 @@ app.on('handleClickedNotification', (note) => {

app.on('AppWillFinishLaunching', (AppUI) => {
browser.addShortcut("Log into Google Account", "https://accounts.google.com/signin");
browser.addShortcut('Dark Mode', [], enDarken);
browser.addShortcut('UA: default', [false], setAgent);

AppUI.browserController = browser; // make sure main app menu can get at our shortcuts
enDarken(chatTab);
});


Expand Down
10 changes: 3 additions & 7 deletions sites/Google_Drive/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

var delegate = {}; // our delegate to receive events from the webview app
var driveTab, drive = {
url: "https://drive.google.com"
url: "https://drive.google.com",
useSystemAppearance: true,
};
var driveAlt = Object.assign({}, drive, {url: "https://drive.google.com/drive/u/1"});
var sheets = Object.assign({}, drive, {url: "https://docs.google.com/spreadsheets/"});
Expand Down Expand Up @@ -142,6 +143,7 @@ delegate.decideNavigationForURL = function(url, tab) {
!addr.startsWith("//www.youtube.com") && // yt vids are usually embedded players
!addr.startsWith("//youtube.googleapis.com/embed/") &&
!addr.startsWith("//www.google.com/a/") &&
!addr.startsWith("//ogs.google.com") &&
!addr.startsWith("//myaccount.google.com") &&
!addr.startsWith("//www.google.com/tools/feedback/content_frame") &&
!addr.startsWith("//www.google.com/settings")
Expand Down Expand Up @@ -172,8 +174,6 @@ delegate.handleDragAndDroppedURLs = function(urls) {
}
}

let enDarken = require('enDarken.js');

delegate.AppFinishedLaunching = function() {
$.app.registerURLScheme('gdrive');
//$.app.registerURLScheme('googledrive'); //iOS
Expand All @@ -187,7 +187,6 @@ delegate.AppFinishedLaunching = function() {
$.browser.addShortcut('Presentations', presentation);
$.browser.addShortcut("Add a Google log-in", 'https://accounts.google.com/AddSession');
$.browser.addShortcut('Use next Google log-in', ['gotoNextGoogleAccount']);
$.browser.addShortcut("Install 'Open in Google Drive app' service", `http://github.com/kfix/MacPin/tree/master/extras/${escape('Open in Google Drive app.workflow')}`);
$.browser.addShortcut('Enable Redirection to external domains', ['toggleRedirection', true]);
$.browser.addShortcut('Disable Redirection (default)', ['toggleRedirection', false]);

Expand All @@ -201,8 +200,5 @@ delegate.AppFinishedLaunching = function() {
}
);
}

$.browser.addShortcut('Paint It Black', [], enDarken);

};
delegate; //return this to macpin
6 changes: 3 additions & 3 deletions sites/Google_Maps/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
var delegate = {}; // our delegate to receive events from the webview app
var mapsTab, maps = {
url: "https://maps.google.com",
useSystemAppearance: true,
allowsMagnification: false // lets gmaps JS handle pinch-zooms
};
var mapsAlt = Object.assign({}, maps, {url: "https://www.google.com/maps/?authuser=1"});
Expand Down Expand Up @@ -59,6 +60,8 @@ delegate.decideNavigationForURL = function(url, tab) {
if (!addr.startsWith("//maps.google.com") &&
!addr.startsWith("//google.com/maps/") &&
!addr.startsWith("//accounts.google.com") &&
!addr.startsWith("//accounts.youtube.com") &&
!addr.startsWith("//ogs.google.com") &&
!addr.startsWith("//www.google.com/a/") &&
!addr.startsWith("//places.google.com") &&
!addr.startsWith("//plus.google.com") &&
Expand Down Expand Up @@ -99,8 +102,6 @@ delegate.handleDragAndDroppedURLs = function(urls) {
}
}

let enDarken = require('enDarken.js');

delegate.AppFinishedLaunching = function() {
$.app.registerURLScheme('gmaps');
//$.app.registerURLScheme('googlemaps'); //IOS?
Expand All @@ -113,7 +114,6 @@ delegate.AppFinishedLaunching = function() {
$.browser.addShortcut('Google Maps API Team blog', "http://googlegeodevelopers.blogspot.com");
$.browser.addShortcut('Classic gMaps', "http://gokml.net/maps");
$.browser.addShortcut("Install 'Show Address in Google Maps app' service", `http://github.com/kfix/MacPin/tree/master/extras/${escape('Show Address in Google Maps app.workflow')}`);
$.browser.addShortcut('Dark Mode', [], enDarken);

// TODO: add "Open in Apple Maps", send it http://maps.apple.com lat & long
// https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Expand Down
8 changes: 3 additions & 5 deletions sites/Google_Voice/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let browser = new BrowserWindow();

const voice = {
url: "https://voice.google.com",
useSystemAppearance: true,
postinject: ["automators"]
};
let voiceTab = new WebView(voice); // start loading right away, it's a big app
Expand All @@ -23,12 +24,9 @@ const setAgent = function(agent, tab) { tab.userAgent = agent; };
app.on("decideNavigationForClickedURL", function(url, tab, mainFrame) {
if (
!url.startsWith("https://talkgadget.google.com")
&& !url.startsWith("https://ogs.google.com")
&& !url.startsWith("https://accounts.google.com")
&& !url.startsWith("https://hangouts.google.com")
&& !url.startsWith("https://plus.google.com/hangouts/")
&& !url.startsWith("https://www.google.com/a/")
&& !url.startsWith(meet.url)
&& !url.startsWith(allo.url)
&& !url.startsWith(voice.url)
&& !url.startsWith("https://g.co")
) { // open all links externally except those above
Expand Down Expand Up @@ -77,7 +75,7 @@ app.on('handleUserInputtedInvalidURL', function(query, tab) {
return false;
});

app.on('launchURL', function(url) { // app.openURL(/[sms|hangouts|tel]:.*/) calls this
app.on('launchURL', function(url) { // app.openURL(/[sms|tel]:.*/) calls this
console.log("app.js: launching " + url);
var comps = url.split(':'),
scheme = comps.shift(),
Expand Down
Loading
Loading