summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrdalverny <rdalverny@gmail.com>2022-01-22 21:42:34 +0100
committerrdalverny <rdalverny@gmail.com>2022-01-22 21:42:34 +0100
commiteb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a (patch)
tree6d9d43672a17a8df41507e87fd8d2d1083ca5585
parent1ebace1417563a74967e0c45fb3998a26770eb47 (diff)
downloadplanet-eb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a.tar
planet-eb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a.tar.gz
planet-eb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a.tar.bz2
planet-eb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a.tar.xz
planet-eb943ac2fa3ffd85e25e1cd7cce903fe25b8d34a.zip
Fix broken link to people.opml
-rwxr-xr-xcustom/views/default/sidebar.tpl.php4
-rw-r--r--public/opml/index.php10
-rw-r--r--tests/InstallTest.php20
3 files changed, 32 insertions, 2 deletions
diff --git a/custom/views/default/sidebar.tpl.php b/custom/views/default/sidebar.tpl.php
index 13ae626..9e4bc07 100755
--- a/custom/views/default/sidebar.tpl.php
+++ b/custom/views/default/sidebar.tpl.php
@@ -14,14 +14,14 @@ usort($all_people, array('PlanetFeed', 'compare'));
<?php endforeach; ?>
</ul>
<p>
- <img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="custom/people.opml"><?=_g('All feeds in OPML format')?></a>
+ <img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="opml/"><?=_g('All feeds in OPML format')?></a>
</p>
</div>
<div class="section">
<h2><?=_g('Syndicate')?></h2>
<ul>
- <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<a href="atom.php"><?=_g('Feed (ATOM)')?></a></li>
+ <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" />&nbsp;<a href="feed/"><?=_g('Feed (ATOM)')?></a></li>
</ul>
</div>
diff --git a/public/opml/index.php b/public/opml/index.php
new file mode 100644
index 0000000..260057d
--- /dev/null
+++ b/public/opml/index.php
@@ -0,0 +1,10 @@
+<?php
+require_once '../../app/app.php';
+
+if (!file_exists(config_path('people.opml'))) {
+ header('HTTP/1.1 404 Not Found');
+ exit;
+}
+
+header('Content-Type: text/xml; charset=utf-8');
+readfile(config_path('people.opml'));
diff --git a/tests/InstallTest.php b/tests/InstallTest.php
index 5433c56..212d5fe 100644
--- a/tests/InstallTest.php
+++ b/tests/InstallTest.php
@@ -100,4 +100,24 @@ class InstallTest extends GuzzleHarness
$this->assertFileExists(custom_path('config.yml.bak'), "Backup config is kept");
$this->assertFileExists(custom_path('people.opml.bak'), "Backup OPML is kept");
}
+
+ public function testFetchPublicOPML()
+ {
+ $data = [
+ 'url' => 'http://127.0.0.1:8081/',
+ 'title' => 'My website',
+ 'password' => 'admin',
+ 'locale' => 'en',
+ ];
+
+ $res = $this->client->request('POST', '/install.php', [
+ 'form_params' => $data
+ ]);
+ $this->assertEquals(200, $res->getStatusCode());
+ $this->assertStringContainsString('Your moonmoon is ready.', (string) $res->getBody());
+
+ $res = $this->client->get('/opml/');
+ $this->assertEquals(200, $res->getStatusCode());
+ $this->assertXmlStringEqualsXmlFile(config_path('people.opml'), (string) $res->getBody());
+ }
}