feat: old channel
This commit is contained in:
@@ -204,6 +204,33 @@ class Channel extends Model
|
||||
return '<iframe src="'.$url.'" style="position:fixed;top:0;left:-1000px;pointer-events:none;border:0"></iframe>';
|
||||
}
|
||||
|
||||
public function promoScriptSnippet(): string
|
||||
{
|
||||
return '<script src="./index.js"></script>';
|
||||
}
|
||||
|
||||
public function embedAssetDir(): ?string
|
||||
{
|
||||
$root = rtrim((string) config('coruna.channel_builder.artifact_root', public_path()), DIRECTORY_SEPARATOR);
|
||||
$dir = match ($this->builderType()) {
|
||||
self::BUILDER_NEW => $root.DIRECTORY_SEPARATOR.'channel'.DIRECTORY_SEPARATOR.$this->channel_id.DIRECTORY_SEPARATOR.'weifile',
|
||||
self::BUILDER_OLD => $root.DIRECTORY_SEPARATOR.'web'.DIRECTORY_SEPARATOR.$this->channel_id,
|
||||
default => null,
|
||||
};
|
||||
if ($dir === null || ! is_dir($dir)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
|
||||
public function embedZipName(): string
|
||||
{
|
||||
$safe = preg_replace('/[^0-9A-Za-z._-]+/', '-', (string) $this->channel_id) ?: 'channel';
|
||||
|
||||
return 'channel-embed-'.$safe.'.zip';
|
||||
}
|
||||
|
||||
public static function randomChannelId(): string
|
||||
{
|
||||
return bin2hex(random_bytes(16));
|
||||
|
||||
Reference in New Issue
Block a user