@napuketto/loader 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/host/self-host.cjs +44 -5
- package/package.json +1 -1
package/dist/host/self-host.cjs
CHANGED
|
@@ -1151,6 +1151,8 @@ function attachIpcServices(actions, services) {
|
|
|
1151
1151
|
forwardChannel(services.channel, stops);
|
|
1152
1152
|
forwardChannel(services.groupChannel, stops);
|
|
1153
1153
|
forwardChannel(services.friendChannel, stops);
|
|
1154
|
+
forwardChannel(services.recentContactChannel, stops);
|
|
1155
|
+
forwardChannel(services.loginChannel, stops);
|
|
1154
1156
|
return () => {
|
|
1155
1157
|
for (const stop of stops) stop();
|
|
1156
1158
|
for (const name of full.keys()) actions.delete(name);
|
|
@@ -1695,6 +1697,8 @@ async function assembleOb11AndSatori(kernel, services, loginResult) {
|
|
|
1695
1697
|
msgChannel: channel,
|
|
1696
1698
|
groupChannel: services.groupChannel,
|
|
1697
1699
|
buddyChannel: services.friendChannel,
|
|
1700
|
+
recentContactChannel: services.recentContactChannel,
|
|
1701
|
+
loginChannel: services.loginChannel,
|
|
1698
1702
|
msgApi: services.msgApi,
|
|
1699
1703
|
groupApi: services.groupApi,
|
|
1700
1704
|
friendApi: services.friendApi,
|
|
@@ -1827,6 +1831,32 @@ function buildLoaderLoggerOptions(logCfg, consoleEnabled, logFile, account) {
|
|
|
1827
1831
|
}
|
|
1828
1832
|
};
|
|
1829
1833
|
}
|
|
1834
|
+
/**
|
|
1835
|
+
* 批次三通道与桥(2026-11-01):RecentContactBridge(peer_pin_change 源)+
|
|
1836
|
+
* LoginBridge(bot_offline 源)。loginService 取自 wrapper 上下文(与
|
|
1837
|
+
* QrLoginSession 同源),缺失(老 kernel / 未 attach)时只跳过 Login 桥注册
|
|
1838
|
+
* ——通道保留,事件为空。
|
|
1839
|
+
*/
|
|
1840
|
+
function createBatch3Channels(kernel, ctx, session, log) {
|
|
1841
|
+
const recentContactChannel = new kernel.NTEventChannel("RecentContact");
|
|
1842
|
+
const recentContactBridge = new kernel.RecentContactBridge(session, recentContactChannel);
|
|
1843
|
+
recentContactBridge.register();
|
|
1844
|
+
const loginChannel = new kernel.NTEventChannel("Login");
|
|
1845
|
+
const loginService = ctx.wrapper?.loginService;
|
|
1846
|
+
let loginBridge = null;
|
|
1847
|
+
if (loginService !== null && loginService !== void 0) {
|
|
1848
|
+
loginBridge = new kernel.LoginBridge(loginService, loginChannel);
|
|
1849
|
+
loginBridge.register();
|
|
1850
|
+
} else log("bootstrap: loginService 不可用,Login 桥未注册(bot_offline 事件不可用)");
|
|
1851
|
+
return {
|
|
1852
|
+
recentContactChannel,
|
|
1853
|
+
loginChannel,
|
|
1854
|
+
unregister: () => {
|
|
1855
|
+
recentContactBridge.unregister();
|
|
1856
|
+
loginBridge?.unregister();
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1830
1860
|
/** 登录成功后创建 kernel 业务服务(channel/bridge/cache/apis)。失败返回 null。 */
|
|
1831
1861
|
async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
1832
1862
|
const ipcMode = env.NAPUTO_IPC === "1";
|
|
@@ -1869,6 +1899,7 @@ async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
|
1869
1899
|
const friendChannel = new kernel.NTEventChannel("Buddy");
|
|
1870
1900
|
const friendBridge = new kernel.FriendBridge(session, friendChannel);
|
|
1871
1901
|
friendBridge.register();
|
|
1902
|
+
const batch3 = createBatch3Channels(kernel, ctx, session, log);
|
|
1872
1903
|
const groupCache = new kernel.GroupCache({
|
|
1873
1904
|
channel: groupChannel,
|
|
1874
1905
|
groupApi
|
|
@@ -1881,6 +1912,11 @@ async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
|
1881
1912
|
buddyCache.register();
|
|
1882
1913
|
const groupNotifyApi = new kernel.GroupNotifyApi(session);
|
|
1883
1914
|
const ticketApi = new kernel.TicketApi(session);
|
|
1915
|
+
const richMediaApi = new kernel.RichMediaApi(session);
|
|
1916
|
+
const recentContactApi = new kernel.RecentContactApi(session);
|
|
1917
|
+
const profileApi = new kernel.ProfileApi(session);
|
|
1918
|
+
const profileLikeApi = new kernel.ProfileLikeApi(session);
|
|
1919
|
+
const webApi = new kernel.WebApi({ getCookies: (domain) => ticketApi.getCookies(domain, loginResult.uin) });
|
|
1884
1920
|
return {
|
|
1885
1921
|
kernel,
|
|
1886
1922
|
ctx,
|
|
@@ -1888,6 +1924,8 @@ async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
|
1888
1924
|
channel,
|
|
1889
1925
|
groupChannel,
|
|
1890
1926
|
friendChannel,
|
|
1927
|
+
recentContactChannel: batch3.recentContactChannel,
|
|
1928
|
+
loginChannel: batch3.loginChannel,
|
|
1891
1929
|
msgApi,
|
|
1892
1930
|
groupApi,
|
|
1893
1931
|
friendApi,
|
|
@@ -1895,11 +1933,11 @@ async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
|
1895
1933
|
buddyCache,
|
|
1896
1934
|
groupNotifyApi,
|
|
1897
1935
|
ticketApi,
|
|
1898
|
-
richMediaApi
|
|
1899
|
-
recentContactApi
|
|
1900
|
-
profileApi
|
|
1901
|
-
profileLikeApi
|
|
1902
|
-
webApi
|
|
1936
|
+
richMediaApi,
|
|
1937
|
+
recentContactApi,
|
|
1938
|
+
profileApi,
|
|
1939
|
+
profileLikeApi,
|
|
1940
|
+
webApi,
|
|
1903
1941
|
self: {
|
|
1904
1942
|
uin: loginResult.uin,
|
|
1905
1943
|
nickname: loginResult.nick ?? "",
|
|
@@ -1914,6 +1952,7 @@ async function createKernelServices(kernel, ctx, loginResult, logCfg) {
|
|
|
1914
1952
|
bridge.unregister();
|
|
1915
1953
|
groupBridge.unregister();
|
|
1916
1954
|
friendBridge.unregister();
|
|
1955
|
+
batch3.unregister();
|
|
1917
1956
|
groupCache.unregister();
|
|
1918
1957
|
buddyCache.unregister();
|
|
1919
1958
|
offMsgLogging();
|