Browse Source

Update .well-known/{host-meta,webfinger} thingy

Chimo 3 years ago
parent
commit
d20f1c5f3a
4 changed files with 80 additions and 23 deletions
  1. 2
    4
      .well-known/host-meta
  2. 35
    0
      .well-known/webfinger/chimo@chromic.org.xml
  3. 43
    0
      .well-known/webfinger/index.php
  4. 0
    19
      xrd/index.php

+ 2
- 4
.well-known/host-meta View File

@@ -1,7 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
3
-    <hm:Host>chromic.org</hm:Host>
4
-    <Link rel="lrdd" template="https://chromic.org/xrd/?uri=acct%3A{uri}">
5
-        <Title>WebFinger resource descriptor</Title>
6
-    </Link>
3
+    <Link rel="lrdd" type="application/xrd+xml"
4
+            template="https://chromic.org/.well-known/webfinger?resource={uri}"/>
7 5
 </XRD>

+ 35
- 0
.well-known/webfinger/chimo@chromic.org.xml View File

@@ -0,0 +1,35 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
3
+  <Subject>acct:chimo@chromic.org</Subject>
4
+  <Alias>acct:chimo@sn.chromic.org</Alias>
5
+  <Alias>https://sn.chromic.org/user/1</Alias>
6
+  <Link rel="http://webfinger.net/rel/profile-page"
7
+        type="text/html"
8
+    href="https://sn.chromic.org/user/1"/>
9
+
10
+  <Link rel="http://schemas.google.com/g/2010#updates-from"
11
+    type="application/atom+xml"
12
+    href="https://sn.chromic.org/api/statuses/user_timeline/1.atom"/>
13
+
14
+  <!-- Is this/was this ever supported?
15
+       <Link rel="http://microformats.org/profile/hcard"
16
+       type="text/html"
17
+       href="https://sn.chromic.org/hcard"/> -->
18
+
19
+  <Link rel="http://gmpg.org/xfn/11"
20
+    type="text/html"
21
+    href="https://sn.chromic.org/user/1"/>
22
+
23
+  <Link rel="describedby"
24
+    type="application/rdf+xml"
25
+    href="https://sn.chromic.org/username/foaf"/>
26
+
27
+  <Link rel="http://salmon-protocol.org/ns/salmon-replies"
28
+    href="https://sn.chromic.org/main/salmon/user/1"/>
29
+
30
+  <Link rel="http://salmon-protocol.org/ns/salmon-mention"
31
+    href="https://sn.chromic.org/main/salmon/user/1"/>
32
+
33
+  <Link rel="http://ostatus.org/schema/1.0/subscribe"
34
+    template="https://sn.chromic.org/main/ostatussub?profile={uri}"/>
35
+</XRD>

+ 43
- 0
.well-known/webfinger/index.php View File

@@ -0,0 +1,43 @@
1
+<?php
2
+
3
+/*
4
+ * GNU social
5
+ * Copyright (C) 2010, Free Software Foundation, Inc
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Affero General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU Affero General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Affero General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+
22
+// basename should make sure we can't escape this directory
23
+$u = basename($_GET['resource']);
24
+
25
+if (!strpos($u, '@')) {
26
+    throw new Exception('Bad resource');
27
+    exit(1);
28
+}
29
+
30
+if (mb_strpos($u, 'acct:')===0) {
31
+    $u = substr($u, 5);
32
+}
33
+
34
+// Just to be a little bit safer, you know, with all the unicode stuff going on
35
+$u = filter_var($u, FILTER_SANITIZE_EMAIL);
36
+
37
+$f = $u . ".xml";
38
+
39
+if (file_exists($f)) {
40
+  header('Content-Disposition: attachment; filename="'.urlencode($f).'"');
41
+  header('Content-type: application/xrd+xml');
42
+  echo file_get_contents($f);
43
+}

+ 0
- 19
xrd/index.php View File

@@ -1,19 +0,0 @@
1
-<?php
2
-
3
-require_once('../../private/_config.php');
4
-
5
-$s = $config['xrd']['secret'];
6
-
7
-$u = $_GET['uri'];
8
-
9
-$u = substr($u, 5);
10
-
11
-$f = $s . $u . ".xml";
12
-
13
-if (file_exists($f)) {
14
-  $fh = fopen($f, 'r');
15
-  $c = fread($fh, filesize($f));
16
-  fclose($fh);
17
-  header('Content-type: text/xml');
18
-  echo $c;
19
-}

Loading…
Cancel
Save