2024-05-23 15:17:28 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 Mehdi Benadel <https://mehdibenadel.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-05-23 14:56:11 +00:00
|
|
|
import type { RegisterClientOptions } from '@peertube/peertube-types/client/types'
|
|
|
|
|
2024-06-12 14:26:35 +00:00
|
|
|
export interface PtContext {
|
|
|
|
ptOptions: RegisterClientOptions
|
|
|
|
}
|
2024-05-24 12:25:08 +00:00
|
|
|
|
2024-06-12 14:26:35 +00:00
|
|
|
let context: PtContext
|
|
|
|
|
|
|
|
export function getPtContext (): PtContext {
|
|
|
|
if (!context) {
|
|
|
|
throw new Error('Peertube context not set yet, getPtContext was called too soon.')
|
|
|
|
}
|
|
|
|
return context
|
|
|
|
}
|
|
|
|
|
|
|
|
export function initPtContext (ptOptions: RegisterClientOptions): void {
|
|
|
|
context = {
|
|
|
|
ptOptions
|
|
|
|
}
|
|
|
|
}
|