mastodon_ynh icon indicating copy to clipboard operation
mastodon_ynh copied to clipboard

Host users, with different domain from server domain

Open rosbeef opened this issue 2 years ago • 18 comments

Problem

  • No problem but improvement : Add ability to host user with different domain from server domain

Solution

  • Add well known host-meta file
  • Add option to select users domain

PR Status

  • [x] Code finished and ready to be reviewed/tested
    • [x] install
    • [x] upgrade
    • [x] remove
    • [x] restore
    • [x] change_url
  • [ ] The fix/enhancement were manually tested (if applicable)
    • [x] 1rs install with master / host_domain: test.domain.tld
    • [x] update to patch1
    • [x] change url / host_domain: social.domain.tld / user_domain: XXXXXXXXXX
    • [x] config userdomain / host_domain: XXXXXXXXXX / user_domain: social.domain.tld
    • [x] config userdomain / host_domain: XXXXXXXXXX / user_domain: domain.tld
    • [ ] remove app
    • [ ] restore app

Automatic tests

!testme

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

rosbeef avatar Feb 19 '22 18:02 rosbeef

maybe it should be improved before publish. i based my mod no https://docs.joinmastodon.org/dev/routes/ i did something like that : https://dallas.lu/en/use-your-primary-domain-as-an-mastodon-name but i didn't touch main domain webfinger configuration because i don't understand well the effect

rosbeef avatar Feb 19 '22 20:02 rosbeef

as it tell on https://dallas.lu/en/use-your-primary-domain-as-an-mastodon-name fediverse servers like peertube which do not look for host-meta, should not work with main domain to subscribe to the video.

rosbeef avatar Feb 20 '22 00:02 rosbeef

i don't find how to make peertube subscription working with something like this in HOSTDOMAIN config file:

location ~* /.well-known/webfinger {
    add_header Access-Control-Allow-Origin __USERDOMAIN__;
}

it should allow HOSTDOMAIN to recieve crossSite request from __USERDOMAIN

error is :

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://domain.tld/.well-known/webfinger?resource=acct:[email protected]. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 301.

rosbeef avatar Feb 20 '22 01:02 rosbeef

!testme

yalh76 avatar Feb 27 '22 22:02 yalh76

Fingers crossed! Test Badge

yunohost-bot avatar Feb 27 '22 22:02 yunohost-bot

i don't understand how to mitigate the Cross-Origin error , i put

location ~* /.well-known/webfinger {
    add_header Access-Control-Allow-Origin https://__USERDOMAIN__;
}

in /etc/nginx/conf.d/DOMAIN.d/mastodon.conf but peertube always return me a cors error

rosbeef avatar Feb 28 '22 16:02 rosbeef

Maybe Access-Control-Allow-Origin https://__USERDOMAIN__ https://__DOMAIN__; ?

Tagadda avatar Feb 28 '22 16:02 Tagadda

!testme

yalh76 avatar Mar 02 '22 01:03 yalh76

Alrighty! Test Badge

yunohost-bot avatar Mar 02 '22 01:03 yunohost-bot

Appart script errors: i added parcial CORS mitigation add:header Access-Control-Allow-Origin * to USERDOMAIN nginx conf

with all that config (LOCAL_DOMAIN WEB_DOMAIN) it seems that i'm not able to follow from mastodon someone on an other service like peertube hosted on an other subdomain

rosbeef avatar Mar 03 '22 00:03 rosbeef

!testme

yalh76 avatar Mar 03 '22 01:03 yalh76

May the CI gods be with you! Test Badge

yunohost-bot avatar Mar 03 '22 01:03 yunohost-bot

!testme

rosbeef avatar Mar 04 '22 00:03 rosbeef

except for a bug that that i don't understand (mastodon can not find own served peertube on subscription from peertube with a mastodon account) all is working for me. And testing restore and upgrade most of time fail due to lake of space. @yalh76 have you an idea how to solve this problem ?

rosbeef avatar Mar 05 '22 18:03 rosbeef

!testme

yalh76 avatar Mar 06 '22 14:03 yalh76

:rocket: Test Badge

yunohost-bot avatar Mar 06 '22 14:03 yunohost-bot

!testme

rosbeef avatar Mar 25 '22 23:03 rosbeef

@yalh76 !testme ;)

rosbeef avatar Mar 31 '22 22:03 rosbeef