MCPcopy Create free account
hub / github.com/PleasureTools/joyBox / RpcRequestHandlerImpl

Class RpcRequestHandlerImpl

backend/Src/ClientIO/RpcRequestHandler.ts:113–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 exp: number;
112}
113export class RpcRequestHandlerImpl extends RpcRequestHandler {
114 public static pluginListenerInterceptFn: (e: LiveStream) => boolean;
115 private readonly BEFORE_EXP = 5;
116 private sessionProlongationTask: NodeJS.Timeout | null = null;
117 private FindDanglingEntries = memoizee(FindDanglingEntries, { max: 1, maxAge: 1000 });
118 private session: Unicaster | null = null;
119 public constructor(
120 client: Socket,
121 private broadcaster: Broadcaster,
122 private observables: TrackedStreamCollection,
123 private pluginManager: PluginManager,
124 private pluginManagerController: PluginManagerController,
125 private pluginManagerListener: PluginManagerListener,
126 private storage: SqliteAdapter,
127 private linkedStreams: StreamDispatcher,
128 private archive: ArchiveRecord[],
129 private archiveRefCounter: LinkCounter<string>,
130 private clipProgress: Map<string, ClipProgressState>,
131 private archiveFilters: Map<number, Filter>,
132 private observablesFilters: Map<number, Filter>,
133 private recorder: RecordingService,
134 private systemResources: SystemResourcesMonitor,
135 private notificationCenter: NotificationCenter,
136 private settings: Settings,
137 private app: AppFacade,
138 private shutdown: () => void) {
139 super(client);
140 this.session = new Unicaster(this.client);
141 this.client.once('disconnect', () => this.OnDisconnect());
142 this.SendSnapshot();
143 }
144
145 private SendSnapshot() {
146 const SerializeObservable = (x: ObservableStream) => ({
147 uri: x.url,
148 lastSeen: x.lastSeen,
149 plugins: x.plugins.map(p => p.name)
150 });
151 this.session?.Snapshot({
152 activeRecords: this.recorder.Records,
153 archive: this.archive.map(x => ({ ...x, tags: [...x.tags] })),
154 clipProgress: [...this.clipProgress.values()],
155 observables: [...this.observables.values()].map(SerializeObservable),
156 plugins: this.pluginManager.Plugins.map(x => ({ id: x.id, name: x.name, enabled: x.enabled })),
157 archiveFilters: [...this.archiveFilters.values()],
158 observablesFilters: [...this.observablesFilters.values()],
159 systemResources: this.systemResources.Info,
160 startTime: C.StartTime,
161 defaultAccess: C.DefaultAccess,
162 storageQuota: this.settings.StorageQuota,
163 instanceQuota: this.settings.InstanceQuota,
164 downloadSpeedQuota: this.settings.DownloadSpeedQuota
165 });
166 }
167
168 private KnownRecords() {
169 return [...this.recorder.Records.map(x => x.filename), ...this.archive.map(x => x.filename)];
170 }

Callers

nothing calls this directly

Calls 1

RpcMethodFunction · 0.85

Tested by

no test coverage detected