]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-custom-markup/custom-markup.service.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / custom-markup.service.ts
index 089728a51ab8e551db794f597985a4b9a7e12b85..d738a644ec0f90498271eb62b2f2cdd6736e20e4 100644 (file)
@@ -1,4 +1,4 @@
-import { first } from 'rxjs/operators'
+import { firstValueFrom } from 'rxjs'
 import { ComponentRef, Injectable } from '@angular/core'
 import { MarkdownService } from '@app/core'
 import {
@@ -7,7 +7,6 @@ import {
   ContainerMarkupData,
   EmbedMarkupData,
   PlaylistMiniatureMarkupData,
-  VideoFilter,
   VideoMiniatureMarkupData,
   VideosListMarkupData
 } from '@shared/models'
@@ -21,6 +20,7 @@ import {
   VideosListMarkupComponent
 } from './peertube-custom-tags'
 import { CustomMarkupComponent } from './peertube-custom-tags/shared'
+import { logger } from '@root-helpers/logger'
 
 type AngularBuilderFunction = (el: HTMLElement) => ComponentRef<CustomMarkupComponent>
 type HTMLBuilderFunction = (el: HTMLElement) => HTMLElement
@@ -71,7 +71,7 @@ export class CustomMarkupService {
             // Insert as first child
             e.insertBefore(element, e.firstChild)
           } catch (err) {
-            console.error('Cannot inject component %s.', selector, err)
+            logger.error(`Cannot inject component ${selector}`, err)
           }
         })
     }
@@ -85,13 +85,13 @@ export class CustomMarkupService {
             const component = this.execAngularBuilder(selector, e)
 
             if (component.instance.loaded) {
-              const p = component.instance.loaded.pipe(first()).toPromise()
+              const p = firstValueFrom(component.instance.loaded)
               loadedPromises.push(p)
             }
 
             this.dynamicElementService.injectElement(e, component)
           } catch (err) {
-            console.error('Cannot inject component %s.', selector, err)
+            logger.error(`Cannot inject component ${selector}`, err)
           }
         })
     }
@@ -191,7 +191,9 @@ export class CustomMarkupService {
       accountHandle: data.accountHandle || undefined,
       channelHandle: data.channelHandle || undefined,
 
-      filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
+      isLive: this.buildBoolean(data.isLive),
+
+      isLocal: this.buildBoolean(data.onlyLocal) ? true : undefined
     }
 
     this.dynamicElementService.setModel(component, model)
@@ -215,6 +217,8 @@ export class CustomMarkupService {
 
     root.classList.add('peertube-container', layoutClass)
 
+    root.style.justifyContent = data.justifyContent || 'space-between'
+
     if (data.width) {
       root.setAttribute('width', data.width)
     }