Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP. docs: remove third-party panel name references from copy Drop and external m-ui product names from docs, UI strings, and code comments. Keep functional descriptions of server egress and WARP.
39 lines
973 B
Go
39 lines
973 B
Go
package protocol
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/kazeyukiro/3m-ui/backend/internal/database/models"
|
|
)
|
|
|
|
// ExportShares decodes a listener into the typed NodeModel and builds shares.
|
|
func ExportShares(l models.Listener, publicHost string, users []UserCred) ([]Share, error) {
|
|
node, err := DecodeNodeModel(l, users)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if h := strings.TrimSpace(publicHost); h != "" {
|
|
node.PublicHost = h
|
|
}
|
|
return DefaultCompileRegistry().BuildShares(node)
|
|
}
|
|
|
|
// ExportShareURIs returns only URI strings (compatibility with older callers).
|
|
func ExportShareURIs(l models.Listener, publicHost string, users []UserCred) ([]string, error) {
|
|
shares, err := ExportShares(l, publicHost, users)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]string, 0, len(shares))
|
|
for _, s := range shares {
|
|
if s.URI != "" {
|
|
out = append(out, s.URI)
|
|
}
|
|
}
|
|
if len(out) == 0 {
|
|
return nil, fmt.Errorf("no share URIs generated")
|
|
}
|
|
return out, nil
|
|
}
|