From: xray7224 Date: Tue, 3 Sep 2013 17:50:33 +0000 (+0100) Subject: Remove old webfinger support X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d6dce0f7d8cda420c632334251203392055fb716;p=mediagoblin.git Remove old webfinger support --- diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index 7d9d01ee..3ec1dba0 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -35,7 +35,6 @@ def get_url_map(): import mediagoblin.submit.routing import mediagoblin.user_pages.routing import mediagoblin.edit.routing - import mediagoblin.webfinger.routing import mediagoblin.listings.routing import mediagoblin.notifications.routing import mediagoblin.oauth.routing diff --git a/mediagoblin/webfinger/__init__.py b/mediagoblin/webfinger/__init__.py deleted file mode 100644 index 126e6ea2..00000000 --- a/mediagoblin/webfinger/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -''' -mediagoblin.webfinger_ provides an LRDD discovery service and -a web host meta information file - -Links: -- `LRDD Discovery Draft - `_. -- `RFC 6415 - Web Host Metadata - `_. -''' diff --git a/mediagoblin/webfinger/routing.py b/mediagoblin/webfinger/routing.py deleted file mode 100644 index eb10509f..00000000 --- a/mediagoblin/webfinger/routing.py +++ /dev/null @@ -1,23 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -from mediagoblin.tools.routing import add_route - -add_route('mediagoblin.webfinger.host_meta', '/.well-known/host-meta', - 'mediagoblin.webfinger.views:host_meta') - -add_route('mediagoblin.webfinger.xrd', '/webfinger/xrd', - 'mediagoblin.webfinger.views:xrd') diff --git a/mediagoblin/webfinger/views.py b/mediagoblin/webfinger/views.py deleted file mode 100644 index 97fc3ef7..00000000 --- a/mediagoblin/webfinger/views.py +++ /dev/null @@ -1,117 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -''' -For references, see docstring in mediagoblin/webfinger/__init__.py -''' - -import re - -from urlparse import urlparse - -from mediagoblin.tools.response import render_to_response, render_404 - -def host_meta(request): - ''' - Webfinger host-meta - ''' - - placeholder = 'MG_LRDD_PLACEHOLDER' - - lrdd_title = 'GNU MediaGoblin - User lookup' - - lrdd_template = request.urlgen( - 'mediagoblin.webfinger.xrd', - uri=placeholder, - qualified=True) - - return render_to_response( - request, - 'mediagoblin/webfinger/host-meta.xml', - {'request': request, - 'lrdd_template': lrdd_template, - 'lrdd_title': lrdd_title, - 'placeholder': placeholder}) - -MATCH_SCHEME_PATTERN = re.compile(r'^acct:') - -def xrd(request): - ''' - Find user data based on a webfinger URI - ''' - param_uri = request.GET.get('uri') - - if not param_uri: - return render_404(request) - - ''' - :py:module:`urlparse` does not recognize usernames in URIs of the - form ``acct:user@example.org`` or ``user@example.org``. - ''' - if not MATCH_SCHEME_PATTERN.search(param_uri): - # Assume the URI is in the form ``user@example.org`` - uri = 'acct://' + param_uri - else: - # Assumes the URI looks like ``acct:user@example.org - uri = MATCH_SCHEME_PATTERN.sub( - 'acct://', param_uri) - - parsed = urlparse(uri) - - xrd_subject = param_uri - - # TODO: Verify that the user exists - # Q: Does webfinger support error handling in this case? - # Returning 404 seems intuitive, need to check. - if parsed.username: - # The user object - # TODO: Fetch from database instead of using the MockUser - user = MockUser() - user.username = parsed.username - - xrd_links = [ - {'attrs': { - 'rel': 'http://microformats.org/profile/hcard', - 'href': request.urlgen( - 'mediagoblin.user_pages.user_home', - user=user.username, - qualified=True)}}, - {'attrs': { - 'rel': 'http://schemas.google.com/g/2010#updates-from', - 'href': request.urlgen( - 'mediagoblin.user_pages.atom_feed', - user=user.username, - qualified=True)}}] - - xrd_alias = request.urlgen( - 'mediagoblin.user_pages.user_home', - user=user.username, - qualified=True) - - return render_to_response( - request, - 'mediagoblin/webfinger/xrd.xml', - {'request': request, - 'subject': xrd_subject, - 'alias': xrd_alias, - 'links': xrd_links }) - else: - return render_404(request) - -class MockUser(object): - ''' - TEMPORARY user object - ''' - username = None