forked from boos/BoosAPI
feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
import type { ElementRef } from '@angular/core'
|
||||
import type { AngularRenderableNode, AngularRenderContext } from '../shared/node-helpers'
|
||||
import { ChangeDetectionStrategy, Component, Input, ViewChild } from '@angular/core'
|
||||
import { NON_STRUCTURING_HTML_TAGS } from 'stream-markdown-parser'
|
||||
import { renderMarkdownNodeToHtml } from '../../renderMarkdownHtml'
|
||||
import { sanitizeHtmlContent } from '../../sanitizeHtmlContent'
|
||||
import { getString } from '../shared/node-helpers'
|
||||
|
||||
@Component({
|
||||
selector: 'markstream-angular-html-block-node',
|
||||
standalone: true,
|
||||
template: '<div #containerRef class="html-block-node"></div>',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class HtmlBlockNodeComponent {
|
||||
@Input({ required: true }) node!: AngularRenderableNode
|
||||
@Input() context?: AngularRenderContext
|
||||
@ViewChild('containerRef', { static: true }) private readonly containerRef?: ElementRef<HTMLElement>
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.commitContent()
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.commitContent()
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
const container = this.containerRef?.nativeElement
|
||||
if (container)
|
||||
container.innerHTML = ''
|
||||
}
|
||||
|
||||
private commitContent() {
|
||||
const container = this.containerRef?.nativeElement
|
||||
if (!container)
|
||||
return
|
||||
|
||||
const content = getString((this.node as any)?.content)
|
||||
const tag = getString((this.node as any)?.tag).trim().toLowerCase()
|
||||
const children = Array.isArray((this.node as any)?.children) ? (this.node as any).children : []
|
||||
if (!content) {
|
||||
container.innerHTML = ''
|
||||
return
|
||||
}
|
||||
|
||||
if (this.context?.allowHtml === false || ((this.node as any)?.loading && !(this.node as any)?.autoClosed)) {
|
||||
container.textContent = content
|
||||
return
|
||||
}
|
||||
|
||||
if (tag && children.length > 0 && !NON_STRUCTURING_HTML_TAGS.has(tag)) {
|
||||
container.innerHTML = renderMarkdownNodeToHtml(this.node, {
|
||||
allowHtml: this.context?.allowHtml,
|
||||
customHtmlTags: this.context?.customHtmlTags,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
container.innerHTML = sanitizeHtmlContent(content)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user