Add support for remote interact (#519)

Add support for remote interaction ([this thing](https://eldritch.cafe/users/Barmaid/remote_follow) in mastodon)

- [x] create the endpoint dispatching remote interactions to local pages
- [x] add this endpoint to web-finger
- [x] propose remote interaction when following and not connected
- [x] propose remote interaction when liking/sharing and not connected
- [x] propose remote interaction when commenting and not connected
- [x] fetch posts/comments we don't know but remote interaction was requested for ?
This commit is contained in:
fdb-hiroshima
2019-04-17 22:09:07 +02:00
committed by Baptiste Gelez
parent 12efe721cc
commit 0d708e1639
28 changed files with 1173 additions and 481 deletions
+14
View File
@@ -0,0 +1,14 @@
@use templates::remote_interact_base;
@use plume_models::users::User;
@use routes::RemoteForm;
@use routes::session::LoginForm;
@use template_utils::*;
@use validator::ValidationErrors;
@(ctx: BaseContext, user: User, login_form: LoginForm, login_errs: ValidationErrors, remote_form: RemoteForm, remote_errs: ValidationErrors)
@:remote_interact_base(ctx, i18n!(ctx.1, "Follow {}"; user.name()), i18n!(ctx.1, "Login to follow"), i18n!(ctx.1, "Enter your full username to follow"), {
<h1>@i18n!(ctx.1, "Follow {}"; user.name())</h1>
@avatar(ctx.0, &user, Size::Medium, false, ctx.1)
<small>@@@user.fqn</small>
}, login_form, login_errs, remote_form, remote_errs)
+1 -1
View File
@@ -32,7 +32,7 @@
<a class="u-url" href="@user.ap_url"></a>
}
@if ctx.2.clone().map(|u| u.id != user.id).unwrap_or(false) {
@if ctx.2.clone().map(|u| u.id != user.id).unwrap_or(true) {
<form class="inline" method="post" action="@uri!(user::follow: name = &user.fqn)">
@if follows {
<input type="submit" value="@i18n!(ctx.1, "Unsubscribe")">