Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix remote subscribe on iOS

Chocobozzzb466e5671cc1
diff --git a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts
index 2b4ab1e47a..503c4b287a 100644
--- a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts
+++ b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts
@@ -8,6 +8,7 @@ import { PeerTubeTemplateDirective } from '../shared-main/common/peertube-templa
import { HelpComponent } from '../shared-main/buttons/help.component'
import { NgIf } from '@angular/common'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
+import { isIOS } from '@root-helpers/web-browser'
@Component({
selector: 'my-remote-subscribe',
@@ -41,10 +42,8 @@ export class RemoteSubscribeComponent extends FormReactive implements OnInit {
const [ username, hostname ] = address.split('@')
- const protocol = window.location.protocol
-
// Should not have CORS error because https://tools.ietf.org/html/rfc7033#section-5
- fetch(`${protocol}//${hostname}/.well-known/webfinger?resource=acct:${username}@${hostname}`)
+ fetch(`https://${hostname}/.well-known/webfinger?resource=acct:${username}@${hostname}`)
.then(response => response.json())
.then(data => {
if (!data || Array.isArray(data.links) === false) {
@@ -61,7 +60,11 @@ export class RemoteSubscribeComponent extends FormReactive implements OnInit {
throw new Error('No subscribe template in webfinger response')
})
- .then(window.open)
+ .then(url => {
+ if (isIOS()) return window.location.href = url
+
+ return window.open(url)
+ })
.catch(err => {
logger.error(err)