mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
fix: register callbacks for getStatus, getServiceManifest, getContainerIp, getSslCertificate
These effects were passing the raw JS callback function through rpcRound without converting it to a CallbackId via context.callbacks.addCallback(). Since functions are dropped by JSON.stringify, the Rust side never received a callback, breaking the const() reactive pattern.
This commit is contained in:
@@ -187,9 +187,10 @@ export function makeEffects(context: EffectContext): Effects {
|
|||||||
getServiceManifest(
|
getServiceManifest(
|
||||||
...[options]: Parameters<T.Effects["getServiceManifest"]>
|
...[options]: Parameters<T.Effects["getServiceManifest"]>
|
||||||
) {
|
) {
|
||||||
return rpcRound("get-service-manifest", options) as ReturnType<
|
return rpcRound("get-service-manifest", {
|
||||||
T.Effects["getServiceManifest"]
|
...options,
|
||||||
>
|
callback: context.callbacks?.addCallback(options.callback) || null,
|
||||||
|
}) as ReturnType<T.Effects["getServiceManifest"]>
|
||||||
},
|
},
|
||||||
subcontainer: {
|
subcontainer: {
|
||||||
createFs(options: { imageId: string; name: string }) {
|
createFs(options: { imageId: string; name: string }) {
|
||||||
@@ -211,9 +212,10 @@ export function makeEffects(context: EffectContext): Effects {
|
|||||||
>
|
>
|
||||||
}) as Effects["exportServiceInterface"],
|
}) as Effects["exportServiceInterface"],
|
||||||
getContainerIp(...[options]: Parameters<T.Effects["getContainerIp"]>) {
|
getContainerIp(...[options]: Parameters<T.Effects["getContainerIp"]>) {
|
||||||
return rpcRound("get-container-ip", options) as ReturnType<
|
return rpcRound("get-container-ip", {
|
||||||
T.Effects["getContainerIp"]
|
...options,
|
||||||
>
|
callback: context.callbacks?.addCallback(options.callback) || null,
|
||||||
|
}) as ReturnType<T.Effects["getContainerIp"]>
|
||||||
},
|
},
|
||||||
getOsIp(...[]: Parameters<T.Effects["getOsIp"]>) {
|
getOsIp(...[]: Parameters<T.Effects["getOsIp"]>) {
|
||||||
return rpcRound("get-os-ip", {}) as ReturnType<T.Effects["getOsIp"]>
|
return rpcRound("get-os-ip", {}) as ReturnType<T.Effects["getOsIp"]>
|
||||||
@@ -244,9 +246,10 @@ export function makeEffects(context: EffectContext): Effects {
|
|||||||
>
|
>
|
||||||
},
|
},
|
||||||
getSslCertificate(options: Parameters<T.Effects["getSslCertificate"]>[0]) {
|
getSslCertificate(options: Parameters<T.Effects["getSslCertificate"]>[0]) {
|
||||||
return rpcRound("get-ssl-certificate", options) as ReturnType<
|
return rpcRound("get-ssl-certificate", {
|
||||||
T.Effects["getSslCertificate"]
|
...options,
|
||||||
>
|
callback: context.callbacks?.addCallback(options.callback) || null,
|
||||||
|
}) as ReturnType<T.Effects["getSslCertificate"]>
|
||||||
},
|
},
|
||||||
getSslKey(options: Parameters<T.Effects["getSslKey"]>[0]) {
|
getSslKey(options: Parameters<T.Effects["getSslKey"]>[0]) {
|
||||||
return rpcRound("get-ssl-key", options) as ReturnType<
|
return rpcRound("get-ssl-key", options) as ReturnType<
|
||||||
@@ -308,7 +311,10 @@ export function makeEffects(context: EffectContext): Effects {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getStatus(...[o]: Parameters<T.Effects["getStatus"]>) {
|
getStatus(...[o]: Parameters<T.Effects["getStatus"]>) {
|
||||||
return rpcRound("get-status", o) as ReturnType<T.Effects["getStatus"]>
|
return rpcRound("get-status", {
|
||||||
|
...o,
|
||||||
|
callback: context.callbacks?.addCallback(o.callback) || null,
|
||||||
|
}) as ReturnType<T.Effects["getStatus"]>
|
||||||
},
|
},
|
||||||
/// DEPRECATED
|
/// DEPRECATED
|
||||||
setMainStatus(o: { status: "running" | "stopped" }): Promise<null> {
|
setMainStatus(o: { status: "running" | "stopped" }): Promise<null> {
|
||||||
|
|||||||
Reference in New Issue
Block a user