YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 34 forks source link

Host users, with different domain from server domain #311

Closed rosbeef closed 1 year ago

rosbeef commented 2 years ago

Problem

Solution

PR Status

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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:user@domain.tld. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 301.

yalh76 commented 2 years ago

!testme

yunohost-bot commented 2 years ago

Fingers crossed! Test Badge

rosbeef commented 2 years ago

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

Tagadda commented 2 years ago

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

yalh76 commented 2 years ago

!testme

yunohost-bot commented 2 years ago

Alrighty! Test Badge

rosbeef commented 2 years ago

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

yalh76 commented 2 years ago

!testme

yunohost-bot commented 2 years ago

May the CI gods be with you! Test Badge

rosbeef commented 2 years ago

!testme

rosbeef commented 2 years ago

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 ?

yalh76 commented 2 years ago

!testme

yunohost-bot commented 2 years ago

:rocket: Test Badge

rosbeef commented 2 years ago

!testme

rosbeef commented 2 years ago

@yalh76 !testme ;)

ericgaspar commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:v: Test Badge

rosbeef commented 1 year ago

i would take back my work on this pr but mixed up with push and saw that i was working on master... are some one could help me to clean my pr and start back my workis it possible to revert my last forced-push action ?

formy information ; (To install Mastodon on mastodon.example.com in such a way it can serve @alice@example.com, set LOCAL_DOMAIN to example.com and WEB_DOMAIN to mastodon.example.com. This also requires additional configuration on the server hosting example.com to redirect or proxy requests to https://example.com/.well-known/webfinger to https://mastodon.example.com/.well-known/webfinger. For instance, with nginx, the configuration could look like the following:

location /.well-known/webfinger { add_header Access-Control-Allow-Origin '*'; return 301 https://mastodon.example.com$request_uri; } ) https://docs.joinmastodon.org/admin/config/#local_domain

rosbeef commented 1 year ago

Hi @ericgaspar you merged but it does noting. Some days ago I' be made a sync from source and all my modification were lost. I don't know how to go back. Maybe it should be better to make an other PR but I would recover my last job to take it as example as i did it a long time ago.