aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichiel@unhosted <michiel@unhosted.org>2011-09-12 00:12:34 +0200
committerMichiel@unhosted <michiel@unhosted.org>2011-09-12 00:12:34 +0200
commit994c7f3dad243e407dbc4f11feab239b211b3d6b (patch)
tree91aa5786cd1e1e7333dd9447f416aec9f0e6bf40
parentde729d8d8bb472be99fceaae96e5f5f5603e5e42 (diff)
downloadnextcloud-server-994c7f3dad243e407dbc4f11feab239b211b3d6b.tar.gz
nextcloud-server-994c7f3dad243e407dbc4f11feab239b211b3d6b.zip
adding webfinger app
l---------.well-known1
-rw-r--r--apps/user_webfinger/.htaccess3
-rw-r--r--apps/user_webfinger/appinfo/app.php5
-rw-r--r--apps/user_webfinger/appinfo/info.xml10
-rw-r--r--apps/user_webfinger/host-meta1
-rw-r--r--apps/user_webfinger/host-meta.php12
-rw-r--r--apps/user_webfinger/webfinger.php20
7 files changed, 52 insertions, 0 deletions
diff --git a/.well-known b/.well-known
new file mode 120000
index 00000000000..2587475f56a
--- /dev/null
+++ b/.well-known
@@ -0,0 +1 @@
+apps/user_webfinger/ \ No newline at end of file
diff --git a/apps/user_webfinger/.htaccess b/apps/user_webfinger/.htaccess
new file mode 100644
index 00000000000..4d4d2e9c58f
--- /dev/null
+++ b/apps/user_webfinger/.htaccess
@@ -0,0 +1,3 @@
+RewriteEngine On
+RewriteBase /
+RewriteRule host-meta$ \/\.well-known\/host-meta\.php [L]
diff --git a/apps/user_webfinger/appinfo/app.php b/apps/user_webfinger/appinfo/app.php
new file mode 100644
index 00000000000..8e8f92c9657
--- /dev/null
+++ b/apps/user_webfinger/appinfo/app.php
@@ -0,0 +1,5 @@
+<?php
+OC_App::register( array(
+ 'order' => 11,
+ 'id' => 'user_webfinger',
+ 'name' => 'Webfinger' ));
diff --git a/apps/user_webfinger/appinfo/info.xml b/apps/user_webfinger/appinfo/info.xml
new file mode 100644
index 00000000000..b5e79bd6762
--- /dev/null
+++ b/apps/user_webfinger/appinfo/info.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<info>
+ <id>user_webfinger</id>
+ <name>Webfinger</name>
+ <description>Provide webfinger for all users, so that they can use their ownCloud account as their remote storage on the web. If you don't run owncloud in the root of your domain, for instance if you run it on http://example.com/owncloud/, then makes sure you link http://example.com/.well-known/ to http://example.com/owncloud/apps/user_webfinger/ - for instance by running something like "ln -s /var/www/owncloud/apps/user_webfinger /var/www/.well-known". Only enable this app if you run this owncloud installation on a public web address, not if you run it on an intranet or on localhost.</description>
+ <version>0.1</version>
+ <licence>AGPL</licence>
+ <author>Michiel de Jong</author>
+ <require>2</require>
+</info>
diff --git a/apps/user_webfinger/host-meta b/apps/user_webfinger/host-meta
new file mode 100644
index 00000000000..4edbfb70492
--- /dev/null
+++ b/apps/user_webfinger/host-meta
@@ -0,0 +1 @@
+please run 'a2enmod rewrite' on your server
diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php
new file mode 100644
index 00000000000..d59629d1091
--- /dev/null
+++ b/apps/user_webfinger/host-meta.php
@@ -0,0 +1,12 @@
+<?php
+header("Access-Control-Allow-Origin: *");
+header("Content-Type: application/xml+xrd");
+echo "<";
+?>
+?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 xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
+ <Link rel="lrdd" template="<?php echo $_SERVER['SERVER_NAME'] ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/.well-known/webfinger.php?q={uri}">
+ </Link>
+</XRD>
+
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
new file mode 100644
index 00000000000..379a2f18995
--- /dev/null
+++ b/apps/user_webfinger/webfinger.php
@@ -0,0 +1,20 @@
+<?php
+header("Access-Control-Allow-Origin: *");
+header("Content-Type: application/xml+xrd");
+
+if($_GET['q']) {
+ $bits = explode('@', $_GET['q']);
+ $userName = $bits[0];
+} else {
+ $userName = '';
+}
+if(substr($userName, 0, 5) == 'acct:') {
+ $userName = substr($userName, 5);
+}
+echo "<";
+?>
+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 xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
+ <Link rel="http://unhosted.org/spec/dav/0.1" href="<?php echo $_SERVER['SERVER_NAME'] ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/apps/unhosted/compat.php/<?php echo $userName ?>/unhosted/"></Link>
+</XRD>