diff --git a/mod/viewsrc.php b/mod/viewsrc.php
deleted file mode 100644
index 55eb0b990c..0000000000
--- a/mod/viewsrc.php
+++ /dev/null
@@ -1,35 +0,0 @@
-argc > 1) ? intval($a->argv[1]) : 0);
-
- if (!$item_id) {
- throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('Item not found.'));
- }
-
- $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
-
- if (DBA::isResult($item)) {
- if ($a->isAjax()) {
- echo str_replace("\n", '
', $item['body']);
- exit();
- } else {
- $o .= str_replace("\n", '
', $item['body']);
- }
- }
- return $o;
-}
diff --git a/src/App/Router.php b/src/App/Router.php
index 015120a403..3da634a037 100644
--- a/src/App/Router.php
+++ b/src/App/Router.php
@@ -170,6 +170,7 @@ class Router
$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'], '/viewsrc/{item:\d+}', Module\ItemBody::class);
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);
$this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class);
}
diff --git a/src/Module/ItemBody.php b/src/Module/ItemBody.php
new file mode 100644
index 0000000000..ee50b52b28
--- /dev/null
+++ b/src/Module/ItemBody.php
@@ -0,0 +1,43 @@
+argc > 1) ? intval($app->argv[1]) : 0);
+
+ if (!$itemId) {
+ throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+ }
+
+ $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
+
+ if (!empty($item)) {
+ if ($app->isAjax()) {
+ echo str_replace("\n", '
', $item['body']);
+ exit();
+ } else {
+ return str_replace("\n", '
', $item['body']);
+ }
+ } else {
+ throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+ }
+ }
+}