mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-03 08:57:14 +03: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 sessionFactory = (token: Token, pipeline: Pipeline): Session => {
|
||||
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(), {
|
||||
|
@ -24,6 +24,7 @@ import core, {
|
||||
TxProcessor,
|
||||
cutObjectArray,
|
||||
toFindResult,
|
||||
type Branding,
|
||||
type Account,
|
||||
type AttachedDoc,
|
||||
type Class,
|
||||
@ -87,6 +88,7 @@ export class TServerStorage implements ServerStorage {
|
||||
triggerData = new Map<Metadata<any>, any>()
|
||||
|
||||
liveQuery: LQ
|
||||
branding: Branding | null
|
||||
|
||||
domainInfo = new Map<
|
||||
Domain,
|
||||
@ -119,6 +121,7 @@ export class TServerStorage implements ServerStorage {
|
||||
this.liveQuery = new LQ(this.newCastClient(hierarchy, modelDb, metrics))
|
||||
this.hierarchy = hierarchy
|
||||
this.fulltext = indexFactory(this)
|
||||
this.branding = options.branding
|
||||
|
||||
this.setModel(model)
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export interface ServerStorage extends LowLevelStorage {
|
||||
close: () => Promise<void>
|
||||
loadModel: (last: Timestamp, hash?: string) => Promise<Tx[] | LoadModelResponse>
|
||||
workspaceId: WorkspaceIdWithUrl
|
||||
branding?: string
|
||||
branding: Branding | null
|
||||
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 { Token } from '@hcengineering/server-token'
|
||||
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 {
|
||||
constructor (
|
||||
protected readonly token: Token,
|
||||
protected readonly _pipeline: Pipeline,
|
||||
protected readonly brandingMap: BrandingMap
|
||||
protected readonly _pipeline: Pipeline
|
||||
) {
|
||||
super(token, _pipeline, brandingMap)
|
||||
super(token, _pipeline)
|
||||
}
|
||||
|
||||
idIndex = 0
|
||||
|
@ -82,7 +82,7 @@ describe('server', () => {
|
||||
return { docs: [] }
|
||||
}
|
||||
}),
|
||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline, {}),
|
||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline),
|
||||
port: 3335,
|
||||
productId: '',
|
||||
brandingMap: {},
|
||||
@ -183,7 +183,7 @@ describe('server', () => {
|
||||
return { docs: [] }
|
||||
}
|
||||
}),
|
||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline, {}),
|
||||
sessionFactory: (token, pipeline) => new ClientSession(token, pipeline),
|
||||
port: 3336,
|
||||
productId: '',
|
||||
brandingMap: {},
|
||||
|
@ -32,9 +32,7 @@ import core, {
|
||||
type Tx,
|
||||
type TxApplyIf,
|
||||
type TxApplyResult,
|
||||
type TxCUD,
|
||||
type Branding,
|
||||
type BrandingMap
|
||||
type TxCUD
|
||||
} from '@hcengineering/core'
|
||||
import { SessionContextImpl, createBroadcastEvent, type Pipeline } from '@hcengineering/server-core'
|
||||
import { type Token } from '@hcengineering/server-token'
|
||||
@ -58,8 +56,7 @@ export class ClientSession implements Session {
|
||||
|
||||
constructor (
|
||||
protected readonly token: Token,
|
||||
protected readonly _pipeline: Pipeline,
|
||||
protected readonly brandingMap: BrandingMap
|
||||
protected readonly _pipeline: Pipeline
|
||||
) {}
|
||||
|
||||
getUser (): string {
|
||||
@ -78,14 +75,6 @@ export class ClientSession implements Session {
|
||||
return this._pipeline
|
||||
}
|
||||
|
||||
getBranding (brandingKey?: string): Branding | null {
|
||||
if (brandingKey === undefined) {
|
||||
return null
|
||||
}
|
||||
|
||||
return this.brandingMap[brandingKey] ?? null
|
||||
}
|
||||
|
||||
async ping (ctx: ClientSessionCtx): Promise<void> {
|
||||
// console.log('ping')
|
||||
this.lastRequest = Date.now()
|
||||
@ -127,7 +116,7 @@ export class ClientSession implements Session {
|
||||
this.token.extra?.admin === 'true',
|
||||
[],
|
||||
this._pipeline.storage.workspaceId,
|
||||
this.getBranding(this._pipeline.storage.branding)
|
||||
this._pipeline.storage.branding
|
||||
)
|
||||
await this._pipeline.tx(context, createTx)
|
||||
const acc = TxProcessor.createDoc2Doc(createTx)
|
||||
@ -157,7 +146,7 @@ export class ClientSession implements Session {
|
||||
this.token.extra?.admin === 'true',
|
||||
[],
|
||||
this._pipeline.storage.workspaceId,
|
||||
this.getBranding(this._pipeline.storage.branding)
|
||||
this._pipeline.storage.branding
|
||||
)
|
||||
return await this._pipeline.findAll(context, _class, query, options)
|
||||
}
|
||||
@ -180,7 +169,7 @@ export class ClientSession implements Session {
|
||||
this.token.extra?.admin === 'true',
|
||||
[],
|
||||
this._pipeline.storage.workspaceId,
|
||||
this.getBranding(this._pipeline.storage.branding)
|
||||
this._pipeline.storage.branding
|
||||
)
|
||||
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._pipeline.storage.workspaceId,
|
||||
this.getBranding(this._pipeline.storage.branding)
|
||||
this._pipeline.storage.branding
|
||||
)
|
||||
|
||||
const result = await this._pipeline.tx(context, tx)
|
||||
|
Loading…
Reference in New Issue
Block a user