]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
added some crude code to enable people to add support for webfinger to
authorMatt Lee <mattl@cnuk.org>
Sat, 7 Aug 2010 18:29:24 +0000 (14:29 -0400)
committerMatt Lee <mattl@cnuk.org>
Sat, 7 Aug 2010 18:29:24 +0000 (14:29 -0400)
their domains

license: AGPLv3 or later.

socialfy-your-domain/README.txt [new file with mode: 0644]
socialfy-your-domain/dot-well-known/host-meta [new file with mode: 0644]
socialfy-your-domain/xrd/example@example.com [new file with mode: 0644]
socialfy-your-domain/xrd/index.php [new file with mode: 0644]

diff --git a/socialfy-your-domain/README.txt b/socialfy-your-domain/README.txt
new file mode 100644 (file)
index 0000000..ead4380
--- /dev/null
@@ -0,0 +1,57 @@
+Initial simple way to Webfinger enable your domain -- needs PHP.
+================================================================
+
+Step 1
+======
+
+First, put the folders 'xrd' and 'dot-well-known' on your website, so
+they load at:
+
+     http://yourname.com/xrd/
+
+     and
+
+     http://yourname.com/.well-known/
+
+     (Remember the . at the beginning of this one)
+
+Step 2
+======
+
+Next, edit xrd/index.php and enter a secret in this line:
+
+$s = "";
+
+This can be anything you like...
+
+$s = "johnny-five";
+
+or 
+
+$s = "12345";
+
+It really doesn't matter too much.
+
+Step 3
+======
+
+For each user on your site, and this might only be you...
+
+Make a copy of the example@example.com.xml file so that it's called...
+
+     yoursecretusername@domain.com.xml
+
+     So, if your secret is 'johnny5' and your name is ben and your
+     domain is titanictoycorp.biz, your file should be called
+     johnny5ben@titanictoycorp.biz.xml
+
+Finally, edit the file to point at your account on your social
+site. If you are the only user, then you probably don't need to worry
+about user/1 as this will be you. For multi user sites, the user ID is
+on the profile page.
+
+Finally
+=======
+
+Using this method, though fiddly, you can now be @user@domain without
+the need for any prefixes for subdomains, etc.
diff --git a/socialfy-your-domain/dot-well-known/host-meta b/socialfy-your-domain/dot-well-known/host-meta
new file mode 100644 (file)
index 0000000..e44591a
--- /dev/null
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0"><hm:Host>example.com</hm:Host><Link rel="lrdd" template="http://example.com/xrd?uri={uri}"><Title>Resource Descriptor</Title></Link></XRD>
\ No newline at end of file
diff --git a/socialfy-your-domain/xrd/example@example.com b/socialfy-your-domain/xrd/example@example.com
new file mode 100644 (file)
index 0000000..0698752
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
+  <Subject>acct:example@example.com</Subject>
+  <Alias>acct:example@social.example.com</Alias>
+  <Alias>http://social.example.com/user/1</Alias>
+  <Link rel="http://webfinger.net/rel/profile-page" type="text/html" href="http://social.example.com/user/1"/>
+  <Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="http://social.example.com/api/statuses/user_timeline/1.atom"/>
+  <Link rel="http://microformats.org/profile/hcard" type="text/html" href="http://social.example.com/hcard"/>
+  <Link rel="http://gmpg.org/xfn/11" type="text/html" href="http://social.example.com/user/1"/>
+  <Link rel="describedby" type="application/rdf+xml" href="http://social.example.com/foaf"/>
+  <Link rel="http://salmon-protocol.org/ns/salmon-replies" href="http://social.example.com/main/salmon/user/1"/>
+  <Link rel="http://salmon-protocol.org/ns/salmon-mention" href="http://social.example.com/main/salmon/user/1"/>
+  <Link rel="http://ostatus.org/schema/1.0/subscribe" template="http://social.example.com/main/ostatussub?profile={uri}"/>
+</XRD>
diff --git a/socialfy-your-domain/xrd/index.php b/socialfy-your-domain/xrd/index.php
new file mode 100644 (file)
index 0000000..25f1d8b
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * GNU social
+ * Copyright (C) 2010, Free Software Foundation, Inc
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+$s = "";
+
+/* this should be a secret */
+
+$u = $_GET['uri'];
+
+$u = substr($u, 5);
+
+$f = $s . $u . ".xml";
+
+if (file_exists($f)) {
+  $fh = fopen($f, 'r');
+  $c = fread($fh, filesize($f));
+  fclose($fh);
+  header('Content-type: text/xml');
+  echo $c;
+}
+
+
+?>
\ No newline at end of file