mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-01 21:31:04 +00:00
ezqms-1057: fix images in branded workspaces (#5979)
This commit is contained in:
parent
3dd78b5856
commit
cd5db6a9c3
@ -56,9 +56,9 @@ export function start (
|
|||||||
const pipelineFactory = createServerPipeline(metrics, dbUrl, { ...opt, externalStorage })
|
const pipelineFactory = createServerPipeline(metrics, dbUrl, { ...opt, externalStorage })
|
||||||
const sessionFactory = (token: Token, pipeline: Pipeline): Session => {
|
const sessionFactory = (token: Token, pipeline: Pipeline): Session => {
|
||||||
if (token.extra?.mode === 'backup') {
|
if (token.extra?.mode === 'backup') {
|
||||||
return new BackupClientSession(token, pipeline, opt.brandingMap)
|
return new BackupClientSession(token, pipeline)
|
||||||
}
|
}
|
||||||
return new ClientSession(token, pipeline, opt.brandingMap)
|
return new ClientSession(token, pipeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClose = startJsonRpc(getMetricsContext(), {
|
const onClose = startJsonRpc(getMetricsContext(), {
|
||||||
|
@ -24,6 +24,7 @@ import core, {
|
|||||||
TxProcessor,
|
TxProcessor,
|
||||||
cutObjectArray,
|
cutObjectArray,
|
||||||
toFindResult,
|
toFindResult,
|
||||||
|
type Branding,
|
||||||
type Account,
|
type Account,
|
||||||
type AttachedDoc,
|
type AttachedDoc,
|
||||||
type Class,
|
type Class,
|
||||||
@ -87,6 +88,7 @@ export class TServerStorage implements ServerStorage {
|
|||||||
triggerData = new Map<Metadata<any>, any>()
|
triggerData = new Map<Metadata<any>, any>()
|
||||||
|
|
||||||
liveQuery: LQ
|
liveQuery: LQ
|
||||||
|
branding: Branding | null
|
||||||
|
|
||||||
domainInfo = new Map<
|
domainInfo = new Map<
|
||||||
Domain,
|
Domain,
|
||||||
@ -119,6 +121,7 @@ export class TServerStorage implements ServerStorage {
|
|||||||
this.liveQuery = new LQ(this.newCastClient(hierarchy, modelDb, metrics))
|
this.liveQuery = new LQ(this.newCastClient(hierarchy, modelDb, metrics))
|
||||||
this.hierarchy = hierarchy
|
this.hierarchy = hierarchy
|
||||||
this.fulltext = indexFactory(this)
|
this.fulltext = indexFactory(this)
|
||||||
|
this.branding = options.branding
|
||||||
|
|
||||||
this.setModel(model)
|
this.setModel(model)
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export interface ServerStorage extends LowLevelStorage {
|
|||||||
close: () => Promise<void>
|
close: () => Promise<void>
|
||||||
loadModel: (last: Timestamp, hash?: string) => Promise<Tx[] | LoadModelResponse>
|
loadModel: (last: Timestamp, hash?: string) => Promise<Tx[] | LoadModelResponse>
|
||||||
workspaceId: WorkspaceIdWithUrl
|
workspaceId: WorkspaceIdWithUrl
|
||||||
branding?: string
|
branding: Branding | null
|
||||||
storageAdapter: StorageAdapter
|
storageAdapter: StorageAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { type BrandingMap, Doc, DocInfo, Domain, Ref, StorageIterator } from '@hcengineering/core'
|
import { Doc, DocInfo, Domain, Ref, StorageIterator } from '@hcengineering/core'
|
||||||
import { Pipeline, estimateDocSize } from '@hcengineering/server-core'
|
import { Pipeline, estimateDocSize } from '@hcengineering/server-core'
|
||||||
import { Token } from '@hcengineering/server-token'
|
import { Token } from '@hcengineering/server-token'
|
||||||
import { ClientSession, Session, type ClientSessionCtx } from '@hcengineering/server-ws'
|
import { ClientSession, Session, type ClientSessionCtx } from '@hcengineering/server-ws'
|
||||||
@ -30,10 +30,9 @@ export interface BackupSession extends Session {
|
|||||||
export class BackupClientSession extends ClientSession implements BackupSession {
|
export class BackupClientSession extends ClientSession implements BackupSession {
|
||||||
constructor (
|
constructor (
|
||||||
protected readonly token: Token,
|
protected readonly token: Token,
|
||||||
protected readonly _pipeline: Pipeline,
|
protected readonly _pipeline: Pipeline
|
||||||
protected readonly brandingMap: BrandingMap
|
|
||||||
) {
|
) {
|
||||||
super(token, _pipeline, brandingMap)
|
super(token, _pipeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
idIndex = 0
|
idIndex = 0
|
||||||
|
@ -82,7 +82,7 @@ describe('server', () => {
|
|||||||
return { docs: [] }
|
return { docs: [] }
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline, {}),
|
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline),
|
||||||
port: 3335,
|
port: 3335,
|
||||||
productId: '',
|
productId: '',
|
||||||
brandingMap: {},
|
brandingMap: {},
|
||||||
@ -183,7 +183,7 @@ describe('server', () => {
|
|||||||
return { docs: [] }
|
return { docs: [] }
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline, {}),
|
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline),
|
||||||
port: 3336,
|
port: 3336,
|
||||||
productId: '',
|
productId: '',
|
||||||
brandingMap: {},
|
brandingMap: {},
|
||||||
|
@ -32,9 +32,7 @@ import core, {
|
|||||||
type Tx,
|
type Tx,
|
||||||
type TxApplyIf,
|
type TxApplyIf,
|
||||||
type TxApplyResult,
|
type TxApplyResult,
|
||||||
type TxCUD,
|
type TxCUD
|
||||||
type Branding,
|
|
||||||
type BrandingMap
|
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { SessionContextImpl, createBroadcastEvent, type Pipeline } from '@hcengineering/server-core'
|
import { SessionContextImpl, createBroadcastEvent, type Pipeline } from '@hcengineering/server-core'
|
||||||
import { type Token } from '@hcengineering/server-token'
|
import { type Token } from '@hcengineering/server-token'
|
||||||
@ -58,8 +56,7 @@ export class ClientSession implements Session {
|
|||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
protected readonly token: Token,
|
protected readonly token: Token,
|
||||||
protected readonly _pipeline: Pipeline,
|
protected readonly _pipeline: Pipeline
|
||||||
protected readonly brandingMap: BrandingMap
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
getUser (): string {
|
getUser (): string {
|
||||||
@ -78,14 +75,6 @@ export class ClientSession implements Session {
|
|||||||
return this._pipeline
|
return this._pipeline
|
||||||
}
|
}
|
||||||
|
|
||||||
getBranding (brandingKey?: string): Branding | null {
|
|
||||||
if (brandingKey === undefined) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.brandingMap[brandingKey] ?? null
|
|
||||||
}
|
|
||||||
|
|
||||||
async ping (ctx: ClientSessionCtx): Promise<void> {
|
async ping (ctx: ClientSessionCtx): Promise<void> {
|
||||||
// console.log('ping')
|
// console.log('ping')
|
||||||
this.lastRequest = Date.now()
|
this.lastRequest = Date.now()
|
||||||
@ -127,7 +116,7 @@ export class ClientSession implements Session {
|
|||||||
this.token.extra?.admin === 'true',
|
this.token.extra?.admin === 'true',
|
||||||
[],
|
[],
|
||||||
this._pipeline.storage.workspaceId,
|
this._pipeline.storage.workspaceId,
|
||||||
this.getBranding(this._pipeline.storage.branding)
|
this._pipeline.storage.branding
|
||||||
)
|
)
|
||||||
await this._pipeline.tx(context, createTx)
|
await this._pipeline.tx(context, createTx)
|
||||||
const acc = TxProcessor.createDoc2Doc(createTx)
|
const acc = TxProcessor.createDoc2Doc(createTx)
|
||||||
@ -157,7 +146,7 @@ export class ClientSession implements Session {
|
|||||||
this.token.extra?.admin === 'true',
|
this.token.extra?.admin === 'true',
|
||||||
[],
|
[],
|
||||||
this._pipeline.storage.workspaceId,
|
this._pipeline.storage.workspaceId,
|
||||||
this.getBranding(this._pipeline.storage.branding)
|
this._pipeline.storage.branding
|
||||||
)
|
)
|
||||||
return await this._pipeline.findAll(context, _class, query, options)
|
return await this._pipeline.findAll(context, _class, query, options)
|
||||||
}
|
}
|
||||||
@ -180,7 +169,7 @@ export class ClientSession implements Session {
|
|||||||
this.token.extra?.admin === 'true',
|
this.token.extra?.admin === 'true',
|
||||||
[],
|
[],
|
||||||
this._pipeline.storage.workspaceId,
|
this._pipeline.storage.workspaceId,
|
||||||
this.getBranding(this._pipeline.storage.branding)
|
this._pipeline.storage.branding
|
||||||
)
|
)
|
||||||
await ctx.sendResponse(await this._pipeline.searchFulltext(context, query, options))
|
await ctx.sendResponse(await this._pipeline.searchFulltext(context, query, options))
|
||||||
}
|
}
|
||||||
@ -196,7 +185,7 @@ export class ClientSession implements Session {
|
|||||||
this.token.extra?.admin === 'true',
|
this.token.extra?.admin === 'true',
|
||||||
[],
|
[],
|
||||||
this._pipeline.storage.workspaceId,
|
this._pipeline.storage.workspaceId,
|
||||||
this.getBranding(this._pipeline.storage.branding)
|
this._pipeline.storage.branding
|
||||||
)
|
)
|
||||||
|
|
||||||
const result = await this._pipeline.tx(context, tx)
|
const result = await this._pipeline.tx(context, tx)
|
||||||
|
Loading…
Reference in New Issue
Block a user