]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/user-subscription/remote-subscribe.component.ts
Add autoplay tooltip, use of flex-wrap in video-info and other-videos
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / user-subscription / remote-subscribe.component.ts
index ba2a45df136897c9dbe95e9dad32be4437cdd643..63e7cd5d95390555cf6a970db56f6b78f56bf816 100644 (file)
@@ -11,7 +11,7 @@ import {
   styleUrls: ['./remote-subscribe.component.scss']
 })
 export class RemoteSubscribeComponent extends FormReactive implements OnInit {
-  @Input() account: string
+  @Input() uri: string
   @Input() interact = false
   @Input() showHelp = false
 
@@ -42,19 +42,20 @@ export class RemoteSubscribeComponent extends FormReactive implements OnInit {
     fetch(`https://${hostname}/.well-known/webfinger?resource=acct:${username}@${hostname}`)
       .then(response => response.json())
       .then(data => new Promise((resolve, reject) => {
+        console.log(data)
+
         if (data && Array.isArray(data.links)) {
-          const link: {
-            template: string
-          } = data.links.find((link: any) =>
-            link && typeof link.template === 'string' && link.rel === 'http://ostatus.org/schema/1.0/subscribe')
+          const link: { template: string } = data.links.find((link: any) => {
+            return link && typeof link.template === 'string' && link.rel === 'http://ostatus.org/schema/1.0/subscribe'
+          })
 
           if (link && link.template.includes('{uri}')) {
-            resolve(link.template.replace('{uri}', `acct:${this.account}`))
+            resolve(link.template.replace('{uri}', encodeURIComponent(this.uri)))
           }
         }
         reject()
       }))
       .then(window.open)
-      .catch(() => window.open(`https://${hostname}/authorize_interaction?acct=${this.account}`))
+      .catch(err => console.error(err))
   }
 }