Skip to content

Commit 984e153

Browse files
committed
fix: AU_MAIN_TYPE, TCP companion, GitHub Releases publishing
- CMakeLists: AU_MAIN_TYPE kAudioUnitType_Effect (was "aufx" — broke AU build) - CompanionLink.mm: switch from Unix socket to TCP:59812 (matches companion) - WaterMorphCompanion.swift: fix WKUserContentController API (add vs addScriptMessageHandler) - CI: add GitHub Release publishing (tag=latest) for Mac .pkg and Windows .exe URLs: /releases/latest/download/Water_Morph_1.0.0_macOS.pkg /releases/latest/download/Water_Morph_1.0.0_Windows.exe
1 parent 9e7feda commit 984e153

4 files changed

Lines changed: 59 additions & 13 deletions

File tree

.github/workflows/build-plugin.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ on:
99
- 'CMakeLists.txt'
1010
- '.github/workflows/build-plugin.yml'
1111
- 'CompanionWin/**'
12+
- 'Companion/**'
1213
workflow_dispatch:
1314

15+
permissions:
16+
contents: write
17+
1418
jobs:
1519
# ── Mac (AU + VST3, Universal) ─────────────────────────────────────────────
1620
build-mac:
@@ -58,6 +62,15 @@ jobs:
5862
path: Water_Morph_1.0.0_macOS.pkg
5963
retention-days: 14
6064

65+
- name: Publish Mac to GitHub Release
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
tag_name: latest
69+
name: "Water Morph — Latest Build"
70+
prerelease: true
71+
make_latest: true
72+
files: Water_Morph_1.0.0_macOS.pkg
73+
6174
# ── Windows (VST3, x64) ────────────────────────────────────────────────────
6275
build-windows:
6376
runs-on: windows-2022
@@ -128,3 +141,12 @@ jobs:
128141
name: Water_Morph_1.0.0_Windows
129142
path: CompanionWin/dist/*.exe
130143
retention-days: 14
144+
145+
- name: Publish Windows to GitHub Release
146+
uses: softprops/action-gh-release@v2
147+
with:
148+
tag_name: latest
149+
name: "Water Morph — Latest Build"
150+
prerelease: true
151+
make_latest: true
152+
files: CompanionWin/dist/*.exe

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ juce_add_plugin(Morph
2626
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
2727
DESCRIPTION "Water catalog browser and real-time morphing plugin"
2828
VST3_CATEGORIES "Fx"
29-
AU_MAIN_TYPE "aufx"
29+
AU_MAIN_TYPE kAudioUnitType_Effect
3030
)
3131

3232
juce_generate_juce_header(Morph)

Companion/WaterMorphCompanion.swift

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,10 +1688,21 @@ final class WMWebLibraryVC: NSViewController, WKNavigationDelegate, WKScriptMess
16881688

16891689
override func loadView() {
16901690
let config = WKWebViewConfiguration()
1691-
config.userContentController.add(WKMessageProxy(self), name: "morphHover")
1692-
config.userContentController.add(WKMessageProxy(self), name: "morphSelect")
1693-
config.userContentController.add(WKMessageProxy(self), name: "morphCopy")
1694-
config.userContentController.add(WKMessageProxy(self), name: "morphPlayerState")
1691+
// Use the non-deprecated addScriptMessageHandler(_:contentWorld:name:) on macOS 11+.
1692+
// The legacy add(_:name:) overload was deprecated in macOS 14 (Sonoma) and triggers
1693+
// an internal WebKit precondition (EXC_BREAKPOINT) on macOS 14+ at call time.
1694+
let proxy = WKMessageProxy(self)
1695+
if #available(macOS 11.0, *) {
1696+
config.userContentController.add(proxy, contentWorld: .page, name: "morphHover")
1697+
config.userContentController.add(proxy, contentWorld: .page, name: "morphSelect")
1698+
config.userContentController.add(proxy, contentWorld: .page, name: "morphCopy")
1699+
config.userContentController.add(proxy, contentWorld: .page, name: "morphPlayerState")
1700+
} else {
1701+
config.userContentController.add(proxy, name: "morphHover")
1702+
config.userContentController.add(proxy, name: "morphSelect")
1703+
config.userContentController.add(proxy, name: "morphCopy")
1704+
config.userContentController.add(proxy, name: "morphPlayerState")
1705+
}
16951706
// Auth UserScript is injected dynamically in loadWebUI() so it always
16961707
// uses the latest (possibly refreshed) tokens, never a stale snapshot.
16971708

@@ -2032,6 +2043,18 @@ final class WMWebLibraryVC: NSViewController, WKNavigationDelegate, WKScriptMess
20322043

20332044
deinit {
20342045
webView?.removeObserver(self, forKeyPath: #keyPath(WKWebView.url))
2046+
// Remove message handlers to break the WebKit internal retain and avoid
2047+
// the "handler removed while still registered" assertion on dealloc.
2048+
let uc = webView?.configuration.userContentController
2049+
if #available(macOS 11.0, *) {
2050+
for name in ["morphHover", "morphSelect", "morphCopy", "morphPlayerState"] {
2051+
uc?.removeScriptMessageHandler(forName: name, contentWorld: .page)
2052+
}
2053+
} else {
2054+
for name in ["morphHover", "morphSelect", "morphCopy", "morphPlayerState"] {
2055+
uc?.removeScriptMessageHandler(forName: name)
2056+
}
2057+
}
20352058
}
20362059

20372060
override func observeValue(forKeyPath keyPath: String?, of object: Any?,

Source/CompanionLink.mm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#import <Cocoa/Cocoa.h>
22
#include "CompanionLink.h"
33
#include <sys/socket.h>
4-
#include <sys/un.h>
4+
#include <netinet/in.h>
5+
#include <arpa/inet.h>
56
#include <unistd.h>
67

7-
static constexpr const char* kSocketPath = "/tmp/water-morph.sock";
8-
static constexpr int kTimeoutMs = 3000;
8+
static constexpr uint16_t kTCPPort = 59812;
9+
static constexpr int kTimeoutMs = 3000;
910

1011
//==============================================================================
1112
CompanionLink& CompanionLink::get()
@@ -44,13 +45,13 @@
4445
{
4546
disconnect();
4647

47-
int fd = socket (AF_UNIX, SOCK_STREAM, 0);
48+
int fd = socket (AF_INET, SOCK_STREAM, 0);
4849
if (fd < 0) return false;
4950

50-
// Non-blocking connect with a short timeout
51-
struct sockaddr_un addr = {};
52-
addr.sun_family = AF_UNIX;
53-
strlcpy (addr.sun_path, kSocketPath, sizeof (addr.sun_path));
51+
struct sockaddr_in addr = {};
52+
addr.sin_family = AF_INET;
53+
addr.sin_port = htons (kTCPPort);
54+
addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
5455

5556
if (::connect (fd, (struct sockaddr*) &addr, sizeof (addr)) < 0)
5657
{

0 commit comments

Comments
 (0)