From a1f332aaa527ae36ecc8cf2944f8b71e2317afea Mon Sep 17 00:00:00 2001
From: Philipp Holzer <admin@philipp.info>
Date: Sat, 4 May 2019 21:37:32 +0200
Subject: [PATCH 1/2] Move mod/rsd_xml to src/Module/ReallySimpleDiscovery

---
 mod/rsd_xml.php                      | 26 --------------------------
 src/App/Router.php                   |  1 +
 src/Module/ReallySimpleDiscovery.php | 21 +++++++++++++++++++++
 view/templates/rsd.tpl               | 15 +++++++++++++++
 4 files changed, 37 insertions(+), 26 deletions(-)
 delete mode 100644 mod/rsd_xml.php
 create mode 100644 src/Module/ReallySimpleDiscovery.php
 create mode 100644 view/templates/rsd.tpl

diff --git a/mod/rsd_xml.php b/mod/rsd_xml.php
deleted file mode 100644
index 84dedd6c56..0000000000
--- a/mod/rsd_xml.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-use Friendica\App;
-use Friendica\Core\System;
-
-function rsd_xml_content(App $a)
-{
-	header ("Content-Type: text/xml");
-	echo '<?xml version="1.0" encoding="UTF-8"?>
-<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
-  <service>
-    <engineName>Friendica</engineName>
-    <engineLink>http://friendica.com/</engineLink>
-    <apis>
-      <api name="Twitter" preferred="true" apiLink="'.System::baseUrl().'/api/" blogID="">
-        <settings>
-          <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
-          <setting name="OAuth">false</setting>
-        </settings>
-      </api>
-    </apis>
-  </service>
-</rsd>';
-
-	exit();
-}
diff --git a/src/App/Router.php b/src/App/Router.php
index d35977dde1..3dc45fcfa1 100644
--- a/src/App/Router.php
+++ b/src/App/Router.php
@@ -161,6 +161,7 @@ class Router
 			$collector->addRoute(['GET'], '/{sub1}/{sub2}/{url}'               , Module\Proxy::class);
 		});
 		$this->routeCollector->addRoute(['GET', 'POST'], '/register',            Module\Register::class);
+		$this->routeCollector->addRoute(['GET'],         '/rsd.xml',             Module\ReallySimpleDiscovery::class);
 		$this->routeCollector->addRoute(['GET'],         '/statistics.json',     Module\Statistics::class);
 		$this->routeCollector->addRoute(['GET'],         '/tos',                 Module\Tos::class);
 		$this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\WebFinger::class);
diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php
new file mode 100644
index 0000000000..388a652aea
--- /dev/null
+++ b/src/Module/ReallySimpleDiscovery.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Core\Renderer;
+
+/**
+ * Prints the rsd.xml
+ * @see http://danielberlinger.github.io/rsd/
+ */
+class ReallySimpleDiscovery extends BaseModule
+{
+	public static function rawContent()
+	{
+		header ("Content-Type: text/xml");
+		$tpl = Renderer::getMarkupTemplate('rsd.tpl');
+		echo Renderer::replaceMacros($tpl, []);
+		exit();
+	}
+}
diff --git a/view/templates/rsd.tpl b/view/templates/rsd.tpl
new file mode 100644
index 0000000000..c194e8f26b
--- /dev/null
+++ b/view/templates/rsd.tpl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
+	<service>
+		<engineName>Friendica</engineName>
+		<engineLink>http://friendica.com/</engineLink>
+		<apis>
+			<api name="Twitter" preferred="true" apiLink="{{$baseurl}}/api/" blogID="">
+				<settings>
+					<docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
+					<setting name="OAuth">false</setting>
+				</settings>
+			</api>
+		</apis>
+	</service>
+</rsd>

From 1a79a741f090fc7aefdec734d1bf8bc3a58f0672 Mon Sep 17 00:00:00 2001
From: Philipp Holzer <admin@philipp.info>
Date: Sun, 5 May 2019 10:09:08 +0200
Subject: [PATCH 2/2] include feedback

---
 src/Module/ReallySimpleDiscovery.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php
index 388a652aea..4c14d3c837 100644
--- a/src/Module/ReallySimpleDiscovery.php
+++ b/src/Module/ReallySimpleDiscovery.php
@@ -13,9 +13,9 @@ class ReallySimpleDiscovery extends BaseModule
 {
 	public static function rawContent()
 	{
-		header ("Content-Type: text/xml");
+		header ('Content-Type: text/xml');
 		$tpl = Renderer::getMarkupTemplate('rsd.tpl');
-		echo Renderer::replaceMacros($tpl, []);
+		echo Renderer::replaceMacros($tpl);
 		exit();
 	}
 }