mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Adding https url search for add-remote communities
This commit is contained in:
parent
5ecb66988b
commit
e5af8398b7
2 changed files with 12 additions and 3 deletions
|
@ -12,7 +12,7 @@ from sqlalchemy import or_, desc, text
|
|||
|
||||
from app import db, constants, cache
|
||||
from app.activitypub.signature import RsaKeys, post_request, default_context, post_request_in_background
|
||||
from app.activitypub.util import notify_about_post, make_image_sizes, resolve_remote_post
|
||||
from app.activitypub.util import notify_about_post, make_image_sizes, resolve_remote_post, extract_domain_and_actor
|
||||
from app.chat.util import send_message
|
||||
from app.community.forms import SearchRemoteCommunity, CreateDiscussionForm, CreateImageForm, CreateLinkForm, \
|
||||
ReportCommunityForm, \
|
||||
|
@ -123,9 +123,12 @@ def add_remote():
|
|||
...
|
||||
elif '@' in address:
|
||||
new_community = search_for_community('!' + address)
|
||||
elif address.startswith('https://'):
|
||||
server, community = extract_domain_and_actor(address)
|
||||
new_community = search_for_community('!' + community + '@' + server)
|
||||
else:
|
||||
message = Markup(
|
||||
'Type address in the format !community@server.name. Search on <a href="https://lemmyverse.net/communities">Lemmyverse.net</a> to find some.')
|
||||
'Accepted address formats: !community@server.name or https://server.name/{c|m}/community. Search on <a href="https://lemmyverse.net/communities">Lemmyverse.net</a> to find some.')
|
||||
flash(message, 'error')
|
||||
if new_community is None:
|
||||
if g.site.enable_nsfw:
|
||||
|
|
|
@ -11,7 +11,13 @@
|
|||
<div class="card mt-5">
|
||||
<div class="card-body p-6">
|
||||
<div class="card-title">{{ _('Search') }}</div>
|
||||
<p>Type address in the format !community@server.name. Search on <a href="https://lemmyverse.net/communities" target='_blank'>Lemmyverse.net</a> to find some.</p>
|
||||
<p>Accepted address formats: </p>
|
||||
<ul>
|
||||
<li>!community@server.name</li>
|
||||
<li>https://server.name/c/community (lemmy)</li>
|
||||
<li>https://server.name/m/magazine (kbin/mbin)</li>
|
||||
</ul>
|
||||
<p>Search on <a href="https://lemmyverse.net/communities" target='_blank'>Lemmyverse.net</a> to find some.</p>
|
||||
{{ render_form(form) }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue