mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
- Add URL plugin effects (register, export_url, clear_urls) in core - Add PluginHostnameInfo, HostnameMetadata::Plugin, and plugin registration types - Implement plugin URL table in web UI with tableAction button and rowAction overflow menus - Thread urlPluginMetadata (packageId, hostId, interfaceId, internalPort) as prefill to actions - Add prefill support to PackageActionData so metadata passes through form dialogs - Add i18n translations for plugin error messages - Clean up plugin URLs on package uninstall
29 lines
887 B
TypeScript
29 lines
887 B
TypeScript
import { Effects, PluginHostnameInfo } from '../types'
|
|
|
|
export type SetExportedUrls = (opts: { effects: Effects }) => Promise<void>
|
|
export type UpdateExportedUrls = (effects: Effects) => Promise<null>
|
|
export type SetupExportedUrls = (fn: SetExportedUrls) => UpdateExportedUrls
|
|
|
|
export const setupExportedUrls: SetupExportedUrls = (fn: SetExportedUrls) => {
|
|
return (async (effects: Effects) => {
|
|
const urls: PluginHostnameInfo[] = []
|
|
await fn({
|
|
effects: {
|
|
...effects,
|
|
plugin: {
|
|
...effects.plugin,
|
|
url: {
|
|
...effects.plugin.url,
|
|
exportUrl: (params) => {
|
|
urls.push(params.hostnameInfo)
|
|
return effects.plugin.url.exportUrl(params)
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
await effects.plugin.url.clearUrls({ except: urls })
|
|
return null
|
|
}) as UpdateExportedUrls
|
|
}
|