2023-06-19 16:23:53 +00:00
|
|
|
/**
|
2026-01-28 17:09:06 -08:00
|
|
|
* Copyright IBM Corp. 2021, 2026
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-06-19 16:23:53 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-03-16 13:49:04 -04:00
|
|
|
import GeneratedChannelRecordingModel from '../generated/models/channel-recording';
|
|
|
|
|
import { belongsTo } from '@ember-data/model';
|
|
|
|
|
|
2023-03-31 17:19:46 -04:00
|
|
|
export const MIME_TYPE_ASCIICAST = 'application/x-asciicast';
|
|
|
|
|
|
2023-03-16 13:49:04 -04:00
|
|
|
export default class ChannelRecordingModel extends GeneratedChannelRecordingModel {
|
2023-08-14 16:15:26 -07:00
|
|
|
@belongsTo('connection-recording', {
|
|
|
|
|
async: false,
|
|
|
|
|
inverse: 'channel_recordings',
|
|
|
|
|
})
|
|
|
|
|
connection_recording;
|
2023-03-31 17:19:46 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* True if the channel supports asciicast.
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get isAsciicast() {
|
2023-05-31 15:27:30 -04:00
|
|
|
return this.mime_types?.includes(MIME_TYPE_ASCIICAST) ?? false;
|
2023-03-31 17:19:46 -04:00
|
|
|
}
|
2023-03-16 13:49:04 -04:00
|
|
|
|
2023-03-21 15:52:58 -04:00
|
|
|
/**
|
|
|
|
|
* Download the ascii cast recording for this channel.
|
|
|
|
|
* @returns {Promise<string>}
|
|
|
|
|
*/
|
|
|
|
|
getAsciicast() {
|
|
|
|
|
const adapter = this.store.adapterFor('session-recording');
|
|
|
|
|
return adapter.getAsciicast(this.id);
|
|
|
|
|
}
|
2023-03-16 13:49:04 -04:00
|
|
|
}
|