add web+ap links to static-fe

This commit is contained in:
Charlotte 🦝 Delenk 2023-07-23 10:34:55 +01:00
parent de8dc3d8b7
commit 55bc84da35
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
5 changed files with 30 additions and 1 deletions

View file

@ -67,4 +67,12 @@ def fetch_media_type(supported_types, media_type) do
String.starts_with?(media_type, support_type)
end)
end
def custom_scheme_ap_id(%{ap_id: ap_id}) do
custom_scheme_ap_id(ap_id)
end
def custom_scheme_ap_id(ap_id) do
ap_id |> String.replace("https://", "web+ap://", global: false)
end
end

View file

@ -20,6 +20,9 @@
<a href="<%= (@user.uri || @user.ap_id) %>" class="account-name">
<%= @user.nickname %>
</a>
<a href="<%= Utils.custom_scheme_ap_id(@user) %>">
<img class="fa-icon" src="/static-fe/svg/arrow-up-right-from-square-solid.svg" alt="Open in your client">
</a>
</div>
<div class="heading-right">
<a class="timeago" href="<%= @link %>">
@ -45,11 +48,17 @@
<img class="fa-icon" src="/static-fe/svg/reply-solid.svg">
<%= gettext("Reply to") %>
</a>
<a href="<%= Utils.custom_scheme_ap_id(@reply_to) %>">
<img class="fa-icon" src="/static-fe/svg/arrow-up-right-from-square-solid.svg" alt="Open in your client">
</a>
<span class="h-card">
<%= if @reply_to_user do %>
<a href="<%= (@reply_to_user.uri || @reply_to_user.ap_id) %>" class="u-url mention">
@<%= @reply_to_user.nickname %>
</a>
<a href="<%= Utils.custom_scheme_ap_id(@reply_to_user) %>">
<img class="fa-icon" src="/static-fe/svg/arrow-up-right-from-square-solid.svg" alt="Open in your client">
</a>
<% end %>
</span>
</div>
@ -68,7 +77,7 @@
<% end %>
<div class="status-body">
<%= raw @content %>
<%= if @poll && length(@poll) > 0 do %>
<%= if @poll && length(@poll) > 0 do %>
<div class="poll">
<%= for %{"name" => option, "replies" => %{"totalItems" => count}} <- @poll do %>
<div class="poll-option" title="<%= count %>/<%= @total_votes %>">
@ -106,6 +115,11 @@
<img class="fa-icon" src="/static-fe/svg/star-regular.svg">
<span class="action-count"><%= @counts.likes %></span>
</div>
<div>
<a href="<%= Utils.custom_scheme_ap_id(@link) %>">
<img class="fa-icon" src="/static-fe/svg/arrow-up-right-from-square-solid.svg" alt="Open in your client">
</a>
</div>
</div>
</div>
</div>

View file

@ -17,5 +17,8 @@
<a href="<%= (@user.uri || @user.ap_id) %>" class="account-name">
@<%= @user.nickname %>
</a>
<a href="<%= Utils.custom_scheme_ap_id(@user) %>">
<img class="fa-icon" src="/static-fe/svg/arrow-up-right-from-square-solid.svg" alt="Open in your client">
</a>
</div>
</div>

View file

@ -42,6 +42,9 @@
<button type="submit" class="button-default"><%= Gettext.dpgettext("static_pages", "static fe profile page remote follow button", "Remote follow") %></button>
</form>
</div>
<div class="open-remotely">
<a href="<%= Utils.custom_scheme_ap_id(@user) %>"><button type="button">Open in your client</button><a>
</div>
</div>
<div class="user-counts">
<div class="user-count">

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>

After

Width:  |  Height:  |  Size: 660 B